diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-26 16:07:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-26 16:07:42 +0300 |
commit | 653447ca463eaf573e7123896155b538b8dec869 (patch) | |
tree | e42caca83d294891a06165b2b1feb2414641b6dc /src/net/ea/gamehandler.cpp | |
parent | 6fd6deb1ba87ddf74bff15055421f2b434b96f85 (diff) | |
download | manaplus-653447ca463eaf573e7123896155b538b8dec869.tar.gz manaplus-653447ca463eaf573e7123896155b538b8dec869.tar.bz2 manaplus-653447ca463eaf573e7123896155b538b8dec869.tar.xz manaplus-653447ca463eaf573e7123896155b538b8dec869.zip |
Move receive code from gamehandler into separate file.
Diffstat (limited to 'src/net/ea/gamehandler.cpp')
-rw-r--r-- | src/net/ea/gamehandler.cpp | 50 |
1 files changed, 9 insertions, 41 deletions
diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 8f21edf8f..4f8734e92 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -34,6 +34,8 @@ #include "net/messagein.h" +#include "net/ea/gamerecv.h" + #include "utils/gettext.h" #include "debug.h" @@ -41,14 +43,11 @@ namespace Ea { -std::string GameHandler::mMap; -BeingId GameHandler::mCharID = BeingId_zero; - GameHandler::GameHandler() : Net::GameHandler() { - mMap.clear(); - mCharID = BeingId_zero; + GameRecv::mMap.clear(); + GameRecv::mCharID = BeingId_zero; } void GameHandler::who() const @@ -57,50 +56,19 @@ void GameHandler::who() const void GameHandler::setMap(const std::string &map) { - mMap = map.substr(0, map.rfind(".")); -} - -void GameHandler::processWhoAnswer(Net::MessageIn &msg) -{ - NotifyManager::notify(NotifyTypes::ONLINE_USERS, - msg.readInt32("users count")); -} - -void GameHandler::processCharSwitchResponse(Net::MessageIn &msg) -{ - if (msg.readUInt8("response")) - client->setState(STATE_SWITCH_CHARACTER); -} - -void GameHandler::processMapQuitResponse(Net::MessageIn &msg) -{ - if (msg.readUInt8("response")) - { - CREATEWIDGET(OkDialog, - // TRANSLATORS: error header - _("Game"), - // TRANSLATORS: error message - _("Request to quit denied!"), - // TRANSLATORS: ok dialog button - _("OK"), - DialogType::ERROR, - Modal_true, - ShowCenter_true, - nullptr, - 260); - } + GameRecv::mMap = map.substr(0, map.rfind(".")); } void GameHandler::clear() { - mMap.clear(); - mCharID = BeingId_zero; + GameRecv::mMap.clear(); + GameRecv::mCharID = BeingId_zero; } void GameHandler::initEngines() const { - if (!mMap.empty()) - Game::instance()->changeMap(mMap); + if (!GameRecv::mMap.empty()) + Game::instance()->changeMap(GameRecv::mMap); } } // namespace Ea |