(svn r19198) -Codechange: store the size of stations in savegames

This commit is contained in:
yexo
2010-02-22 14:17:07 +00:00
parent 391b759d04
commit 80982cc91b
12 changed files with 60 additions and 56 deletions

View File

@@ -525,7 +525,7 @@ bool AfterLoadGame()
/* no station is determined by 'tile == INVALID_TILE' now (instead of '0') */
Station *st;
FOR_ALL_STATIONS(st) {
if (st->airport_tile == 0) st->airport_tile = INVALID_TILE;
if (st->airport.tile == 0) st->airport.tile = INVALID_TILE;
if (st->dock_tile == 0) st->dock_tile = INVALID_TILE;
if (st->train_station.tile == 0) st->train_station.tile = INVALID_TILE;
}
@@ -2063,6 +2063,16 @@ bool AfterLoadGame()
}
}
if (CheckSavegameVersion(139)) {
Station *st;
FOR_ALL_STATIONS(st) {
if (st->airport.tile != INVALID_TILE) {
st->airport.w = st->GetAirportSpec()->size_x;
st->airport.h = st->GetAirportSpec()->size_y;
}
}
}
/* Road stops is 'only' updating some caches */
AfterLoadRoadStops();
AfterLoadLabelMaps();

View File

@@ -712,7 +712,7 @@ static const OldChunks station_chunk[] = {
OCL_NULL( 4 ), ///< bus/lorry tile
OCL_SVAR( OC_TILE, Station, train_station.tile ),
OCL_SVAR( OC_TILE, Station, airport_tile ),
OCL_SVAR( OC_TILE, Station, airport.tile ),
OCL_SVAR( OC_TILE, Station, dock_tile ),
OCL_SVAR( OC_UINT8, Station, train_station.w ),

View File

@@ -151,8 +151,10 @@ static const SaveLoad _old_station_desc[] = {
SLE_CONDNULL(4, 0, 5), ///< bus/lorry tile
SLE_CONDVAR(Station, train_station.tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
SLE_CONDVAR(Station, train_station.tile, SLE_UINT32, 6, SL_MAX_VERSION),
SLE_CONDVAR(Station, airport_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
SLE_CONDVAR(Station, airport_tile, SLE_UINT32, 6, SL_MAX_VERSION),
SLE_CONDVAR(Station, airport.tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
SLE_CONDVAR(Station, airport.tile, SLE_UINT32, 6, SL_MAX_VERSION),
SLE_CONDVAR(Station, airport.w, SLE_UINT8, 139, SL_MAX_VERSION),
SLE_CONDVAR(Station, airport.h, SLE_UINT8, 139, SL_MAX_VERSION),
SLE_CONDVAR(Station, dock_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
SLE_CONDVAR(Station, dock_tile, SLE_UINT32, 6, SL_MAX_VERSION),
SLE_REF(Station, town, REF_TOWN),
@@ -331,7 +333,7 @@ static const SaveLoad _station_desc[] = {
SLE_REF(Station, bus_stops, REF_ROADSTOPS),
SLE_REF(Station, truck_stops, REF_ROADSTOPS),
SLE_VAR(Station, dock_tile, SLE_UINT32),
SLE_VAR(Station, airport_tile, SLE_UINT32),
SLE_VAR(Station, airport.tile, SLE_UINT32),
SLE_VAR(Station, airport_type, SLE_UINT8),
SLE_VAR(Station, airport_flags, SLE_UINT64),