diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 7 | ||||
-rw-r--r-- | src/client.h | 2 | ||||
-rw-r--r-- | src/compoundsprite.cpp | 8 | ||||
-rw-r--r-- | src/compoundsprite.h | 1 |
4 files changed, 17 insertions, 1 deletions
diff --git a/src/client.cpp b/src/client.cpp index f9398281f..bdb43d0b9 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -225,6 +225,13 @@ int get_elapsed_time(int startTime) } } +int get_elapsed_time1(int startTime) +{ + if (startTime <= tick_time) + return tick_time - startTime; + else + return tick_time + (MAX_TICK_VALUE - startTime); +} // This anonymous namespace hides whatever is inside from other modules. namespace diff --git a/src/client.h b/src/client.h index c6780dfd6..32197da8f 100644 --- a/src/client.h +++ b/src/client.h @@ -76,6 +76,8 @@ extern LoginData loginData; */ int get_elapsed_time(int startTime); +int get_elapsed_time1(int startTime); + /** * All client states. */ diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp index fe6e6ba2a..09ac4b390 100644 --- a/src/compoundsprite.cpp +++ b/src/compoundsprite.cpp @@ -30,6 +30,7 @@ #include "opengl1graphics.h" #endif +#include "client.h" #include "map.h" #include "resources/image.h" @@ -57,7 +58,8 @@ CompoundSprite::CompoundSprite() : mNeedsRedraw(false), mEnableAlphaFix(config.getBoolValue("enableAlphaFix")), mDisableAdvBeingCaching(config.getBoolValue("disableAdvBeingCaching")), - mDisableBeingCaching(config.getBoolValue("disableBeingCaching")) + mDisableBeingCaching(config.getBoolValue("disableBeingCaching")), + mNextRedrawTime(0) { mAlpha = 1.0f; } @@ -440,6 +442,10 @@ void CompoundSprite::updateImages() const return; #endif + if (get_elapsed_time1(mNextRedrawTime) < 10) + return; + + mNextRedrawTime = tick_time; mNeedsRedraw = false; if (!mDisableBeingCaching) diff --git a/src/compoundsprite.h b/src/compoundsprite.h index 1b9eeca34..aa90816c5 100644 --- a/src/compoundsprite.h +++ b/src/compoundsprite.h @@ -145,6 +145,7 @@ private: bool mDisableAdvBeingCaching; bool mDisableBeingCaching; std::vector<Sprite*> mSprites; + mutable int mNextRedrawTime; }; #endif // COMPOUNDSPRITE_H |