diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-04-09 19:49:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-04-09 19:49:14 +0300 |
commit | 7e3bd20e9675202e30fac741f3d3acb4f19b109d (patch) | |
tree | 9e12ab198b68e8f6ed0dd2121a72066c7b7053ba /src/net | |
parent | b9d66c41246fef56e41f600b5523a5ff1a29a1c8 (diff) | |
download | manaplus-7e3bd20e9675202e30fac741f3d3acb4f19b109d.tar.gz manaplus-7e3bd20e9675202e30fac741f3d3acb4f19b109d.tar.bz2 manaplus-7e3bd20e9675202e30fac741f3d3acb4f19b109d.tar.xz manaplus-7e3bd20e9675202e30fac741f3d3acb4f19b109d.zip |
Small refactoring based on idea from mana commit 30d4b0adf4f17f05d1d62fc3428c896ef1079b6b
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/manaserv/generalhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/manaserv/generalhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/gamehandler.cpp | 10 | ||||
-rw-r--r-- | src/net/tmwa/gamehandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.h | 2 |
6 files changed, 18 insertions, 18 deletions
diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp index 3683187fe..8b38deb21 100644 --- a/src/net/manaserv/generalhandler.cpp +++ b/src/net/manaserv/generalhandler.cpp @@ -176,28 +176,28 @@ void GeneralHandler::clearHandlers() clearNetworkHandlers(); } -void GeneralHandler::event(Channels channel, +void GeneralHandler::event(Mana::Channels channel, const Mana::Event &event) { - if (channel == CHANNEL_CLIENT) + if (channel == Mana::CHANNEL_CLIENT) { int newState = event.getInt("newState"); - if (newState == STATE_GAME) + if (newState == Mana::STATE_GAME) { GameHandler *game = static_cast<GameHandler*>( Net::getGameHandler()); game->gameLoading(); } - else if (newState == STATE_LOAD_DATA) + else if (newState == Mana::STATE_LOAD_DATA) { Attributes::load(); Attributes::informItemDB(); } } - else if (channel == CHANNEL_GAME) + else if (channel == Mana::CHANNEL_GAME) { - if (event.getName() == EVENT_GUIWINDOWSLOADED) + if (event.getName() == Mana::EVENT_GUIWINDOWSLOADED) { inventoryWindow->setSplitAllowed(true); skillDialog->loadSkills("mana-skills.xml"); diff --git a/src/net/manaserv/generalhandler.h b/src/net/manaserv/generalhandler.h index d5636127f..946f7d631 100644 --- a/src/net/manaserv/generalhandler.h +++ b/src/net/manaserv/generalhandler.h @@ -54,7 +54,7 @@ class GeneralHandler : public Net::GeneralHandler, public Mana::Listener void clearHandlers(); - void event(Channels channel, const Mana::Event &event); + void event(Mana::Channels channel, const Mana::Event &event); protected: MessageHandlerPtr mBeingHandler; diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 3e22e94bb..b1f72a834 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -62,7 +62,7 @@ GameHandler::GameHandler() gameHandler = this; mCharID = 0; - listen(CHANNEL_GAME); + listen(Mana::CHANNEL_GAME); } void GameHandler::handleMessage(Net::MessageIn &msg) @@ -109,13 +109,13 @@ void GameHandler::handleMessage(Net::MessageIn &msg) } } -void GameHandler::event(Channels channel, const Mana::Event &event) +void GameHandler::event(Mana::Channels channel, const Mana::Event &event) { - if (channel == CHANNEL_GAME) + if (channel == Mana::CHANNEL_GAME) { - if (event.getName() == EVENT_ENGINESINITALIZED) + if (event.getName() == Mana::EVENT_ENGINESINITALIZED) Game::instance()->changeMap(mMap); - else if (event.getName() == EVENT_MAPLOADED) + else if (event.getName() == Mana::EVENT_MAPLOADED) MessageOut outMsg(CMSG_MAP_LOADED); } } diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h index 7616ae878..fbb623409 100644 --- a/src/net/tmwa/gamehandler.h +++ b/src/net/tmwa/gamehandler.h @@ -49,7 +49,7 @@ class GameHandler : public MessageHandler, public Net::GameHandler, void handleMessage(Net::MessageIn &msg); - void event(Channels channel, const Mana::Event &event); + void event(Mana::Channels channel, const Mana::Event &event); void connect(); diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index a246d0d8f..26f6983d7 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -230,12 +230,12 @@ void GeneralHandler::clearHandlers() mNetwork->clearHandlers(); } -void GeneralHandler::event(Channels channel, +void GeneralHandler::event(Mana::Channels channel, const Mana::Event &event) { - if (channel == CHANNEL_GAME) + if (channel == Mana::CHANNEL_GAME) { - if (event.getName() == EVENT_GUIWINDOWSLOADED) + if (event.getName() == Mana::EVENT_GUIWINDOWSLOADED) { if (inventoryWindow) inventoryWindow->setSplitAllowed(false); @@ -266,7 +266,7 @@ void GeneralHandler::event(Channels channel, statusWindow->addAttribute(ATTACK_RANGE, _("Attack Range"), false, ""); } - else if (event.getName() == EVENT_GUIWINDOWSUNLOADING) + else if (event.getName() == Mana::EVENT_GUIWINDOWSUNLOADING) { if (socialWindow) { diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index 6dadb01ed..516db76c5 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -59,7 +59,7 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler, void clearHandlers(); - void event(Channels channel, const Mana::Event &event); + void event(Mana::Channels channel, const Mana::Event &event); protected: MessageHandlerPtr mAdminHandler; |