From 40f34b7ba7317f5f5c3dfbed0b291be9555d3137 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 28 Jan 2012 00:31:48 +0300 Subject: Add basic support for extended online list on evol server. --- src/net/tmwa/playerhandler.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/net/tmwa') 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 arr; + std::vector 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; } -- cgit v1.2.3-70-g09d2