diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-17 10:31:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-17 10:31:03 +0300 |
commit | 9cdbed6c562f95e24e02f49630386f8b18884a02 (patch) | |
tree | 4dad8316607387c80b66cf42b2a806ffa1a3afed | |
parent | 3a7313c027407e3b35360a021c72fe78f181d81d (diff) | |
download | manaplus-9cdbed6c562f95e24e02f49630386f8b18884a02.tar.gz manaplus-9cdbed6c562f95e24e02f49630386f8b18884a02.tar.bz2 manaplus-9cdbed6c562f95e24e02f49630386f8b18884a02.tar.xz manaplus-9cdbed6c562f95e24e02f49630386f8b18884a02.zip |
Remove getter for gameHandler.
-rw-r--r-- | src/actions/actions.cpp | 2 | ||||
-rw-r--r-- | src/being/being.cpp | 2 | ||||
-rw-r--r-- | src/client.cpp | 18 | ||||
-rw-r--r-- | src/game.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/quitdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/charserverhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/familyhandler.h | 2 | ||||
-rw-r--r-- | src/net/gamehandler.h | 2 | ||||
-rw-r--r-- | src/net/net.cpp | 12 | ||||
-rw-r--r-- | src/net/net.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 4 |
13 files changed, 31 insertions, 39 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 6175ec904..5fd3b6e70 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -757,7 +757,7 @@ impHandler0(cacheInfo) impHandler0(disconnect) { - Net::getGameHandler()->disconnect2(); + gameHandler->disconnect2(); return true; } diff --git a/src/being/being.cpp b/src/being/being.cpp index 02d235e8d..1f4845833 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1462,7 +1462,7 @@ void Being::logic() if (frameCount < 10) frameCount = 10; - if (!isAlive() && mSpeed && Net::getGameHandler()->removeDeadBeings() + if (!isAlive() && mSpeed && gameHandler->removeDeadBeings() && static_cast<int> ((static_cast<float>(get_elapsed_time(mActionTime)) / mSpeed)) >= frameCount) { diff --git a/src/client.cpp b/src/client.cpp index 8f0827d44..3758056a6 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -816,7 +816,7 @@ int Client::gameExec() BLOCK_START("Client::gameExec 6") if (mState == STATE_CONNECT_GAME && - Net::getGameHandler()->isConnected()) + gameHandler->isConnected()) { Net::getLoginHandler()->disconnect(); } @@ -939,7 +939,7 @@ int Client::gameExec() BLOCK_END("Client::gameExec 6") if (mState == STATE_SWITCH_LOGIN && mOldState == STATE_GAME) - Net::getGameHandler()->disconnect(); + gameHandler->disconnect(); if (mState != mOldState) { @@ -1315,7 +1315,7 @@ int Client::gameExec() _("Connecting to the game server"), STATE_CHOOSE_SERVER); mCurrentDialog->postInit(); - Net::getGameHandler()->connect(); + gameHandler->connect(); BLOCK_END("Client::gameExec STATE_CONNECT_GAME") break; @@ -1327,7 +1327,7 @@ int Client::gameExec() _("Changing game servers"), STATE_SWITCH_CHARACTER); mCurrentDialog->postInit(); - Net::getGameHandler()->connect(); + gameHandler->connect(); BLOCK_END("Client::gameExec STATE_CHANGE_MAP") break; @@ -1519,8 +1519,8 @@ int Client::gameExec() logger->log1("State: SWITCH SERVER"); Net::getLoginHandler()->disconnect(); - Net::getGameHandler()->disconnect(); - Net::getGameHandler()->clear(); + gameHandler->disconnect(); + gameHandler->clear(); settings.serverName.clear(); serverConfig.write(); serverConfig.unload(); @@ -1537,7 +1537,7 @@ int Client::gameExec() Net::getLoginHandler()->logout(); Net::getLoginHandler()->disconnect(); - Net::getGameHandler()->disconnect(); + gameHandler->disconnect(); Net::getLoginHandler()->connect(); mState = STATE_LOGIN; @@ -1549,7 +1549,7 @@ int Client::gameExec() logger->log1("State: SWITCH CHARACTER"); // Done with game - Net::getGameHandler()->disconnect(); + gameHandler->disconnect(); mState = STATE_GET_CHARACTERS; BLOCK_END("Client::gameExec STATE_SWITCH_CHARACTER") @@ -1593,7 +1593,7 @@ int Client::gameExec() true); mCurrentDialog->addActionListener(&errorListener); mCurrentDialog = nullptr; // OkDialog deletes itself - Net::getGameHandler()->disconnect(); + gameHandler->disconnect(); BLOCK_END("Client::gameExec STATE_ERROR") break; diff --git a/src/game.cpp b/src/game.cpp index 025f4c6d1..b57b02f2c 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -150,7 +150,7 @@ static void initEngines() particleEngine->setupEngine(); BeingInfo::init(); - Net::getGameHandler()->initEngines(); + gameHandler->initEngines(); keyboard.update(); if (joystick) @@ -402,7 +402,7 @@ Game::Game() : if (actorManager) actorManager->setPlayer(localPlayer); - Net::getGameHandler()->ping(tick_time); + gameHandler->ping(tick_time); if (setupWindow) setupWindow->setInGame(true); @@ -619,7 +619,7 @@ void Game::slowLogic() PacketCounters::update(); // Handle network stuff - if (!Net::getGameHandler()->isConnected()) + if (!gameHandler->isConnected()) { if (client->getState() == STATE_CHANGE_MAP) return; // Not a problem here @@ -655,11 +655,11 @@ void Game::slowLogic() } else { - if (Net::getGameHandler()->mustPing() + if (gameHandler->mustPing() && get_elapsed_time1(mPing) > 3000) { mPing = tick_time; - Net::getGameHandler()->ping(tick_time); + gameHandler->ping(tick_time); } if (mAdjustPerfomance) @@ -1055,7 +1055,7 @@ void Game::changeMap(const std::string &mapPath) if (localPlayer) localPlayer->recreateItemParticles(); - Net::getGameHandler()->mapLoadedEvent(); + gameHandler->mapLoadedEvent(); BLOCK_END("Game::changeMap") } diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 618e8fb74..ba4aaf8c7 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -70,7 +70,7 @@ MiniStatusWindow::MiniStatusWindow() : mHpBar(createBar(0, 100, 0, Theme::HP_BAR, Theme::PROG_HP, "hpprogressbar.xml", "hpprogressbar_fill.xml", "hp bar", _("health bar"))), - mMpBar(Net::getGameHandler()->canUseMagicBar() + mMpBar(gameHandler->canUseMagicBar() ? createBar(0, 100, 0, Net::getPlayerHandler()->canUseMagic() ? Theme::MP_BAR : Theme::NO_MP_BAR, Net::getPlayerHandler()->canUseMagic() @@ -119,7 +119,7 @@ MiniStatusWindow::MiniStatusWindow() : StatusWindow::updateHPBar(mHpBar); - if (Net::getGameHandler()->canUseMagicBar() && statusWindow) + if (gameHandler->canUseMagicBar() && statusWindow) statusWindow->updateMPBar(mMpBar); const int job = Net::getPlayerHandler()->getJobLocation() diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp index 2f9cf51c5..f5481070a 100644 --- a/src/gui/windows/quitdialog.cpp +++ b/src/gui/windows/quitdialog.cpp @@ -183,7 +183,7 @@ void QuitDialog::action(const ActionEvent &event) client->setState(STATE_EXIT); } } - else if (Net::getGameHandler()->isConnected() + else if (gameHandler->isConnected() && mSwitchAccountServer->isSelected()) { DialogsManager::closeDialogs(); diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index a49545df3..08480cdd4 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -128,7 +128,7 @@ StatusWindow::StatusWindow() : mXpBar->setColor(getThemeColor(Theme::XP_BAR), getThemeColor(Theme::XP_BAR_OUTLINE)); - const bool magicBar = Net::getGameHandler()->canUseMagicBar(); + const bool magicBar = gameHandler->canUseMagicBar(); const int job = Net::getPlayerHandler()->getJobLocation() && serverConfig.getValueBool("showJob", true); diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index e1d6c5373..189acb05d 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -357,7 +357,7 @@ void CharServerHandler::processCharMapInfo(Net::MessageIn &restrict msg) ServerInfo &server = mapServer; BLOCK_START("CharServerHandler::processCharMapInfo") PlayerInfo::setCharId(msg.readInt32("char id")); - GameHandler *const gh = static_cast<GameHandler*>(Net::getGameHandler()); + GameHandler *const gh = static_cast<GameHandler*>(gameHandler); gh->setMap(msg.readString(16, "map name")); if (config.getBoolValue("usePersistentIP") || settings.persistentIp) { @@ -390,7 +390,7 @@ void CharServerHandler::processChangeMapServer(Net::MessageIn &msg) Network *const network = mNetwork; ServerInfo &server = mapServer; BLOCK_START("CharServerHandler::processChangeMapServer") - GameHandler *const gh = static_cast<GameHandler*>(Net::getGameHandler()); + GameHandler *const gh = static_cast<GameHandler*>(gameHandler); if (!gh || !network) { BLOCK_END("CharServerHandler::processChangeMapServer") diff --git a/src/net/familyhandler.h b/src/net/familyhandler.h index e6b7bb174..3f4bce683 100644 --- a/src/net/familyhandler.h +++ b/src/net/familyhandler.h @@ -43,4 +43,6 @@ class FamilyHandler notfinal } // namespace Net +extern Net::FamilyHandler *familyHandler; + #endif // NET_FAMILYHANDLER_H diff --git a/src/net/gamehandler.h b/src/net/gamehandler.h index 1752f7eea..94cb554c1 100644 --- a/src/net/gamehandler.h +++ b/src/net/gamehandler.h @@ -65,4 +65,6 @@ class GameHandler notfinal } // namespace Net +extern Net::GameHandler *gameHandler; + #endif // NET_GAMEHANDLER_H diff --git a/src/net/net.cpp b/src/net/net.cpp index aa89e39fe..cd97e921e 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -46,6 +46,8 @@ namespace Net class CashShopHandler; class CharServerHandler; class ChatHandler; + class FamilyHandler; + class GameHandler; } Net::AdminHandler *adminHandler = nullptr; @@ -71,11 +73,6 @@ Net::CashShopHandler *cashShopHandler = nullptr; Net::FamilyHandler *familyHandler = nullptr; Net::BankHandler *bankHandler = nullptr; -Net::GameHandler *Net::getGameHandler() -{ - return gameHandler; -} - Net::GeneralHandler *Net::getGeneralHandler() { return generalHandler; @@ -136,11 +133,6 @@ Net::MailHandler *Net::getMailHandler() return mailHandler; } -Net::FamilyHandler *Net::getFamilyHandler() -{ - return familyHandler; -} - namespace Net { diff --git a/src/net/net.h b/src/net/net.h index 11f605252..825a9894a 100644 --- a/src/net/net.h +++ b/src/net/net.h @@ -36,8 +36,6 @@ namespace Net { -class FamilyHandler; -class GameHandler; class GeneralHandler; class GuildHandler; class InventoryHandler; @@ -51,7 +49,6 @@ class SkillHandler; class TradeHandler; class ServerFeatures; -GameHandler *getGameHandler() A_WARN_UNUSED; GeneralHandler *getGeneralHandler() A_WARN_UNUSED; GuildHandler *getGuildHandler() A_WARN_UNUSED; InventoryHandler *getInventoryHandler() A_WARN_UNUSED; @@ -64,7 +61,6 @@ SkillHandler *getSkillHandler() A_WARN_UNUSED; TradeHandler *getTradeHandler() A_WARN_UNUSED; ServerFeatures *getServerFeatures() A_WARN_UNUSED; MailHandler *getMailHandler() A_WARN_UNUSED; -FamilyHandler *getFamilyHandler() A_WARN_UNUSED; ServerInfo::Type getNetworkType() A_WARN_UNUSED; diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index e23b6f08c..969353cc4 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -420,7 +420,7 @@ void CharServerHandler::processCharMapInfo(Net::MessageIn &restrict msg) ServerInfo &server = mapServer; BLOCK_START("CharServerHandler::processCharMapInfo") PlayerInfo::setCharId(msg.readInt32("char id?")); - GameHandler *const gh = static_cast<GameHandler*>(Net::getGameHandler()); + GameHandler *const gh = static_cast<GameHandler*>(gameHandler); gh->setMap(msg.readString(16, "map name")); if (config.getBoolValue("usePersistentIP") || settings.persistentIp) { @@ -453,7 +453,7 @@ void CharServerHandler::processChangeMapServer(Net::MessageIn &msg) Network *const network = mNetwork; ServerInfo &server = mapServer; BLOCK_START("CharServerHandler::processChangeMapServer") - GameHandler *const gh = static_cast<GameHandler*>(Net::getGameHandler()); + GameHandler *const gh = static_cast<GameHandler*>(gameHandler); if (!gh || !network) { BLOCK_END("CharServerHandler::processChangeMapServer") |