summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2012-02-14 17:04:06 +0000
committermichi_cc <michi_cc@openttd.org>2012-02-14 17:04:06 +0000
commitf2c694c8fbfb775dc239ab1c6447d3744d1c84c7 (patch)
treeaf7e8b3e3689ad2e9e0db8ef56a8c7ea7521b373 /src/train_cmd.cpp
parent347157cb8ce016428275d6143b555de1dc802133 (diff)
downloadopenttd-f2c694c8fbfb775dc239ab1c6447d3744d1c84c7.tar.xz
(svn r23947) -Feature: Timetabled maximum travel speeds for non-flying vehicles.
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 35127ae7f..4473c5265 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -404,6 +404,7 @@ int Train::GetCurrentMaxSpeed() const
}
}
+ max_speed = min(max_speed, this->current_order.max_speed);
return min(max_speed, this->gcache.cached_max_track_speed);
}
@@ -2748,7 +2749,7 @@ int Train::UpdateSpeed()
switch (_settings_game.vehicle.train_acceleration_model) {
default: NOT_REACHED();
case AM_ORIGINAL:
- return this->DoUpdateSpeed(this->acceleration * (this->GetAccelerationStatus() == AS_BRAKE ? -4 : 2), 0, this->gcache.cached_max_track_speed);
+ return this->DoUpdateSpeed(this->acceleration * (this->GetAccelerationStatus() == AS_BRAKE ? -4 : 2), 0, min(this->gcache.cached_max_track_speed, this->current_order.max_speed));
case AM_REALISTIC:
return this->DoUpdateSpeed(this->GetAcceleration(), this->GetAccelerationStatus() == AS_BRAKE ? 0 : 2, this->GetCurrentMaxSpeed());