(svn r21922) -Codechange: Unify articulated vehicle checking functions.

This commit is contained in:
terkhen
2011-01-29 17:26:23 +00:00
parent 14e0343d21
commit b974d69988
2 changed files with 27 additions and 18 deletions

View File

@@ -644,6 +644,33 @@ public:
bool IsEngineCountable() const;
bool HasDepotOrder() const;
void HandlePathfindingResult(bool path_found);
/**
* Check if the vehicle is a front engine.
* @return Returns true if the vehicle is a front engine.
*/
FORCEINLINE bool IsFrontEngine() const
{
return this->IsGroundVehicle() && HasBit(this->subtype, GVSF_FRONT);
}
/**
* Check if the vehicle is an articulated part of an engine.
* @return Returns true if the vehicle is an articulated part.
*/
FORCEINLINE bool IsArticulatedPart() const
{
return this->IsGroundVehicle() && HasBit(this->subtype, GVSF_ARTICULATED_PART);
}
/**
* Check if an engine has an articulated part.
* @return True if the engine has an articulated part.
*/
FORCEINLINE bool HasArticulatedPart() const
{
return this->Next() != NULL && this->Next()->IsArticulatedPart();
}
};
#define FOR_ALL_VEHICLES_FROM(var, start) FOR_ALL_ITEMS_FROM(Vehicle, vehicle_index, var, start)