diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-03-23 18:37:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-03-23 18:37:20 +0300 |
commit | 95514a8b6c14ddc86d9b2dfe87d21534b949493d (patch) | |
tree | a88806b0a690f7227e7546509f61ed1144854754 /src/resources/map/map.cpp | |
parent | 37fd6d2434c63f02fb8e67e120fb285f41c6cca0 (diff) | |
download | plus-95514a8b6c14ddc86d9b2dfe87d21534b949493d.tar.gz plus-95514a8b6c14ddc86d9b2dfe87d21534b949493d.tar.bz2 plus-95514a8b6c14ddc86d9b2dfe87d21534b949493d.tar.xz plus-95514a8b6c14ddc86d9b2dfe87d21534b949493d.zip |
Fix memory leak in map animations.
Diffstat (limited to 'src/resources/map/map.cpp')
-rw-r--r-- | src/resources/map/map.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index 84f1d1049..18e3dc7f5 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -1487,3 +1487,14 @@ void Map::setMusicFile(const std::string &file) { setProperty("music", file); } + +void Map::addAnimation(const int gid, TileAnimation *const animation) +{ + std::map<int, TileAnimation*>::iterator it = mTileAnimations.find(gid); + if (it != mTileAnimations.end()) + { + logger->log("duplicate map animation with gid = %d", gid); + delete (*it).second; + } + mTileAnimations[gid] = animation; +} |