Mercurial > hg > openttd
changeset 8170:a8be61a5213c draft
(svn r11733) -Fix: Max speed for entering stations overrode the max speed of curves
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Tue, 01 Jan 2008 14:15:28 +0000 |
parents | 7962907a27a1 |
children | df1e18335376 |
files | src/train_cmd.cpp |
diffstat | 1 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -368,15 +368,16 @@ 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; - - 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); - - max_speed = max(max_speed, 25 * station_length); + + int st_max_speed = 120; + + 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); + } + + st_max_speed = max(st_max_speed, 25 * station_length); + max_speed = min(max_speed, st_max_speed); } }