summaryrefslogtreecommitdiff
path: root/src/yapf/yapf_destrail.hpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-01-08 18:08:14 +0000
committerfrosch <frosch@openttd.org>2009-01-08 18:08:14 +0000
commit26e9c4c489cd4deefb0002e2d18f142ca8221810 (patch)
treec480f4195b8351ba7e0a7c0abe64411626a8603f /src/yapf/yapf_destrail.hpp
parentc8c61e36bdfe2de8e3785b6c3912a733f099df3e (diff)
downloadopenttd-26e9c4c489cd4deefb0002e2d18f142ca8221810.tar.xz
(svn r14921) -Fix [FS#2507]: Do not try to calculate a center of a train-station, when there is none.
Diffstat (limited to 'src/yapf/yapf_destrail.hpp')
-rw-r--r--src/yapf/yapf_destrail.hpp3
1 files changed, 3 insertions, 0 deletions
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