summaryrefslogtreecommitdiff
path: root/src
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
commite5f50b6fde0107f1b77a2f3fb91fc919bab33030 (patch)
tree5459b9193a83cb97ef3eb8f17503087fa3728d09 /src
parenta1b482973de4a2d14088710237119e13eb89e60c (diff)
downloadopenttd-e5f50b6fde0107f1b77a2f3fb91fc919bab33030.tar.xz
(svn r11733) -Fix: Max speed for entering stations overrode the max speed of curves
Diffstat (limited to 'src')
-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);
}
}