diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-17 10:41:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-17 10:41:59 +0300 |
commit | 38b46ebb02bbe307765aa9a456b587eafd3dfd7e (patch) | |
tree | d096b453db8708d8239a4255a9d626eb8bb0f681 /src | |
parent | 9cdbed6c562f95e24e02f49630386f8b18884a02 (diff) | |
download | mv-38b46ebb02bbe307765aa9a456b587eafd3dfd7e.tar.gz mv-38b46ebb02bbe307765aa9a456b587eafd3dfd7e.tar.bz2 mv-38b46ebb02bbe307765aa9a456b587eafd3dfd7e.tar.xz mv-38b46ebb02bbe307765aa9a456b587eafd3dfd7e.zip |
Remove getter for generalHandler.
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 12 | ||||
-rw-r--r-- | src/game.cpp | 4 | ||||
-rw-r--r-- | src/net/generalhandler.h | 2 | ||||
-rw-r--r-- | src/net/net.cpp | 18 | ||||
-rw-r--r-- | src/net/net.h | 2 |
5 files changed, 17 insertions, 21 deletions
diff --git a/src/client.cpp b/src/client.cpp index 3758056a6..88c9766e0 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -765,8 +765,8 @@ int Client::gameExec() continue; BLOCK_START("Client::gameExec 3") - if (Net::getGeneralHandler()) - Net::getGeneralHandler()->flushNetwork(); + if (generalHandler) + generalHandler->flushNetwork(); BLOCK_END("Client::gameExec 3") BLOCK_START("Client::gameExec 4") @@ -1369,8 +1369,8 @@ int Client::gameExec() mCurrentDialog = nullptr; logger->log1("State: GAME"); - if (Net::getGeneralHandler()) - Net::getGeneralHandler()->reloadPartially(); + if (generalHandler) + generalHandler->reloadPartially(); mGame = new Game; BLOCK_END("Client::gameExec STATE_GAME") break; @@ -1573,8 +1573,8 @@ int Client::gameExec() case STATE_FORCE_QUIT: BLOCK_START("Client::gameExec STATE_FORCE_QUIT") logger->log1("State: FORCE QUIT"); - if (Net::getGeneralHandler()) - Net::getGeneralHandler()->unload(); + if (generalHandler) + generalHandler->unload(); mState = STATE_EXIT; BLOCK_END("Client::gameExec STATE_FORCE_QUIT") break; diff --git a/src/game.cpp b/src/game.cpp index b57b02f2c..44bb258bb 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -289,7 +289,7 @@ static void createGuiWindows() if (localPlayer) localPlayer->updateStatus(); - Net::getGeneralHandler()->gameStarted(); + generalHandler->gameStarted(); } /** @@ -297,7 +297,7 @@ static void createGuiWindows() */ static void destroyGuiWindows() { - Net::getGeneralHandler()->gameEnded(); + generalHandler->gameEnded(); if (whoIsOnline) whoIsOnline->setAllowUpdate(false); diff --git a/src/net/generalhandler.h b/src/net/generalhandler.h index 5467c06e6..ecfbfe24a 100644 --- a/src/net/generalhandler.h +++ b/src/net/generalhandler.h @@ -53,4 +53,6 @@ class GeneralHandler notfinal } // namespace Net +extern Net::GeneralHandler *generalHandler; + #endif // NET_GENERALHANDLER_H diff --git a/src/net/net.cpp b/src/net/net.cpp index cd97e921e..b8b292f98 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -48,6 +48,7 @@ namespace Net class ChatHandler; class FamilyHandler; class GameHandler; + class GeneralHandler; } Net::AdminHandler *adminHandler = nullptr; @@ -73,11 +74,6 @@ Net::CashShopHandler *cashShopHandler = nullptr; Net::FamilyHandler *familyHandler = nullptr; Net::BankHandler *bankHandler = nullptr; -Net::GeneralHandler *Net::getGeneralHandler() -{ - return generalHandler; -} - Net::GuildHandler *Net::getGuildHandler() { return guildHandler; @@ -141,14 +137,14 @@ ServerInfo::Type networkType = ServerInfo::UNKNOWN; void connectToServer(const ServerInfo &server) { BLOCK_START("Net::connectToServer") - if (networkType == server.type && getGeneralHandler()) + if (networkType == server.type && generalHandler) { - getGeneralHandler()->reload(); + generalHandler->reload(); } else { - if (networkType != ServerInfo::UNKNOWN && getGeneralHandler()) - getGeneralHandler()->unload(); + if (networkType != ServerInfo::UNKNOWN && generalHandler) + generalHandler->unload(); switch (server.type) { @@ -171,7 +167,7 @@ void connectToServer(const ServerInfo &server) break; } - getGeneralHandler()->load(); + generalHandler->load(); networkType = server.type; } @@ -186,7 +182,7 @@ void connectToServer(const ServerInfo &server) void unload() { - GeneralHandler *const handler = getGeneralHandler(); + GeneralHandler *const handler = generalHandler; if (handler) handler->unload(); } diff --git a/src/net/net.h b/src/net/net.h index 825a9894a..b0fb224bd 100644 --- a/src/net/net.h +++ b/src/net/net.h @@ -36,7 +36,6 @@ namespace Net { -class GeneralHandler; class GuildHandler; class InventoryHandler; class LoginHandler; @@ -49,7 +48,6 @@ class SkillHandler; class TradeHandler; class ServerFeatures; -GeneralHandler *getGeneralHandler() A_WARN_UNUSED; GuildHandler *getGuildHandler() A_WARN_UNUSED; InventoryHandler *getInventoryHandler() A_WARN_UNUSED; LoginHandler *getLoginHandler() A_WARN_UNUSED; |