diff options
author | rubidium <rubidium@openttd.org> | 2008-04-14 07:08:43 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-04-14 07:08:43 +0000 |
commit | 14b307a621432dae325c2783422387843871e86b (patch) | |
tree | a7b873b3abac42f171ee86f9562c8946a1b2bb7f | |
parent | 304cb0e1e241d76c10d506ab55b05d6534ce98d4 (diff) | |
download | openttd-14b307a621432dae325c2783422387843871e86b.tar.xz |
(svn r12698) -Codechange: skip orders to stations that do not have a train part anymore, just like is done for road vehicles and ships.
-rw-r--r-- | src/ship_cmd.cpp | 2 | ||||
-rw-r--r-- | src/train_cmd.cpp | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 6d55a3658..e111cf77b 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -243,7 +243,7 @@ TileIndex Ship::GetOrderStationLocation(StationID station) { if (station == this->last_station_visited) this->last_station_visited = INVALID_STATION; - Station *st = GetStation(station); + const Station *st = GetStation(station); if (st->dock_tile != 0) { return TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile))); } else { diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 39236c261..076a9e225 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2563,7 +2563,14 @@ TileIndex Train::GetOrderStationLocation(StationID station) { if (station == this->last_station_visited) this->last_station_visited = INVALID_STATION; - return GetStation(station)->xy; + const Station *st = GetStation(station); + if (!(st->facilities & FACIL_TRAIN)) { + /* The destination station has no trainstation tiles. */ + this->cur_order_index++; + return 0; + } + + return st->xy; } void Train::MarkDirty() |