summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCelestar <Celestar@openttd.org>2004-12-11 12:12:51 +0000
committerCelestar <Celestar@openttd.org>2004-12-11 12:12:51 +0000
commit969d07925ae9538324abe2eb61ba56cb8b678858 (patch)
tree9065f9f446cf43b22cb41f0b2bbcc0c81b0d5605
parent9da370de639016536743244e3ddd0bc95047b196 (diff)
downloadopenttd-969d07925ae9538324abe2eb61ba56cb8b678858.tar.xz
(svn r1017) Solved a Segfault if a station was built too close to the northern corner
-rw-r--r--station_cmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/station_cmd.c b/station_cmd.c
index 6c8bc987d..56c51ec38 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -283,7 +283,7 @@ static Station *GetClosestStationFromTile(uint tile, uint threshold, byte owner)
FOR_ALL_STATIONS(st) {
cur_dist = GetTileDist(tile, st->xy);
- if (cur_dist < threshold && (owner == 0xFF || st->owner == owner)) {
+ if (cur_dist < threshold && (owner == 0xFF || st->owner == owner) && (st->xy != 0)) {
threshold = cur_dist;
best_station = st;
}