diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-01-28 00:31:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-01-28 03:08:31 +0300 |
commit | 40f34b7ba7317f5f5c3dfbed0b291be9555d3137 (patch) | |
tree | 512bd693c37b8ad710a0f752abe3ac04e3c8ea77 /src/net | |
parent | 8333597dfaecfca2cac6b98390a8fb7131cb2a09 (diff) | |
download | manaplus-40f34b7ba7317f5f5c3dfbed0b291be9555d3137.tar.gz manaplus-40f34b7ba7317f5f5c3dfbed0b291be9555d3137.tar.bz2 manaplus-40f34b7ba7317f5f5c3dfbed0b291be9555d3137.tar.xz manaplus-40f34b7ba7317f5f5c3dfbed0b291be9555d3137.zip |
Add basic support for extended online list on evol server.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index d5f0641eb..3d48fb341 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -218,7 +218,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) return; int size = msg.readInt16() - 4; - std::vector<std::string> arr; + std::vector<OnlinePlayer*> arr; if (!size) { @@ -230,11 +230,25 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) const char *start = msg.readBytes(size); const char *buf = start; - while (buf - start + 1 < size && *(buf + 1)) + int addVal = 1; + if (serverVersion >= 4) + addVal = 3; + + while (buf - start + 1 < size && *(buf + addVal)) { -// char status = *buf; // now unused + char status = 0; + char ver = 0; + char level = 0; + if (serverVersion >= 4) + { + status = *buf; + buf ++; + level = *buf; + buf ++; + ver = *buf; + } buf ++; - arr.push_back(buf); + arr.push_back(new OnlinePlayer(buf, status, level, ver)); buf += strlen(buf) + 1; } |