summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-08-02 14:52:51 +0000
committerterkhen <terkhen@openttd.org>2010-08-02 14:52:51 +0000
commit7d0297f96710d658e09c7494637030921c1bc4a5 (patch)
tree991311470781284ddac5ba08ae72d2a7e96bf49f
parent8203749e6858ebd0931acb13132c83796bf65e02 (diff)
downloadopenttd-7d0297f96710d658e09c7494637030921c1bc4a5.tar.xz
(svn r20302) -Add: Method for getting the air drag of a ground vehicle.
-rw-r--r--src/ground_vehicle.hpp1
-rw-r--r--src/roadveh.h9
-rw-r--r--src/train.h9
3 files changed, 19 insertions, 0 deletions
diff --git a/src/ground_vehicle.hpp b/src/ground_vehicle.hpp
index 84930464d..2e748bda4 100644
--- a/src/ground_vehicle.hpp
+++ b/src/ground_vehicle.hpp
@@ -54,6 +54,7 @@ enum GroundVehicleFlags {
* 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;
diff --git a/src/roadveh.h b/src/roadveh.h
index 5a5ee549b..9459f3816 100644
--- a/src/roadveh.h
+++ b/src/roadveh.h
@@ -220,6 +220,15 @@ protected: // These functions should not be called outside acceleration code.
}
/**
+ * 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.
*/
diff --git a/src/train.h b/src/train.h
index 84bb88e30..6cb7e5888 100644
--- a/src/train.h
+++ b/src/train.h
@@ -442,6 +442,15 @@ protected: // These functions should not be called outside acceleration code.
}
/**
+ * 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.
*/