equal
deleted
inserted
replaced
739 do block = Random() & 3; while (!HASBIT(mask,block)); |
739 do block = Random() & 3; while (!HASBIT(mask,block)); |
740 tile += ToTileIndexDiff(_roadblock_tileadd[block]); |
740 tile += ToTileIndexDiff(_roadblock_tileadd[block]); |
741 |
741 |
742 if (IsTileType(tile, MP_STREET)) { |
742 if (IsTileType(tile, MP_STREET)) { |
743 /* Don't allow building over roads of other cities */ |
743 /* Don't allow building over roads of other cities */ |
744 if (_map_owner[tile] == OWNER_TOWN && GetTown(_map2[tile]) != t) |
744 if (IsTileOwner(tile, OWNER_TOWN) && GetTown(_map2[tile]) != t) |
745 _grow_town_result = -1; |
745 _grow_town_result = -1; |
746 else if (_game_mode == GM_EDITOR) { |
746 else if (_game_mode == GM_EDITOR) { |
747 /* If we are in the SE, and this road-piece has no town owner yet, it just found an |
747 /* If we are in the SE, and this road-piece has no town owner yet, it just found an |
748 * owner :) (happy happy happy road now) */ |
748 * owner :) (happy happy happy road now) */ |
749 _map_owner[tile] = OWNER_TOWN; |
749 _map_owner[tile] = OWNER_TOWN; |
1493 DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); |
1493 DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); |
1494 break; |
1494 break; |
1495 |
1495 |
1496 case MP_STREET: |
1496 case MP_STREET: |
1497 case MP_TUNNELBRIDGE: |
1497 case MP_TUNNELBRIDGE: |
1498 if (_map_owner[tile] == OWNER_TOWN && |
1498 if (IsTileOwner(tile, OWNER_TOWN) && |
1499 ClosestTownFromTile(tile, (uint)-1) == t) |
1499 ClosestTownFromTile(tile, (uint)-1) == t) |
1500 DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); |
1500 DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); |
1501 break; |
1501 break; |
1502 |
1502 |
1503 default: |
1503 default: |
1835 Town *ClosestTownFromTile(uint tile, uint threshold) |
1835 Town *ClosestTownFromTile(uint tile, uint threshold) |
1836 { |
1836 { |
1837 Town *t; |
1837 Town *t; |
1838 uint dist, best = threshold; |
1838 uint dist, best = threshold; |
1839 Town *best_town = NULL; |
1839 Town *best_town = NULL; |
1840 byte owner; |
|
1841 |
1840 |
1842 // XXX - Fix this so for a given tiletype the owner of the type is in the same variable |
1841 // XXX - Fix this so for a given tiletype the owner of the type is in the same variable |
1843 if (IsTileType(tile, MP_STREET) && (_map5[tile] & 0xF0) == 0x10) { // rail crossing |
1842 if (IsTileType(tile, MP_HOUSE) || ( |
1844 owner = _map3_lo[tile]; |
1843 IsTileType(tile, MP_STREET) && |
1845 } else |
1844 ((_map5[tile] & 0xF0) != 0x10 ? GetTileOwner(tile) : _map3_lo[tile]) == OWNER_TOWN |
1846 owner = _map_owner[tile]; |
1845 )) |
1847 |
|
1848 if ((IsTileType(tile, MP_STREET) && owner == OWNER_TOWN) || IsTileType(tile, MP_HOUSE)) |
|
1849 return GetTown(_map2[tile]); |
1846 return GetTown(_map2[tile]); |
1850 |
1847 |
1851 FOR_ALL_TOWNS(t) { |
1848 FOR_ALL_TOWNS(t) { |
1852 if (t->xy != 0) { |
1849 if (t->xy != 0) { |
1853 dist = DistanceManhattan(tile, t->xy); |
1850 dist = DistanceManhattan(tile, t->xy); |