summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-08-02 14:49:23 +0000
committerterkhen <terkhen@openttd.org>2010-08-02 14:49:23 +0000
commit1fd66d7cc489702557208a9d27c75ba9355e39fa (patch)
treef6bfbee0d3aff5cc46cb16f88a8246117c8f349b
parent14d58e997894190747fbe8bed20f9ddc73feef06 (diff)
downloadopenttd-1fd66d7cc489702557208a9d27c75ba9355e39fa.tar.xz
(svn r20299) -Add: Make trains and road vehicles use a different area value to calculate air drag.
-rw-r--r--src/ground_vehicle.cpp2
-rw-r--r--src/ground_vehicle.hpp1
-rw-r--r--src/roadveh.h9
-rw-r--r--src/train.h9
4 files changed, 20 insertions, 1 deletions
diff --git a/src/ground_vehicle.cpp b/src/ground_vehicle.cpp
index 395f0c26b..6ccba6aa7 100644
--- a/src/ground_vehicle.cpp
+++ b/src/ground_vehicle.cpp
@@ -107,7 +107,7 @@ int GroundVehicle<T, Type>::GetAcceleration() const
bool maglev = v->GetAccelerationType() == 2;
- const int area = 120;
+ const int area = v->GetAirDragArea();
if (!maglev) {
resistance = (13 * mass) / 10;
resistance += this->acc_cache.cached_axle_resistance;
diff --git a/src/ground_vehicle.hpp b/src/ground_vehicle.hpp
index 5be320d0f..84930464d 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 GetAirDragArea() const = 0;
* virtual AccelStatus GetAccelerationStatus() const = 0;
* virtual uint16 GetCurrentSpeed() const = 0;
* virtual uint32 GetRollingFriction() const = 0;
diff --git a/src/roadveh.h b/src/roadveh.h
index 6af7425b4..5a5ee549b 100644
--- a/src/roadveh.h
+++ b/src/roadveh.h
@@ -210,6 +210,15 @@ protected: // These functions should not be called outside acceleration code.
return RoadVehInfo(this->engine_type)->tractive_effort;
}
+ /**
+ * Gets the area used for calculating air drag.
+ * @return Area of the engine.
+ */
+ FORCEINLINE byte GetAirDragArea() const
+ {
+ return 60;
+ }
+
/**
* Checks the current acceleration status of this vehicle.
* @return Acceleration status.
diff --git a/src/train.h b/src/train.h
index a43b0747c..84bb88e30 100644
--- a/src/train.h
+++ b/src/train.h
@@ -433,6 +433,15 @@ protected: // These functions should not be called outside acceleration code.
}
/**
+ * Gets the area used for calculating air drag.
+ * @return Area of the engine.
+ */
+ FORCEINLINE byte GetAirDragArea() const
+ {
+ return 120;
+ }
+
+ /**
* Checks the current acceleration status of this vehicle.
* @return Acceleration status.
*/