From f1db2118bec94c32ebda6a281dc956ba1a480163 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 9 Apr 2013 20:19:51 +0300 Subject: Improve slow login update speed. --- src/game.cpp | 34 ++++++++++++++++++++-------------- src/game.h | 1 + src/gui/killstats.cpp | 9 +-------- src/gui/killstats.h | 1 - 4 files changed, 22 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/game.cpp b/src/game.cpp index 0fc4c36b1..465911767 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -385,7 +385,8 @@ Game::Game(): mAdjustPerfomance(config.getBoolValue("adjustPerfomance")), mLowerCounter(0), mPing(0), - mLogInput(config.getBoolValue("logInput")) + mLogInput(config.getBoolValue("logInput")), + mTime(cur_time + 1) { touchManager.setInGame(true); spellManager = new SpellManager; @@ -571,20 +572,25 @@ void Game::slowLogic() BLOCK_START("Game::slowLogic") if (player_node) player_node->slowLogic(); - if (botCheckerWindow) - botCheckerWindow->slowLogic(); - if (debugWindow) - debugWindow->slowLogic(); - if (killStats) - killStats->update(); - if (socialWindow) - socialWindow->slowLogic(); - if (whoIsOnline) - whoIsOnline->slowLogic(); + const int time = cur_time; + if (mTime <= time) + { + mTime = time + 1; + if (botCheckerWindow) + botCheckerWindow->slowLogic(); + if (debugWindow) + debugWindow->slowLogic(); + if (killStats) + killStats->update(); + if (socialWindow) + socialWindow->slowLogic(); + if (whoIsOnline) + whoIsOnline->slowLogic(); + Being::reReadConfig(); + if (killStats) + killStats->recalcStats(); + } - Being::reReadConfig(); - if (killStats) - killStats->recalcStats(); if (shopWindow) shopWindow->updateTimes(); if (mainGraphics->getOpenGL()) diff --git a/src/game.h b/src/game.h index a78c740a4..c40c202d3 100644 --- a/src/game.h +++ b/src/game.h @@ -140,6 +140,7 @@ class Game final int mLowerCounter; int mPing; bool mLogInput; + int mTime; static Game *mInstance; }; diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index c1a858a79..f77c9a8f4 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -88,8 +88,7 @@ KillStats::KillStats(): mJackoId(0), mIsJackoAlive(false), mIsJackoMustSpawn(true), - mIsJackoSpawnTimeUnknown(true), - mUpdateTime(cur_time + 1) + mIsJackoSpawnTimeUnknown(true) { setWindowName("Kill stats"); setCloseButton(true); @@ -304,12 +303,6 @@ void KillStats::update() { BLOCK_START("KillStats::update") - const int time = cur_time; - if (mUpdateTime > time) - return; - - mUpdateTime = time + 1; - mExpSpeed1Label->setCaption(strprintf(ngettext("Exp speed per %d min: %s", "Exp speed per %d min: %s", 1), 1, toString(m1minSpeed).c_str())); diff --git a/src/gui/killstats.h b/src/gui/killstats.h index 69342721e..90191138b 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -131,7 +131,6 @@ class KillStats final : public Window, bool mIsJackoAlive; bool mIsJackoMustSpawn; bool mIsJackoSpawnTimeUnknown; - int mUpdateTime; }; extern KillStats *killStats; -- cgit v1.2.3-60-g2f50