Changeset - r17553:998cc9d7183e
[Not reviewed]
master
0 2 0
frosch - 13 years ago 2011-04-16 16:41:02
frosch@openttd.org
(svn r22327) -Add: Vehicle::GetGroundVehicleFlags() for accessing GroundVehicle<>::gv_flags through a Vehicle struct.
2 files changed with 33 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -2392,6 +2392,36 @@ const GroundVehicleCache *Vehicle::GetGr
 
}
 

	
 
/**
 
 * 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.
src/vehicle_base.h
Show inline comments
 
@@ -249,6 +249,9 @@ public:
 
	GroundVehicleCache *GetGroundVehicleCache();
 
	const GroundVehicleCache *GetGroundVehicleCache() const;
 

	
 
	uint16 &GetGroundVehicleFlags();
 
	const uint16 &GetGroundVehicleFlags() const;
 

	
 
	void DeleteUnreachedAutoOrders();
 

	
 
	void HandleLoading(bool mode = false);
0 comments (0 inline, 0 general)