diff options
author | tron <tron@openttd.org> | 2007-01-31 06:25:46 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2007-01-31 06:25:46 +0000 |
commit | fe1691acce220f6d55a7bcad077020cfbec4bfb5 (patch) | |
tree | 0bec7750e40db1990ca2913e337fdb46579835f2 /src/openttd.cpp | |
parent | 6e20c73c336b057e3eb95baf9cb7c3504aec2597 (diff) | |
download | openttd-fe1691acce220f6d55a7bcad077020cfbec4bfb5.tar.xz |
(svn r8477) -Fix
-Codechange: Remove the unnecessary attributes Station::{bus,lorry}_tile_obsolete by replacing them with a scan of the map for existing road stops when loading old savegames
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index 1f0b6af62..cba18f730 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1282,6 +1282,22 @@ bool AfterLoadGame(void) // In 5.1, Oilrigs have been moved (again) if (CheckSavegameVersionOldStyle(5, 1)) UpdateOilRig(); + /* From this version on there can be multiple road stops of the same type per + * station. Convert the existing stops to the new internal data structure. + */ + if (CheckSavegameVersion(6)) { + for (TileIndex t = 0; t < map_size; t++) { + if (IsRoadStopTile(t)) { + RoadStop *rs = new RoadStop(t); + if (rs == NULL) error("Too many road stops in savegame"); + + Station *st = GetStationByTile(t); + RoadStop **head = IsTruckStop(t) ? &st->truck_stops : &st->bus_stops; + *head = rs; + } + } + } + /* In version 6.1 we put the town index in the map-array. To do this, we need * to use m2 (16bit big), so we need to clean m2, and that is where this is * all about ;) */ |