summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-01-01 14:15:28 +0000
committerpeter1138 <peter1138@openttd.org>2008-01-01 14:15:28 +0000
commita8611311ac842618f0be9e20b8339e7adbf86738 (patch)
tree5459b9193a83cb97ef3eb8f17503087fa3728d09
parenta967a7287f7553a2873750ad00ae99e6adfa47c5 (diff)
downloadopenttd-a8611311ac842618f0be9e20b8339e7adbf86738.tar.xz
(svn r11733) -Fix: Max speed for entering stations overrode the max speed of curves
-rw-r--r--src/train_cmd.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index b5c9e3c0d..7ce0f09f6 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -368,15 +368,16 @@ static int GetTrainAcceleration(Vehicle *v, bool mode)
if (IsTileType(v->tile, MP_STATION) && IsFrontEngine(v)) {
if (TrainShouldStop(v, v->tile)) {
int station_length = GetStationByTile(v->tile)->GetPlatformLength(v->tile, DirToDiagDir(v->direction));
- int delta_v;
- max_speed = 120;
+ int st_max_speed = 120;
- delta_v = v->cur_speed / (station_length + 1);
- if (v->max_speed > (v->cur_speed - delta_v))
- max_speed = v->cur_speed - (delta_v / 10);
+ int delta_v = v->cur_speed / (station_length + 1);
+ if (v->max_speed > (v->cur_speed - delta_v)) {
+ st_max_speed = v->cur_speed - (delta_v / 10);
+ }
- max_speed = max(max_speed, 25 * station_length);
+ st_max_speed = max(st_max_speed, 25 * station_length);
+ max_speed = min(max_speed, st_max_speed);
}
}