diff options
author | yexo <yexo@openttd.org> | 2010-01-24 20:25:28 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-01-24 20:25:28 +0000 |
commit | 388c713f08092ed3ddf9eefa0122d9bea65450a5 (patch) | |
tree | e2dbf4ced0d2b4209fb48bf34725e8d2d14e48af /src/saveload/afterload.cpp | |
parent | 6ff482f515a831ec8d2f7cff258a56588c7c4d36 (diff) | |
download | openttd-388c713f08092ed3ddf9eefa0122d9bea65450a5.tar.xz |
(svn r18912) -Codechange: free up a bunch of airporttile ids by using the tile animation frame
Diffstat (limited to 'src/saveload/afterload.cpp')
-rw-r--r-- | src/saveload/afterload.cpp | 37 |
1 files changed, 37 insertions, 0 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(); |