(svn r21922) -Codechange: Unify articulated vehicle checking functions.
This commit is contained in:
		@@ -302,12 +302,6 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	FORCEINLINE void ClearMultiheaded() { ClrBit(this->subtype, GVSF_MULTIHEADED); }
 | 
						FORCEINLINE void ClearMultiheaded() { ClrBit(this->subtype, GVSF_MULTIHEADED); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Check if the vehicle is a front engine.
 | 
					 | 
				
			||||||
	 * @return Returns true if the vehicle is a front engine.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	FORCEINLINE bool IsFrontEngine() const { return HasBit(this->subtype, GVSF_FRONT); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Check if the vehicle is a free wagon (got no engine in front of it).
 | 
						 * Check if the vehicle is a free wagon (got no engine in front of it).
 | 
				
			||||||
	 * @return Returns true if the vehicle is a free wagon.
 | 
						 * @return Returns true if the vehicle is a free wagon.
 | 
				
			||||||
@@ -338,18 +332,6 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	FORCEINLINE bool IsRearDualheaded() const { return this->IsMultiheaded() && !this->IsEngine(); }
 | 
						FORCEINLINE bool IsRearDualheaded() const { return this->IsMultiheaded() && !this->IsEngine(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * 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 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(); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Update the GUI variant of the current speed of the vehicle.
 | 
						 * Update the GUI variant of the current speed of the vehicle.
 | 
				
			||||||
	 * Also mark the widget dirty when that is needed, i.e. when
 | 
						 * Also mark the widget dirty when that is needed, i.e. when
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -644,6 +644,33 @@ public:
 | 
				
			|||||||
	bool IsEngineCountable() const;
 | 
						bool IsEngineCountable() const;
 | 
				
			||||||
	bool HasDepotOrder() const;
 | 
						bool HasDepotOrder() const;
 | 
				
			||||||
	void HandlePathfindingResult(bool path_found);
 | 
						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)
 | 
					#define FOR_ALL_VEHICLES_FROM(var, start) FOR_ALL_ITEMS_FROM(Vehicle, vehicle_index, var, start)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user