diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-07-18 12:11:39 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-07-18 12:25:37 -0600 |
commit | 060b5d24f824de45342c8ea1bab8fc98c08b369d (patch) | |
tree | 57b304d388277310990775ee5c9bb0f67b7bb7e6 /src/net/tmwa/gamehandler.cpp | |
parent | 81d8168bb5796ccb1704bcce9f5327c35e55d281 (diff) | |
download | mana-client-060b5d24f824de45342c8ea1bab8fc98c08b369d.tar.gz mana-client-060b5d24f824de45342c8ea1bab8fc98c08b369d.tar.bz2 mana-client-060b5d24f824de45342c8ea1bab8fc98c08b369d.tar.xz mana-client-060b5d24f824de45342c8ea1bab8fc98c08b369d.zip |
Replace some state-related netcode methods with events
Also move the virtual destructors of the Net handler base classes to
the top of their method lists.
Reviewed-by: Chuck Miller
Diffstat (limited to 'src/net/tmwa/gamehandler.cpp')
-rw-r--r-- | src/net/tmwa/gamehandler.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 179d98e4..4810a3ea 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -22,6 +22,7 @@ #include "net/tmwa/gamehandler.h" #include "client.h" +#include "event.h" #include "game.h" #include "localplayer.h" #include "log.h" @@ -58,6 +59,8 @@ GameHandler::GameHandler() }; handledMessages = _messages; gameHandler = this; + + listen("Game"); } void GameHandler::handleMessage(Net::MessageIn &msg) @@ -104,6 +107,21 @@ void GameHandler::handleMessage(Net::MessageIn &msg) } } +void GameHandler::event(const std::string &channel, const Mana::Event &event) +{ + if (channel == "Game") + { + if (event.getName() == "EnginesInitalized") + { + Game::instance()->changeMap(mMap); + } + else if (event.getName() == "MapLoaded") + { + MessageOut outMsg(CMSG_MAP_LOADED); + } + } +} + void GameHandler::connect() { mNetwork->connect(mapServer); @@ -141,16 +159,6 @@ void GameHandler::disconnect() mNetwork->disconnect(); } -void GameHandler::inGame() -{ - Game::instance()->changeMap(mMap); -} - -void GameHandler::mapLoaded(const std::string &mapName) -{ - MessageOut outMsg(CMSG_MAP_LOADED); -} - void GameHandler::who() { } |