diff options
Diffstat (limited to 'src/saveload/afterload.cpp')
-rw-r--r-- | src/saveload/afterload.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 26ca23b22..afe2060a7 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -30,6 +30,7 @@ #include "../ai/ai.hpp" #include "../town.h" #include "../economy_base.h" +#include "../animated_tile_func.h" #include "table/strings.h" @@ -1890,6 +1891,30 @@ bool AfterLoadGame() } } + if (CheckSavegameVersion(122)) { + /* Animated tiles would sometimes not be actually animated or + * in case of old savegames duplicate. */ + + extern TileIndex *_animated_tile_list; + extern uint _animated_tile_count; + + for (uint i = 0; i < _animated_tile_count; /* Nothing */) { + /* Remove if tile is not animated */ + bool remove = _tile_type_procs[GetTileType(_animated_tile_list[i])]->animate_tile_proc == NULL; + + /* and remove if duplicate */ + for (uint j = 0; !remove && j < i; j++) { + remove = _animated_tile_list[i] == _animated_tile_list[j]; + } + + if (remove) { + DeleteAnimatedTile(_animated_tile_list[i]); + } else { + i++; + } + } + } + AfterLoadLabelMaps(); GamelogPrintDebug(1); |