summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-20 19:23:57 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-20 19:23:57 +0300
commitd9773c380e06c089cfee85f07a81ab9167af2982 (patch)
tree6129c8848b0fe2ab6de65b380255b06210210939
parentdf43616053bf6533938178eb3ddd81de74ededf2 (diff)
downloadmanaplus-d9773c380e06c089cfee85f07a81ab9167af2982.tar.gz
manaplus-d9773c380e06c089cfee85f07a81ab9167af2982.tar.bz2
manaplus-d9773c380e06c089cfee85f07a81ab9167af2982.tar.xz
manaplus-d9773c380e06c089cfee85f07a81ab9167af2982.zip
Move processOnlineList from ea namespace into eathena.
-rw-r--r--src/net/ea/playerhandler.cpp63
-rw-r--r--src/net/ea/playerhandler.h2
-rw-r--r--src/net/eathena/playerhandler.cpp65
-rw-r--r--src/net/eathena/playerhandler.h2
4 files changed, 67 insertions, 65 deletions
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 42084e419..46dee6769 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -22,23 +22,19 @@
#include "net/ea/playerhandler.h"
-#include "configuration.h"
#include "game.h"
#include "party.h"
#include "notifymanager.h"
#include "soundmanager.h"
#include "units.h"
-#include "being/beingflag.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
-#include "gui/onlineplayer.h"
#include "gui/viewport.h"
#include "gui/windows/skilldialog.h"
#include "gui/windows/statuswindow.h"
-#include "gui/windows/whoisonline.h"
#include "resources/notifytypes.h"
@@ -473,63 +469,4 @@ void PlayerHandler::processMapMusic(Net::MessageIn &msg)
map->setMusicFile(music);
}
-void PlayerHandler::processOnlineList(Net::MessageIn &msg)
-{
- if (!whoIsOnline)
- return;
-
- BLOCK_START("PlayerHandler::processOnlineList")
- const int size = msg.readInt16("len") - 4;
- std::vector<OnlinePlayer*> arr;
-
- if (!size)
- {
- if (whoIsOnline)
- whoIsOnline->loadList(arr);
- BLOCK_END("PlayerHandler::processOnlineList")
- return;
- }
-
- char *const start = reinterpret_cast<char*>(msg.readBytes(size, "nicks"));
- if (!start)
- {
- BLOCK_END("PlayerHandler::processOnlineList")
- return;
- }
-
- const char *buf = start;
-
- int addVal = 3;
-
- while (buf - start + 1 < size
- && *(buf + static_cast<size_t>(addVal)))
- {
- unsigned char status = *buf;
- buf ++;
- unsigned char level = *buf;
- buf ++;
- unsigned char ver = *buf;
- buf ++;
-
- GenderT gender = Gender::UNSPECIFIED;
- if (config.getBoolValue("showgender"))
- {
- if (status & BeingFlag::GENDER_MALE)
- gender = Gender::MALE;
- else if (status & BeingFlag::GENDER_OTHER)
- gender = Gender::OTHER;
- else
- gender = Gender::FEMALE;
- }
- arr.push_back(new OnlinePlayer(static_cast<const char*>(buf),
- status, level, gender, ver));
- buf += strlen(buf) + 1;
- }
-
- if (whoIsOnline)
- whoIsOnline->loadList(arr);
- delete [] start;
- BLOCK_END("PlayerHandler::processOnlineList")
-}
-
} // namespace Ea
diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h
index 4f443c8bf..2134db051 100644
--- a/src/net/ea/playerhandler.h
+++ b/src/net/ea/playerhandler.h
@@ -81,8 +81,6 @@ class PlayerHandler notfinal : public Net::PlayerHandler
static void processMapMask(Net::MessageIn &msg);
static void processMapMusic(Net::MessageIn &msg);
-
- static void processOnlineList(Net::MessageIn &msg);
};
} // namespace Ea
diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp
index b7f83ead1..d1c48bfbd 100644
--- a/src/net/eathena/playerhandler.cpp
+++ b/src/net/eathena/playerhandler.cpp
@@ -22,10 +22,16 @@
#include "net/eathena/playerhandler.h"
+#include "configuration.h"
+
+#include "being/beingflag.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
+#include "gui/onlineplayer.h"
+
#include "gui/windows/statuswindow.h"
+#include "gui/windows/whoisonline.h"
#include "input/inputmanager.h"
@@ -664,4 +670,63 @@ void PlayerHandler::processPlayerClientCommand(Net::MessageIn &msg)
inputManager.executeChatCommand(cmd, args, nullptr);
}
+void PlayerHandler::processOnlineList(Net::MessageIn &msg)
+{
+ if (!whoIsOnline)
+ return;
+
+ BLOCK_START("PlayerHandler::processOnlineList")
+ const int size = msg.readInt16("len") - 4;
+ std::vector<OnlinePlayer*> arr;
+
+ if (!size)
+ {
+ if (whoIsOnline)
+ whoIsOnline->loadList(arr);
+ BLOCK_END("PlayerHandler::processOnlineList")
+ return;
+ }
+
+ char *const start = reinterpret_cast<char*>(msg.readBytes(size, "nicks"));
+ if (!start)
+ {
+ BLOCK_END("PlayerHandler::processOnlineList")
+ return;
+ }
+
+ const char *buf = start;
+
+ int addVal = 3;
+
+ while (buf - start + 1 < size
+ && *(buf + static_cast<size_t>(addVal)))
+ {
+ unsigned char status = *buf;
+ buf ++;
+ unsigned char level = *buf;
+ buf ++;
+ unsigned char ver = *buf;
+ buf ++;
+
+ GenderT gender = Gender::UNSPECIFIED;
+ if (config.getBoolValue("showgender"))
+ {
+ if (status & BeingFlag::GENDER_MALE)
+ gender = Gender::MALE;
+ else if (status & BeingFlag::GENDER_OTHER)
+ gender = Gender::OTHER;
+ else
+ gender = Gender::FEMALE;
+ }
+ arr.push_back(new OnlinePlayer(static_cast<const char*>(buf),
+ status, level, gender, ver));
+ buf += strlen(buf) + 1;
+ }
+
+ if (whoIsOnline)
+ whoIsOnline->loadList(arr);
+ delete [] start;
+ BLOCK_END("PlayerHandler::processOnlineList")
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/playerhandler.h b/src/net/eathena/playerhandler.h
index 5207b4ce7..32ab731e3 100644
--- a/src/net/eathena/playerhandler.h
+++ b/src/net/eathena/playerhandler.h
@@ -112,6 +112,8 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler
static void processPlayerRankPoints(Net::MessageIn &msg);
static void processPlayerClientCommand(Net::MessageIn &msg);
+
+ static void processOnlineList(Net::MessageIn &msg);
};
} // namespace EAthena