mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-18 09:52:44 +01:00
Codechange: Replace CircularTileSearch with SpiralTileSequence.
This commit is contained in:
@@ -744,16 +744,6 @@ static void AnimateTile_Object(TileIndex tile)
|
||||
AnimateNewObjectTile(tile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for \c CircularTileSearch.
|
||||
* @param tile The tile to check.
|
||||
* @return True iff the tile has a radio tower.
|
||||
*/
|
||||
static bool HasTransmitter(TileIndex tile, void *)
|
||||
{
|
||||
return IsObjectTypeTile(tile, OBJECT_TRANSMITTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to build a lighthouse.
|
||||
* @return True iff building a lighthouse succeeded.
|
||||
@@ -805,9 +795,9 @@ static bool TryBuildTransmitter()
|
||||
TileIndex tile = RandomTile();
|
||||
int h;
|
||||
if (IsTileType(tile, MP_CLEAR) && IsTileFlat(tile, &h) && h >= 4 && !IsBridgeAbove(tile)) {
|
||||
TileIndex t = tile;
|
||||
if (CircularTileSearch(&t, 9, HasTransmitter, nullptr)) return false;
|
||||
|
||||
for (auto t : SpiralTileSequence(tile, 9)) {
|
||||
if (IsObjectTypeTile(t, OBJECT_TRANSMITTER)) return false;
|
||||
}
|
||||
BuildObject(OBJECT_TRANSMITTER, tile);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user