summaryrefslogtreecommitdiff
path: root/src/train.h
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2010-11-07 13:35:07 +0000
committermichi_cc <michi_cc@openttd.org>2010-11-07 13:35:07 +0000
commit2d801c64a1d8ce0cf3f4f106d77c47fea33bbd4d (patch)
tree45839f8afb161f979b4131255f3c132ade2b1f8f /src/train.h
parent1ee62de0a338f07b2b843bedc00621f8bb1bfea3 (diff)
downloadopenttd-2d801c64a1d8ce0cf3f4f106d77c47fea33bbd4d.tar.xz
(svn r21106) -Change: Tuned realistic acceleration to be a bit more realistic in order to make acceleration "slower", which highlights the differences between vehicle types more.
Diffstat (limited to 'src/train.h')
-rw-r--r--src/train.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/train.h b/src/train.h
index b334c0b92..d407c48ee 100644
--- a/src/train.h
+++ b/src/train.h
@@ -438,11 +438,12 @@ protected: // These functions should not be called outside acceleration code.
/**
* Gets the area used for calculating air drag.
- * @return Area of the engine.
+ * @return Area of the engine in m^2.
*/
FORCEINLINE byte GetAirDragArea() const
{
- return 120;
+ /* Air drag is higher in tunnels due to the limited cross-section. */
+ return (this->track == TRACK_BIT_WORMHOLE && this->vehstatus & VS_HIDDEN) ? 28 : 14;
}
/**
@@ -465,20 +466,24 @@ protected: // These functions should not be called outside acceleration code.
/**
* Calculates the current speed of this vehicle.
- * @return Current speed in mph.
+ * @return Current speed in km/h-ish.
*/
FORCEINLINE uint16 GetCurrentSpeed() const
{
- return this->cur_speed * 10 / 16;
+ return this->cur_speed;
}
/**
* Returns the rolling friction coefficient of this vehicle.
- * @return Rolling friction coefficient in [1e-3].
+ * @return Rolling friction coefficient in [1e-4].
*/
FORCEINLINE uint32 GetRollingFriction() const
{
- return 35;
+ /* Rolling friction for steel on steel is between 0.1% and 0.2%,
+ * but we use a higher value here to get better game-play results.
+ * The friction coefficient increases with speed in a way that
+ * it doubles at 512 km/h, triples at 1024 km/h and so on. */
+ return 30 * (512 + this->GetCurrentSpeed()) / 512;
}
/**
@@ -496,7 +501,7 @@ protected: // These functions should not be called outside acceleration code.
*/
FORCEINLINE uint32 GetSlopeSteepness() const
{
- return 20 * _settings_game.vehicle.train_slope_steepness; // 1% slope * slope steepness
+ return _settings_game.vehicle.train_slope_steepness;
}
/**