(svn r16947) -Codechange: use TileArea instead of train_tile, trainst_w and trainst_h.

This commit is contained in:
rubidium
2009-07-25 08:54:19 +00:00
parent 8dd249469a
commit 58563eafa7
13 changed files with 109 additions and 126 deletions

View File

@@ -387,17 +387,17 @@ bool AfterLoadGame()
if (CheckSavegameVersion(2)) {
Station *st;
FOR_ALL_STATIONS(st) {
if (st->train_tile != 0 && st->trainst_h == 0) {
if (st->train_station.tile != 0 && st->train_station.h == 0) {
uint n = _savegame_type == SGT_OTTD ? 4 : 3; // OTTD uses 4 bits per dimensions, TTD 3 bits
uint w = GB(st->trainst_w, n, n);
uint h = GB(st->trainst_w, 0, n);
uint w = GB(st->train_station.w, n, n);
uint h = GB(st->train_station.w, 0, n);
if (GetRailStationAxis(st->train_tile) != AXIS_X) Swap(w, h);
if (GetRailStationAxis(st->train_station.tile) != AXIS_X) Swap(w, h);
st->trainst_w = w;
st->trainst_h = h;
st->train_station.w = w;
st->train_station.h = h;
assert(GetStationIndex(st->train_tile + TileDiffXY(w - 1, h - 1)) == st->index);
assert(GetStationIndex(st->train_station.tile + TileDiffXY(w - 1, h - 1)) == st->index);
}
}
}
@@ -452,9 +452,9 @@ 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->dock_tile == 0) st->dock_tile = INVALID_TILE;
if (st->train_tile == 0) st->train_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;
}
/* the same applies to Company::location_of_HQ */

View File

@@ -772,10 +772,10 @@ static const OldChunks station_chunk[] = {
OCL_VAR ( OC_UINT32, 1, &_old_town_index ),
OCL_NULL( 4 ), ///< bus/lorry tile
OCL_SVAR( OC_TILE, Station, train_tile ),
OCL_SVAR( OC_TILE, Station, train_station.tile ),
OCL_SVAR( OC_TILE, Station, airport_tile ),
OCL_SVAR( OC_TILE, Station, dock_tile ),
OCL_SVAR( OC_UINT8, Station, trainst_w ),
OCL_SVAR( OC_UINT8, Station, train_station.w ),
OCL_NULL( 1 ), ///< sort-index, no longer in use
OCL_NULL( 2 ), ///< sign-width, no longer in use

View File

@@ -123,15 +123,15 @@ static const SaveLoad _old_station_desc[] = {
SLE_CONDVAR(Station, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
SLE_CONDVAR(Station, xy, SLE_UINT32, 6, SL_MAX_VERSION),
SLE_CONDNULL(4, 0, 5), ///< bus/lorry tile
SLE_CONDVAR(Station, train_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
SLE_CONDVAR(Station, train_tile, SLE_UINT32, 6, SL_MAX_VERSION),
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, 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),
SLE_VAR(Station, trainst_w, SLE_UINT8),
SLE_CONDVAR(Station, trainst_h, SLE_UINT8, 2, SL_MAX_VERSION),
SLE_VAR(Station, train_station.w, SLE_UINT8),
SLE_CONDVAR(Station, train_station.h, SLE_UINT8, 2, SL_MAX_VERSION),
SLE_CONDNULL(1, 0, 3), ///< alpha_order
@@ -299,9 +299,9 @@ static const SaveLoad _station_desc[] = {
SLE_WRITEBYTE(Station, facilities, FACIL_NONE),
SLE_ST_INCLUDE(),
SLE_VAR(Station, train_tile, SLE_UINT32),
SLE_VAR(Station, trainst_w, SLE_UINT8),
SLE_VAR(Station, trainst_h, SLE_UINT8),
SLE_VAR(Station, train_station.tile, SLE_UINT32),
SLE_VAR(Station, train_station.w, SLE_UINT8),
SLE_VAR(Station, train_station.h, SLE_UINT8),
SLE_REF(Station, bus_stops, REF_ROADSTOPS),
SLE_REF(Station, truck_stops, REF_ROADSTOPS),