summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-01-24 20:25:28 +0000
committeryexo <yexo@openttd.org>2010-01-24 20:25:28 +0000
commit388c713f08092ed3ddf9eefa0122d9bea65450a5 (patch)
treee2dbf4ced0d2b4209fb48bf34725e8d2d14e48af /src/saveload
parent6ff482f515a831ec8d2f7cff258a56588c7c4d36 (diff)
downloadopenttd-388c713f08092ed3ddf9eefa0122d9bea65450a5.tar.xz
(svn r18912) -Codechange: free up a bunch of airporttile ids by using the tile animation frame
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp37
-rw-r--r--src/saveload/saveload.cpp2
2 files changed, 38 insertions, 1 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 72c0635d0..dfb379c11 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2026,6 +2026,43 @@ bool AfterLoadGame()
}
}
+ /* Airport tile animation uses animation frame instead of other graphics id */
+ if (CheckSavegameVersion(137)) {
+ struct AirportTileConversion {
+ byte old_start;
+ byte num_frames;
+ };
+ static const AirportTileConversion atc[] = {
+ {31, 12}, // APT_RADAR_GRASS_FENCE_SW
+ {50, 4}, // APT_GRASS_FENCE_NE_FLAG
+ {62, 2}, // 1 unused tile
+ {66, 12}, // APT_RADAR_FENCE_SW
+ {78, 12}, // APT_RADAR_FENCE_NE
+ {101, 10}, // 9 unused tiles
+ {111, 8}, // 7 unused tiles
+ {119, 15}, // 14 unused tiles (radar)
+ {140, 4}, // APT_GRASS_FENCE_NE_FLAG_2
+ };
+ for (TileIndex t = 0; t < map_size; t++) {
+ if (IsAirportTile(t)) {
+ StationGfx old_gfx = GetStationGfx(t);
+ byte offset = 0;
+ for (uint i = 0; i < lengthof(atc); i++) {
+ if (old_gfx < atc[i].old_start) {
+ SetStationGfx(t, old_gfx - offset);
+ break;
+ }
+ if (old_gfx < atc[i].old_start + atc[i].num_frames) {
+ SetStationAnimationFrame(t, old_gfx - atc[i].old_start);
+ SetStationGfx(t, atc[i].old_start - offset);
+ break;
+ }
+ offset += atc[i].num_frames - 1;
+ }
+ }
+ }
+ }
+
/* Road stops is 'only' updating some caches */
AfterLoadRoadStops();
AfterLoadLabelMaps();
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 30a706ac7..36759196e 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -46,7 +46,7 @@
#include "saveload_internal.h"
-extern const uint16 SAVEGAME_VERSION = 136;
+extern const uint16 SAVEGAME_VERSION = 137;
SavegameType _savegame_type; ///< type of savegame we are loading