changeset 15638:ac0992c935b9 draft

(svn r20302) -Add: Method for getting the air drag of a ground vehicle.
author terkhen <terkhen@openttd.org>
date Mon, 02 Aug 2010 14:52:51 +0000
parents d0e6ff4d6783
children c3f5c85493f7
files src/ground_vehicle.hpp src/roadveh.h src/train.h
diffstat 3 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ground_vehicle.hpp
+++ b/src/ground_vehicle.hpp
@@ -54,6 +54,7 @@
  * virtual uint16      GetPoweredPartPower(const T *head) const = 0;
  * virtual uint16      GetWeight() const = 0;
  * virtual byte        GetTractiveEffort() const = 0;
+ * virtual byte        GetAirDrag() const = 0;
  * virtual byte        GetAirDragArea() const = 0;
  * virtual AccelStatus GetAccelerationStatus() const = 0;
  * virtual uint16      GetCurrentSpeed() const = 0;
--- a/src/roadveh.h
+++ b/src/roadveh.h
@@ -220,6 +220,15 @@
 	}
 
 	/**
+	 * Gets the air drag coefficient of this vehicle.
+	 * @return Air drag value from the engine.
+	 */
+	FORCEINLINE byte GetAirDrag() const
+	{
+		return RoadVehInfo(this->engine_type)->air_drag;
+	}
+
+	/**
 	 * Checks the current acceleration status of this vehicle.
 	 * @return Acceleration status.
 	 */
--- a/src/train.h
+++ b/src/train.h
@@ -442,6 +442,15 @@
 	}
 
 	/**
+	 * Gets the air drag coefficient of this vehicle.
+	 * @return Air drag value from the engine.
+	 */
+	FORCEINLINE byte GetAirDrag() const
+	{
+		return RailVehInfo(this->engine_type)->air_drag;
+	}
+
+	/**
 	 * Checks the current acceleration status of this vehicle.
 	 * @return Acceleration status.
 	 */