diff options
author | rubidium <rubidium@openttd.org> | 2009-07-01 14:51:05 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-01 14:51:05 +0000 |
commit | 927c4a0fe8b836fe88ca0636d2249016501dc9c3 (patch) | |
tree | 076df478323806636b50630f76dd7415abc0e504 /src/saveload | |
parent | 8db99f57f87776dd86b7b3d12b9150363dd8d688 (diff) | |
download | openttd-927c4a0fe8b836fe88ca0636d2249016501dc9c3.tar.xz |
(svn r16709) -Fix [FS#2994]: the list of animated tiles could have duplicates (only for old savegames) and tiles that weren't animated
Diffstat (limited to 'src/saveload')
-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); |