diff options
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/gamehandler.cpp | 34 | ||||
-rw-r--r-- | src/net/ea/gamehandler.h | 25 |
2 files changed, 21 insertions, 38 deletions
diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 19978979b..4a011c6a8 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -37,27 +37,9 @@ namespace Ea GameHandler::GameHandler() : mCharID(0) { - listen(CHANNEL_GAME); } -void GameHandler::processEvent(Channels channel, - const DepricatedEvent &event) -{ - if (channel == CHANNEL_GAME) - { - if (event.getName() == EVENT_ENGINESINITALIZED) - { - if (!mMap.empty()) - Game::instance()->changeMap(mMap); - } - else if (event.getName() == EVENT_MAPLOADED) - { - mapLoadedEvent(); - } - } -} - -void GameHandler::who() +void GameHandler::who() const { } @@ -66,7 +48,7 @@ void GameHandler::setMap(const std::string &map) mMap = map.substr(0, map.rfind(".")); } -void GameHandler::processMapLogin(Net::MessageIn &msg) +void GameHandler::processMapLogin(Net::MessageIn &msg) const { unsigned char direction; uint16_t x, y; @@ -81,18 +63,18 @@ void GameHandler::processMapLogin(Net::MessageIn &msg) player_node->setTileCoords(x, y); } -void GameHandler::processWhoAnswer(Net::MessageIn &msg) +void GameHandler::processWhoAnswer(Net::MessageIn &msg) const { NotifyManager::notify(NotifyManager::ONLINE_USERS, msg.readInt32()); } -void GameHandler::processCharSwitchResponse(Net::MessageIn &msg) +void GameHandler::processCharSwitchResponse(Net::MessageIn &msg) const { if (msg.readInt8()) Client::setState(STATE_SWITCH_CHARACTER); } -void GameHandler::processMapQuitResponse(Net::MessageIn &msg) +void GameHandler::processMapQuitResponse(Net::MessageIn &msg) const { if (msg.readInt8()) new OkDialog(_("Game"), _("Request to quit denied!"), DIALOG_ERROR); @@ -104,4 +86,10 @@ void GameHandler::clear() mCharID = 0; } +void GameHandler::initEngines() const +{ + if (!mMap.empty()) + Game::instance()->changeMap(mMap); +} + } // namespace Ea diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h index c0b4286ce..d6c9cebdc 100644 --- a/src/net/ea/gamehandler.h +++ b/src/net/ea/gamehandler.h @@ -23,8 +23,6 @@ #ifndef NET_EA_GAMEHANDLER_H #define NET_EA_GAMEHANDLER_H -#include "listener.h" - #include "net/gamehandler.h" #include "net/messagein.h" #include "net/net.h" @@ -32,37 +30,34 @@ namespace Ea { -class GameHandler : public Net::GameHandler, public Listener +class GameHandler : public Net::GameHandler { public: GameHandler(); A_DELETE_COPY(GameHandler) - virtual void processEvent(Channels channel, - const DepricatedEvent &event) override; - - virtual void who(); + virtual void who() const override; - virtual bool removeDeadBeings() const A_WARN_UNUSED + virtual bool removeDeadBeings() const override A_WARN_UNUSED { return true; } virtual void setMap(const std::string &map); - virtual bool canUseMagicBar() const A_WARN_UNUSED + virtual bool canUseMagicBar() const override A_WARN_UNUSED { return true; } - virtual void mapLoadedEvent() = 0; + virtual void processMapLogin(Net::MessageIn &msg) const; - virtual void processMapLogin(Net::MessageIn &msg); + virtual void processWhoAnswer(Net::MessageIn &msg) const; - virtual void processWhoAnswer(Net::MessageIn &msg); + virtual void processCharSwitchResponse(Net::MessageIn &msg) const; - virtual void processCharSwitchResponse(Net::MessageIn &msg); + virtual void processMapQuitResponse(Net::MessageIn &msg) const; - virtual void processMapQuitResponse(Net::MessageIn &msg); + virtual void clear() override; - virtual void clear(); + virtual void initEngines() const override; protected: std::string mMap; |