Mercurial > hg > openttd
changeset 10627:bb991a001a68 draft
(svn r14921) -Fix [FS#2507]: Do not try to calculate a center of a train-station, when there is none.
author | frosch <frosch@openttd.org> |
---|---|
date | Thu, 08 Jan 2009 18:08:14 +0000 |
parents | 3189a053f43a |
children | ad5ab2ef50b7 |
files | src/npf.cpp src/yapf/yapf_destrail.hpp |
diffstat | 2 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/npf.cpp +++ b/src/npf.cpp @@ -101,6 +101,9 @@ { 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
--- a/src/yapf/yapf_destrail.hpp +++ b/src/yapf/yapf_destrail.hpp @@ -119,6 +119,9 @@ { 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