diff options
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r-- | src/vehicle.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index f4f38bd9c..38437c1b9 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2392,6 +2392,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. * @param v First vehicle of the selection. |