summaryrefslogtreecommitdiff
path: root/town_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'town_cmd.c')
-rw-r--r--town_cmd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/town_cmd.c b/town_cmd.c
index e96b3d0ab..60d1b5962 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -1807,8 +1807,15 @@ Town *ClosestTownFromTile(uint tile, uint threshold)
Town *t;
uint dist, best = threshold;
Town *best_town = NULL;
+ byte owner;
- if ((IsTileType(tile, MP_STREET) && _map_owner[tile] == OWNER_TOWN) || IsTileType(tile, MP_HOUSE))
+ // XXX - Fix this so for a given tiletype the owner of the type is in the same variable
+ if (IsTileType(tile, MP_STREET) && (_map5[tile] & 0xF0) == 0x10) { // rail crossing
+ owner = _map3_lo[tile];
+ } else
+ owner = _map_owner[tile];
+
+ if ((IsTileType(tile, MP_STREET) && owner == OWNER_TOWN) || IsTileType(tile, MP_HOUSE))
return GetTown(_map2[tile]);
FOR_ALL_TOWNS(t) {