Codechange: Use EnumBitSet for StationFacility.
This commit is contained in:
committed by
Peter Nelson
parent
8d38308ebb
commit
75387b9e2b
@@ -3062,19 +3062,19 @@ bool CanVehicleUseStation(EngineID engine_type, const Station *st)
|
||||
|
||||
switch (e->type) {
|
||||
case VEH_TRAIN:
|
||||
return (st->facilities & FACIL_TRAIN) != 0;
|
||||
return st->facilities.Test(StationFacility::Train);
|
||||
|
||||
case VEH_ROAD:
|
||||
/* For road vehicles we need the vehicle to know whether it can actually
|
||||
* use the station, but if it doesn't have facilities for RVs it is
|
||||
* certainly not possible that the station can be used. */
|
||||
return (st->facilities & (FACIL_BUS_STOP | FACIL_TRUCK_STOP)) != 0;
|
||||
return st->facilities.Any({StationFacility::BusStop, StationFacility::TruckStop});
|
||||
|
||||
case VEH_SHIP:
|
||||
return (st->facilities & FACIL_DOCK) != 0;
|
||||
return st->facilities.Test(StationFacility::Dock);
|
||||
|
||||
case VEH_AIRCRAFT:
|
||||
return (st->facilities & FACIL_AIRPORT) != 0 &&
|
||||
return st->facilities.Test(StationFacility::Airport) &&
|
||||
st->airport.GetFTA()->flags.Test(e->u.air.subtype & AIR_CTOL ? AirportFTAClass::Flag::Airplanes : AirportFTAClass::Flag::Helicopters);
|
||||
|
||||
default:
|
||||
@@ -3135,7 +3135,7 @@ StringID GetVehicleCannotUseStationReason(const Vehicle *v, const Station *st)
|
||||
return STR_ERROR_NO_DOCK;
|
||||
|
||||
case VEH_AIRCRAFT:
|
||||
if ((st->facilities & FACIL_AIRPORT) == 0) return STR_ERROR_NO_AIRPORT;
|
||||
if (!st->facilities.Test(StationFacility::Airport)) return STR_ERROR_NO_AIRPORT;
|
||||
if (v->GetEngine()->u.air.subtype & AIR_CTOL) {
|
||||
return STR_ERROR_AIRPORT_NO_PLANES;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user