diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-12 21:09:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-12 21:30:35 +0300 |
commit | 09187552601a2b6c26225cf2fa4a700347a02224 (patch) | |
tree | fa75da86eff794d1062486e7fc6a6ee3620a0db5 | |
parent | 58f80ebffbb354357e2650a41e233f54df3e376d (diff) | |
download | mv-09187552601a2b6c26225cf2fa4a700347a02224.tar.gz mv-09187552601a2b6c26225cf2fa4a700347a02224.tar.bz2 mv-09187552601a2b6c26225cf2fa4a700347a02224.tar.xz mv-09187552601a2b6c26225cf2fa4a700347a02224.zip |
add server version check for "new" tmw servers.
-rw-r--r-- | src/client.cpp | 1 | ||||
-rw-r--r-- | src/client.h | 1 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 26 |
3 files changed, 26 insertions, 2 deletions
diff --git a/src/client.cpp b/src/client.cpp index 1afd8f477..7ab7cb328 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -184,6 +184,7 @@ volatile int cur_time; volatile bool runCounters; bool isSafeMode = false; int serverVersion = 0; +unsigned int tmwServerVersion = 0; int start_time; int textures_count = 0; diff --git a/src/client.h b/src/client.h index 257180a73..fe19a7154 100644 --- a/src/client.h +++ b/src/client.h @@ -59,6 +59,7 @@ extern volatile int tick_time; extern volatile int cur_time; extern bool isSafeMode; extern int serverVersion; +extern unsigned int tmwServerVersion; extern int start_time; extern int textures_count; diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 4f7a35d3b..91e2c3027 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -196,16 +196,38 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg) mRegistrationEnabled = options & FLAG_REGISTRATION; msg.skip(2); // 0 unused serverVersion = msg.readInt8(); + tmwServerVersion = 0; if (serverVersion >= 5) requestUpdateHosts(); } + else if (b1 == 255) + { // old TMWA + const unsigned int options = msg.readInt32(); + mRegistrationEnabled = options & FLAG_REGISTRATION; + serverVersion = 0; + tmwServerVersion = 0; + } + else if (b1 >= 0x0d) + { // new TMWA + const unsigned int options = msg.readInt32(); + mRegistrationEnabled = options & FLAG_REGISTRATION; + serverVersion = 0; + tmwServerVersion = (b1 << 16) | (b2 << 8) | b3; + } else - { + { // eAthena const unsigned int options = msg.readInt32(); mRegistrationEnabled = options & FLAG_REGISTRATION; serverVersion = 0; + tmwServerVersion = 0; } - logger->log("Server version: %d", serverVersion); + if (serverVersion > 0) + logger->log("Evol server version: %d", serverVersion); + else if (tmwServerVersion > 0) + logger->log("Tmw server version: x%06x", tmwServerVersion); + else + logger->log("Server witout version"); + if (serverVersion < 5) { if (client->getState() != STATE_LOGIN) |