summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2009-01-25 03:36:13 +0100
committerPhilipp Sehmisch <crush@themanaworld.org>2009-01-25 03:36:13 +0100
commit7e928fc6559e89b64f49aea30d796dbfe75c4912 (patch)
tree6099e8e7f85b80bbda957e2a3b83c63441236717 /src/map.cpp
parente64ed1af4896127a2a1d0989c624e4b7e327dd5f (diff)
downloadmana-client-7e928fc6559e89b64f49aea30d796dbfe75c4912.tar.gz
mana-client-7e928fc6559e89b64f49aea30d796dbfe75c4912.tar.bz2
mana-client-7e928fc6559e89b64f49aea30d796dbfe75c4912.tar.xz
mana-client-7e928fc6559e89b64f49aea30d796dbfe75c4912.zip
Fixed performance hickups caused by animations due to buggy tick timer. A tad less performant than the intended solution but at least it is constantly so.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 2ee6c35e..f0c84159 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -64,7 +64,6 @@ struct Location
TileAnimation::TileAnimation(Animation *ani):
mAnimation(ani),
- mLastUpdate(tick_time),
mLastImage(NULL)
{
}
@@ -72,8 +71,7 @@ TileAnimation::TileAnimation(Animation *ani):
void TileAnimation::update()
{
//update animation
- mAnimation.update(tick_time - mLastUpdate);
- mLastUpdate = tick_time;
+ mAnimation.update(1);
// exchange images
Image *img = mAnimation.getCurrentImage();
@@ -230,6 +228,17 @@ bool spriteCompare(const Sprite *a, const Sprite *b)
return a->getPixelY() < b->getPixelY();
}
+void Map::update()
+{
+ //update animated tiles
+ for (std::map<int, TileAnimation*>::iterator iAni = mTileAnimations.begin();
+ iAni != mTileAnimations.end();
+ iAni++)
+ {
+ iAni->second->update();
+ }
+}
+
void Map::draw(Graphics *graphics, int scrollX, int scrollY)
{
int endPixelY = graphics->getHeight() + scrollY + mTileHeight - 1;
@@ -245,14 +254,6 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
// Make sure sprites are sorted
mSprites.sort(spriteCompare);
- //update animated tiles
- for (std::map<int, TileAnimation*>::iterator iAni = mTileAnimations.begin();
- iAni != mTileAnimations.end();
- iAni++)
- {
- iAni->second->update();
- }
-
// draw the game world
Layers::const_iterator layeri = mLayers.begin();
for (; layeri != mLayers.end(); ++layeri) {