town_cmd.c
changeset 1638 aae181b00846
parent 1529 be4a2259d2ff
child 1793 8ac8a8c9ec0f
--- a/town_cmd.c	Sun Apr 03 13:35:43 2005 +0000
+++ b/town_cmd.c	Sun Apr 03 13:37:35 2005 +0000
@@ -1807,8 +1807,15 @@
 	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) {