summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-08-05 18:31:50 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-08-05 18:40:24 -0700
commitfb1e500e572774131d0891018332fc625b6a4c52 (patch)
tree0121538ef76a719bb320088013a629b7ffb87c1a /src
parent09f72397156edb97631209c4cac765364f420bd3 (diff)
downloadtmwa-fb1e500e572774131d0891018332fc625b6a4c52.tar.gz
tmwa-fb1e500e572774131d0891018332fc625b6a4c52.tar.bz2
tmwa-fb1e500e572774131d0891018332fc625b6a4c52.tar.xz
tmwa-fb1e500e572774131d0891018332fc625b6a4c52.zip
Use attoconf and proper versionsv13.8.5
Diffstat (limited to 'src')
-rw-r--r--src/char/char.cpp8
-rw-r--r--src/common/version.hpp77
-rw-r--r--src/ladmin/ladmin.cpp39
-rw-r--r--src/login/login.cpp18
-rw-r--r--src/map/clif.cpp8
5 files changed, 82 insertions, 68 deletions
diff --git a/src/char/char.cpp b/src/char/char.cpp
index 6108dca..fb1ca7d 100644
--- a/src/char/char.cpp
+++ b/src/char/char.cpp
@@ -2449,13 +2449,7 @@ void parse_char(int fd)
case 0x7530: // Athena情報所得
WFIFOW(fd, 0) = 0x7531;
- WFIFOB(fd, 2) = ATHENA_MAJOR_VERSION;
- WFIFOB(fd, 3) = ATHENA_MINOR_VERSION;
- WFIFOB(fd, 4) = ATHENA_REVISION;
- WFIFOB(fd, 5) = ATHENA_RELEASE_FLAG;
- WFIFOB(fd, 6) = ATHENA_OFFICIAL_FLAG;
- WFIFOB(fd, 7) = ATHENA_SERVER_INTER | ATHENA_SERVER_CHAR;
- WFIFOW(fd, 8) = ATHENA_MOD_VERSION;
+ WFIFO_STRUCT(fd, 2, CURRENT_CHAR_SERVER_VERSION);
WFIFOSET(fd, 10);
RFIFOSKIP(fd, 2);
return;
diff --git a/src/common/version.hpp b/src/common/version.hpp
index d72f41e..4bdaa29 100644
--- a/src/common/version.hpp
+++ b/src/common/version.hpp
@@ -1,24 +1,61 @@
-/// Some constants to identify the version of (e)Athena
-/// The values are different if the client connects (-1,'T','M','W',flags32)
-// These numbers have never been changed while TMW
#ifndef VERSION_HPP
#define VERSION_HPP
-//When a server receives a 0x7530 packet from an admin connection,
-//it sends an 0x7531 packet with the following bytes
-# define ATHENA_MAJOR_VERSION 1 // Major Version
-# define ATHENA_MINOR_VERSION 0 // Minor Version
-# define ATHENA_REVISION 0 // Revision
-
-# define ATHENA_RELEASE_FLAG 1 // 1=Develop,0=Stable
-# define ATHENA_OFFICIAL_FLAG 1 // 1=Mod,0=Official
-
-// and a bitmask of these (the char server sends char and inter)
-# define ATHENA_SERVER_LOGIN 1 // login server
-# define ATHENA_SERVER_CHAR 2 // char server
-# define ATHENA_SERVER_INTER 4 // inter server
-# define ATHENA_SERVER_MAP 8 // map server
-
-// and this as two bytes
-# define ATHENA_MOD_VERSION 1052 // mod version (patch No.)
+
+// TODO generate this from ./configure
+
+# define TMWA_VERSION_MAJOR 13
+# define TMWA_VERSION_MINOR 8
+# define TMWA_VERSION_PATCH 5
+# define TMWA_DEVELOP_FLAG 1
+
+// TODO make these bitwise enums
+# define TMWA_FLAG_REGISTRATION 0x01
+
+# define TMWA_SERVER_LOGIN 0x01
+# define TMWA_SERVER_CHAR 0x02
+# define TMWA_SERVER_INTER 0x04
+# define TMWA_SERVER_MAP 0x08
+
+# define TMWA_VENDOR "Vanilla"
+# define TMWA_VENDOR_VERSION 0
+
+struct Version
+{
+ uint8_t major;
+ uint8_t minor; // flavor1
+ uint8_t patch; // flavor2
+ uint8_t devel; // flavor3
+
+ uint8_t flags;
+ uint8_t which;
+ uint16_t vend;
+ // can't add vendor name yet
+};
+static_assert(sizeof(Version) == 8, "this is send over the network, can't change");
+
+constexpr Version CURRENT_LOGIN_SERVER_VERSION =
+{
+ TMWA_VERSION_MAJOR, TMWA_VERSION_MINOR, TMWA_VERSION_PATCH,
+ TMWA_DEVELOP_FLAG,
+
+ 0, TMWA_SERVER_LOGIN,
+ TMWA_VENDOR_VERSION,
+};
+constexpr Version CURRENT_CHAR_SERVER_VERSION =
+{
+ TMWA_VERSION_MAJOR, TMWA_VERSION_MINOR, TMWA_VERSION_PATCH,
+ TMWA_DEVELOP_FLAG,
+
+ 0, TMWA_SERVER_CHAR | TMWA_SERVER_INTER,
+ TMWA_VENDOR_VERSION,
+};
+constexpr Version CURRENT_MAP_SERVER_VERSION =
+{
+ TMWA_VERSION_MAJOR, TMWA_VERSION_MINOR, TMWA_VERSION_PATCH,
+ TMWA_DEVELOP_FLAG,
+
+ 0, TMWA_SERVER_MAP,
+ TMWA_VENDOR_VERSION,
+};
#endif // VERSION_HPP
diff --git a/src/ladmin/ladmin.cpp b/src/ladmin/ladmin.cpp
index 2581456..9f4691c 100644
--- a/src/ladmin/ladmin.cpp
+++ b/src/ladmin/ladmin.cpp
@@ -1942,28 +1942,18 @@ void parse_fromlogin(int fd)
case 0x7531: // Displaying of the version of the login-server
if (RFIFOREST(fd) < 10)
return;
+ {
Iprintf(" Login-Server [%s:%d]\n", loginserverip,
loginserverport);
- if (RFIFOB(login_fd, 5) == 0)
- {
- Iprintf(" eAthena version stable-%d.%d",
- RFIFOB(login_fd, 2),
- RFIFOB(login_fd, 3));
- }
- else
- {
- Iprintf(" eAthena version dev-%d.%d",
- RFIFOB(login_fd, 2),
- RFIFOB(login_fd, 3));
- }
- if (RFIFOB(login_fd, 4) == 0)
- Iprintf(" revision %d", RFIFOB(login_fd, 4));
- if (RFIFOB(login_fd, 6) == 0)
- {
- Iprintf("%d.\n", RFIFOW(login_fd, 8));
- }
- else
- Iprintf("-mod%d.\n", RFIFOW(login_fd, 8));
+ Version version;
+ RFIFO_STRUCT(login_fd, 2, version);
+ Iprintf(" tmwA version %hhu.%hhu.%hhu (dev? %hhu) (flags %hhx) (which %hhx) (vend %hu)\n",
+ version.major, version.minor, version.patch,
+ version.devel,
+
+ version.flags, version.which,
+ version.vend);
+ }
bytes_to_read = 0;
RFIFOSKIP(fd, 10);
break;
@@ -2872,8 +2862,13 @@ int do_init(int argc, ZString *argv)
set_defaultparse(parse_fromlogin);
Iprintf("EAthena login-server administration tool.\n");
- Iprintf("(for eAthena version %d.%d.%d.)\n", ATHENA_MAJOR_VERSION,
- ATHENA_MINOR_VERSION, ATHENA_REVISION);
+ Version version = CURRENT_LOGIN_SERVER_VERSION;
+ Iprintf("for tmwA version %hhu.%hhu.%hhu (dev? %hhu) (flags %hhx) (which %hhx) (vend %hu)\n",
+ version.major, version.minor, version.patch,
+ version.devel,
+
+ version.flags, version.which,
+ version.vend);
LADMIN_LOG("Ladmin is ready.\n");
Iprintf("Ladmin is \033[1;32mready\033[0m.\n\n");
diff --git a/src/login/login.cpp b/src/login/login.cpp
index 852cd3d..031abd7 100644
--- a/src/login/login.cpp
+++ b/src/login/login.cpp
@@ -1654,13 +1654,7 @@ void parse_admin(int fd)
LOGIN_LOG("'ladmin': Sending of the server version (ip: %s)\n",
ip);
WFIFOW(fd, 0) = 0x7531;
- WFIFOB(fd, 2) = ATHENA_MAJOR_VERSION;
- WFIFOB(fd, 3) = ATHENA_MINOR_VERSION;
- WFIFOB(fd, 4) = ATHENA_REVISION;
- WFIFOB(fd, 5) = ATHENA_RELEASE_FLAG;
- WFIFOB(fd, 6) = ATHENA_OFFICIAL_FLAG;
- WFIFOB(fd, 7) = ATHENA_SERVER_LOGIN;
- WFIFOW(fd, 8) = ATHENA_MOD_VERSION;
+ WFIFO_STRUCT(fd, 2, CURRENT_LOGIN_SERVER_VERSION);
WFIFOSET(fd, 10);
RFIFOSKIP(fd, 2);
break;
@@ -3110,12 +3104,12 @@ void parse_login(int fd)
LOGIN_LOG("Sending of the server version (ip: %s)\n",
ip);
WFIFOW(fd, 0) = 0x7531;
- WFIFOB(fd, 2) = -1;
- WFIFOB(fd, 3) = 'T';
- WFIFOB(fd, 4) = 'M';
- WFIFOB(fd, 5) = 'W';
- WFIFOL(fd, 6) = new_account_flag ? 1 : 0;
+ {
+ Version version = CURRENT_LOGIN_SERVER_VERSION;
+ version.flags = new_account_flag ? 1 : 0;
+ WFIFO_STRUCT(fd, 2, version);
WFIFOSET(fd, 10);
+ }
RFIFOSKIP(fd, 2);
break;
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index 494e09f..fa208be 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -5451,13 +5451,7 @@ void clif_parse(int fd)
{
case 0x7530: // Athena情報所得
WFIFOW(fd, 0) = 0x7531;
- WFIFOB(fd, 2) = ATHENA_MAJOR_VERSION;
- WFIFOB(fd, 3) = ATHENA_MINOR_VERSION;
- WFIFOB(fd, 4) = ATHENA_REVISION;
- WFIFOB(fd, 5) = ATHENA_RELEASE_FLAG;
- WFIFOB(fd, 6) = ATHENA_OFFICIAL_FLAG;
- WFIFOB(fd, 7) = ATHENA_SERVER_MAP;
- WFIFOW(fd, 8) = ATHENA_MOD_VERSION;
+ WFIFO_STRUCT(fd, 2, CURRENT_MAP_SERVER_VERSION);
WFIFOSET(fd, 10);
RFIFOSKIP(fd, 2);
break;