summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-11-14 15:48:24 +0000
committerterkhen <terkhen@openttd.org>2010-11-14 15:48:24 +0000
commiteda95bb85cfd714a5dbdca4e4986f86050332f15 (patch)
tree1594b97c09224e2e938102dccc77e0bf48d0c486 /src/train_cmd.cpp
parent41c97d051f14eb9fea1d55d05c4b441fc3ec2972 (diff)
downloadopenttd-eda95bb85cfd714a5dbdca4e4986f86050332f15.tar.xz
(svn r21189) -Fix: Force a minimum speed for trains when using the realistic acceleration model.
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index ca09c07ac..a073c7e33 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2799,7 +2799,9 @@ int Train::UpdateSpeed()
if (this->cur_speed > max_speed) {
tempmax = this->cur_speed - (this->cur_speed / 10) - 1;
}
- this->cur_speed = spd = Clamp(this->cur_speed + ((int)spd >> 8), 0, tempmax);
+ /* Force a minimum speed of 1 km/h when realistic acceleration is on. */
+ int min_speed = (_settings_game.vehicle.train_acceleration_model == AM_ORIGINAL) ? 0 : 2;
+ this->cur_speed = spd = Clamp(this->cur_speed + ((int)spd >> 8), min_speed, tempmax);
}
int scaled_spd = this->GetAdvanceSpeed(spd);