diff options
author | Darkvater <darkvater@openttd.org> | 2005-04-03 13:37:35 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2005-04-03 13:37:35 +0000 |
commit | fc411d3675335dd86490a30c641e4394b86f56d1 (patch) | |
tree | 64751550a8509d43262c2c390e46669259ab4249 /town_cmd.c | |
parent | f00d0d8ea881777742b0ae9f8a53d1e706d4b47e (diff) | |
download | openttd-fc411d3675335dd86490a30c641e4394b86f56d1.tar.xz |
(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[]!
Diffstat (limited to 'town_cmd.c')
-rw-r--r-- | town_cmd.c | 9 |
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) { |