(svn r19455) -Codechange: split all airport information in Station to a seperate class

This commit is contained in:
yexo
2010-03-18 21:02:20 +00:00
parent 6b67d9042c
commit 22a27d3b62
23 changed files with 100 additions and 97 deletions

View File

@@ -594,8 +594,8 @@ bool AfterLoadGame()
if (CheckSavegameVersion(139)) {
Station *st;
FOR_ALL_STATIONS(st) {
if (st->airport.tile != INVALID_TILE && st->airport_type == 15) {
st->airport_type = AT_OILRIG;
if (st->airport.tile != INVALID_TILE && st->airport.type == 15) {
st->airport.type = AT_OILRIG;
}
}
}
@@ -734,7 +734,7 @@ bool AfterLoadGame()
* It was 3 (till 2.2) and later 5 (till 5.1).
* Setting it unconditionally does not hurt.
*/
Station::GetByTile(t)->airport_type = AT_OILRIG;
Station::GetByTile(t)->airport.type = AT_OILRIG;
} else {
DeleteOilRig(t);
}
@@ -2095,8 +2095,8 @@ bool AfterLoadGame()
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;
st->airport.w = st->airport.GetSpec()->size_x;
st->airport.h = st->airport.GetSpec()->size_y;
}
}
}

View File

@@ -732,11 +732,11 @@ static const OldChunks station_chunk[] = {
OCL_SVAR( OC_UINT8, Station, delete_ctr ),
OCL_SVAR( OC_UINT8, Station, owner ),
OCL_SVAR( OC_UINT8, Station, facilities ),
OCL_SVAR( OC_TTD | OC_UINT8, Station, airport_type ),
OCL_SVAR( OC_TTO | OC_FILE_U16 | OC_VAR_U64, Station, airport_flags ),
OCL_SVAR( OC_TTD | OC_UINT8, Station, airport.type ),
OCL_SVAR( OC_TTO | OC_FILE_U16 | OC_VAR_U64, Station, airport.flags ),
OCL_NULL( 3 ), ///< bus/truck status, blocked months, no longer in use
OCL_CNULL( OC_TTD, 1 ), ///< unknown
OCL_SVAR( OC_TTD | OC_FILE_U16 | OC_VAR_U64, Station, airport_flags ),
OCL_SVAR( OC_TTD | OC_FILE_U16 | OC_VAR_U64, Station, airport.flags ),
OCL_CNULL( OC_TTD, 2 ), ///< last_vehicle. now last_vehicle_type
OCL_CNULL( OC_TTD, 4 ), ///< junk at end of chunk
@@ -760,12 +760,12 @@ static bool LoadOldStation(LoadgameState *ls, int num)
st->string_id = _old_string_id + 0x2800; // custom name
}
if (HasBit(st->airport_flags, 8)) {
st->airport_type = 1; // large airport
} else if (HasBit(st->airport_flags, 6)) {
st->airport_type = 3; // oil rig
if (HasBit(st->airport.flags, 8)) {
st->airport.type = 1; // large airport
} else if (HasBit(st->airport.flags, 6)) {
st->airport.type = 3; // oil rig
} else {
st->airport_type = 0; // small airport
st->airport.type = 0; // small airport
}
} else {
st->string_id = RemapOldStringID(_old_string_id);

View File

@@ -172,14 +172,14 @@ static const SaveLoad _old_station_desc[] = {
SLE_VAR(Station, delete_ctr, SLE_UINT8),
SLE_VAR(Station, owner, SLE_UINT8),
SLE_VAR(Station, facilities, SLE_UINT8),
SLE_VAR(Station, airport_type, SLE_UINT8),
SLE_VAR(Station, airport.type, SLE_UINT8),
SLE_CONDNULL(2, 0, 5), ///< Truck/bus stop status
SLE_CONDNULL(1, 0, 4), ///< Blocked months
SLE_CONDVAR(Station, airport_flags, SLE_VAR_U64 | SLE_FILE_U16, 0, 2),
SLE_CONDVAR(Station, airport_flags, SLE_VAR_U64 | SLE_FILE_U32, 3, 45),
SLE_CONDVAR(Station, airport_flags, SLE_UINT64, 46, SL_MAX_VERSION),
SLE_CONDVAR(Station, airport.flags, SLE_VAR_U64 | SLE_FILE_U16, 0, 2),
SLE_CONDVAR(Station, airport.flags, SLE_VAR_U64 | SLE_FILE_U32, 3, 45),
SLE_CONDVAR(Station, airport.flags, SLE_UINT64, 46, SL_MAX_VERSION),
SLE_CONDNULL(2, 0, 25), ///< last-vehicle
SLE_CONDVAR(Station, last_vehicle_type, SLE_UINT8, 26, SL_MAX_VERSION),
@@ -334,8 +334,8 @@ static const SaveLoad _station_desc[] = {
SLE_VAR(Station, airport.tile, SLE_UINT32),
SLE_CONDVAR(Station, airport.w, SLE_FILE_U8 | SLE_VAR_U16, 140, SL_MAX_VERSION),
SLE_CONDVAR(Station, airport.h, SLE_FILE_U8 | SLE_VAR_U16, 140, SL_MAX_VERSION),
SLE_VAR(Station, airport_type, SLE_UINT8),
SLE_VAR(Station, airport_flags, SLE_UINT64),
SLE_VAR(Station, airport.type, SLE_UINT8),
SLE_VAR(Station, airport.flags, SLE_UINT64),
SLE_VAR(Station, indtype, SLE_UINT8),

View File

@@ -165,7 +165,7 @@ void UpdateOldAircraft()
/* set airport_flags to 0 for all airports just to be sure */
Station *st;
FOR_ALL_STATIONS(st) {
st->airport_flags = 0; // reset airport
st->airport.flags = 0; // reset airport
}
Aircraft *a;