summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-06-01 09:41:35 +0000
committercelestar <celestar@openttd.org>2006-06-01 09:41:35 +0000
commit65a6286345445ff29153dff66b07938113d4e521 (patch)
tree1237eb340fcae47dd0705064319849a06becbec1 /train_cmd.c
parentf8982917ea8bd4cb2419cc423c1293bb341c92f9 (diff)
downloadopenttd-65a6286345445ff29153dff66b07938113d4e521.tar.xz
(svn r5063) -Codechange: Add a function to determine the length of a platform (request by KUDr)
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 13f87f874..04d1bdfaf 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -332,15 +332,11 @@ static int GetTrainAcceleration(Vehicle *v, bool mode)
if (IsTileType(v->tile, MP_STATION) && IsFrontEngine(v)) {
if (TrainShouldStop(v, v->tile)) {
- int station_length = 0;
- TileIndex tile = v->tile;
+ uint station_length = GetPlatformLength(v->tile, DirToDiagDir(v->direction));
int delta_v;
+ DEBUG(misc, 0) ("Length: %d", station_length);
max_speed = 120;
- do {
- station_length++;
- tile = TILE_ADD(tile, TileOffsByDir(v->direction / 2));
- } while (IsCompatibleTrainStationTile(tile, v->tile));
delta_v = v->cur_speed / (station_length + 1);
if (v->max_speed > (v->cur_speed - delta_v))