diff options
-rw-r--r-- | src/npf.cpp | 3 | ||||
-rw-r--r-- | src/yapf/yapf_destrail.hpp | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/npf.cpp b/src/npf.cpp index f29dc1fa3..b4b836b9d 100644 --- a/src/npf.cpp +++ b/src/npf.cpp @@ -101,6 +101,9 @@ static TileIndex CalcClosestStationTile(StationID station, TileIndex tile) { const Station* st = GetStation(station); + /* If the rail station is (temporarily) not present, use the station sign to drive near the station */ + if (!IsValidTile(st->train_tile)) return st->xy; + uint minx = TileX(st->train_tile); // topmost corner of station uint miny = TileY(st->train_tile); uint maxx = minx + st->trainst_w - 1; // lowermost corner of station diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp index 503b7f530..2af12e271 100644 --- a/src/yapf/yapf_destrail.hpp +++ b/src/yapf/yapf_destrail.hpp @@ -119,6 +119,9 @@ protected: { const Station* st = GetStation(station); + /* If the rail station is (temporarily) not present, use the station sign to drive near the station */ + if (!IsValidTile(st->train_tile)) return st->xy; + uint x = TileX(st->train_tile) + st->trainst_w / 2; uint y = TileY(st->train_tile) + st->trainst_h / 2; // return the tile of our target coordinates |