From efa3bc8c346aea723b8b02ea1f27d7d3e41ff134 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 8 Apr 2013 00:56:59 +0300 Subject: Improve perfomance in kills window. --- src/gui/killstats.cpp | 10 +++++++++- src/gui/killstats.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index d45e6a4bb..c1a858a79 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -88,7 +88,8 @@ KillStats::KillStats(): mJackoId(0), mIsJackoAlive(false), mIsJackoMustSpawn(true), - mIsJackoSpawnTimeUnknown(true) + mIsJackoSpawnTimeUnknown(true), + mUpdateTime(cur_time + 1) { setWindowName("Kill stats"); setCloseButton(true); @@ -302,6 +303,13 @@ void KillStats::recalcStats() 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 90191138b..69342721e 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -131,6 +131,7 @@ class KillStats final : public Window, bool mIsJackoAlive; bool mIsJackoMustSpawn; bool mIsJackoSpawnTimeUnknown; + int mUpdateTime; }; extern KillStats *killStats; -- cgit v1.2.3-70-g09d2