(svn r2142) - Fix: Game no longer crashes when you want to remove a piece of road under a bridge that belongs to the town. TODO: railcrossings store owner somewhere else, put it into _map_owner[]!

This commit is contained in:
Darkvater
2005-04-03 13:37:35 +00:00
parent f00d0d8ea8
commit fc411d3675
2 changed files with 40 additions and 22 deletions

View File

@@ -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) {