Codechange: Use EnumBitSet for Airport blocks.
This commit is contained in:
committed by
Peter Nelson
parent
9049710051
commit
f309b90a1d
@@ -761,10 +761,10 @@ static const OldChunks station_chunk[] = {
|
||||
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_TTO | OC_FILE_U16 | OC_VAR_U64, Station, airport.blocks ),
|
||||
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.blocks ),
|
||||
OCL_CNULL( OC_TTD, 2 ), ///< last_vehicle. now last_vehicle_type
|
||||
OCL_CNULL( OC_TTD, 4 ), ///< junk at end of chunk
|
||||
|
||||
@@ -788,9 +788,9 @@ static bool LoadOldStation(LoadgameState *ls, int num)
|
||||
st->string_id = _old_string_id + 0x2800; // custom name
|
||||
}
|
||||
|
||||
if (HasBit(st->airport.flags, 8)) {
|
||||
if (st->airport.blocks.Test(AirportBlock{8})) {
|
||||
st->airport.type = 1; // large airport
|
||||
} else if (HasBit(st->airport.flags, 6)) {
|
||||
} else if (st->airport.blocks.Test(AirportBlock{6})) {
|
||||
st->airport.type = 3; // oil rig
|
||||
} else {
|
||||
st->airport.type = 0; // small airport
|
||||
|
||||
@@ -477,9 +477,9 @@ static const SaveLoad _old_station_desc[] = {
|
||||
SLE_VAR(Station, owner, SLE_UINT8),
|
||||
SLE_VAR(Station, facilities, SLE_UINT8),
|
||||
SLE_VAR(Station, airport.type, SLE_UINT8),
|
||||
SLE_CONDVAR(Station, airport.flags, SLE_VAR_U64 | SLE_FILE_U16, SL_MIN_VERSION, SLV_3),
|
||||
SLE_CONDVAR(Station, airport.flags, SLE_VAR_U64 | SLE_FILE_U32, SLV_3, SLV_46),
|
||||
SLE_CONDVAR(Station, airport.flags, SLE_UINT64, SLV_46, SL_MAX_VERSION),
|
||||
SLE_CONDVARNAME(Station, airport.blocks, "airport.flags", SLE_VAR_U64 | SLE_FILE_U16, SL_MIN_VERSION, SLV_3),
|
||||
SLE_CONDVARNAME(Station, airport.blocks, "airport.flags", SLE_VAR_U64 | SLE_FILE_U32, SLV_3, SLV_46),
|
||||
SLE_CONDVARNAME(Station, airport.blocks, "airport.flags", SLE_UINT64, SLV_46, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Station, last_vehicle_type, SLE_UINT8, SLV_26, SL_MAX_VERSION),
|
||||
|
||||
@@ -608,7 +608,7 @@ public:
|
||||
SLE_CONDVAR(Station, airport.h, SLE_FILE_U8 | SLE_VAR_U16, SLV_140, SL_MAX_VERSION),
|
||||
SLE_VAR(Station, airport.type, SLE_UINT8),
|
||||
SLE_CONDVAR(Station, airport.layout, SLE_UINT8, SLV_145, SL_MAX_VERSION),
|
||||
SLE_VAR(Station, airport.flags, SLE_UINT64),
|
||||
SLE_VARNAME(Station, airport.blocks, "airport.flags", SLE_UINT64),
|
||||
SLE_CONDVAR(Station, airport.rotation, SLE_UINT8, SLV_145, SL_MAX_VERSION),
|
||||
SLEG_CONDARR("storage", _old_st_persistent_storage.storage, SLE_UINT32, 16, SLV_145, SLV_161),
|
||||
SLE_CONDREF(Station, airport.psa, REF_STORAGE, SLV_161, SL_MAX_VERSION),
|
||||
|
||||
@@ -166,7 +166,7 @@ void UpdateOldAircraft()
|
||||
{
|
||||
/* set airport_flags to 0 for all airports just to be sure */
|
||||
for (Station *st : Station::Iterate()) {
|
||||
st->airport.flags = 0; // reset airport
|
||||
st->airport.blocks = {}; // reset airport
|
||||
}
|
||||
|
||||
for (Aircraft *a : Aircraft::Iterate()) {
|
||||
|
||||
Reference in New Issue
Block a user