mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
(svn r22327) -Add: Vehicle::GetGroundVehicleFlags() for accessing GroundVehicle<>::gv_flags through a Vehicle struct.
This commit is contained in:
parent
5429d70496
commit
a296ccb74e
@ -2391,6 +2391,36 @@ const GroundVehicleCache *Vehicle::GetGroundVehicleCache() const
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Access the ground vehicle flags of the vehicle.
|
||||
* @pre The vehicle is a #GroundVehicle.
|
||||
* @return #GroundVehicleFlags of the vehicle.
|
||||
*/
|
||||
uint16 &Vehicle::GetGroundVehicleFlags()
|
||||
{
|
||||
assert(this->IsGroundVehicle());
|
||||
if (this->type == VEH_TRAIN) {
|
||||
return Train::From(this)->gv_flags;
|
||||
} else {
|
||||
return RoadVehicle::From(this)->gv_flags;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Access the ground vehicle flags of the vehicle.
|
||||
* @pre The vehicle is a #GroundVehicle.
|
||||
* @return #GroundVehicleFlags of the vehicle.
|
||||
*/
|
||||
const uint16 &Vehicle::GetGroundVehicleFlags() const
|
||||
{
|
||||
assert(this->IsGroundVehicle());
|
||||
if (this->type == VEH_TRAIN) {
|
||||
return Train::From(this)->gv_flags;
|
||||
} else {
|
||||
return RoadVehicle::From(this)->gv_flags;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the set of vehicles that will be affected by a given selection.
|
||||
* @param set [inout] Set of affected vehicles.
|
||||
|
@ -249,6 +249,9 @@ public:
|
||||
GroundVehicleCache *GetGroundVehicleCache();
|
||||
const GroundVehicleCache *GetGroundVehicleCache() const;
|
||||
|
||||
uint16 &GetGroundVehicleFlags();
|
||||
const uint16 &GetGroundVehicleFlags() const;
|
||||
|
||||
void DeleteUnreachedAutoOrders();
|
||||
|
||||
void HandleLoading(bool mode = false);
|
||||
|
Loading…
Reference in New Issue
Block a user