mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-10-31 15:20:10 +00:00
Add pre-check to auxiliary tile loop flooding test
This commit is contained in:
parent
5a062bd5b2
commit
cc57ac0eff
@ -887,7 +887,7 @@ void RunAuxiliaryTileLoop()
|
|||||||
TileIndex tile = _aux_tileloop_tile;
|
TileIndex tile = _aux_tileloop_tile;
|
||||||
|
|
||||||
while (count--) {
|
while (count--) {
|
||||||
if (!IsNonFloodingWaterTile(tile)) {
|
if (IsFloodingTypeTile(tile) && !IsNonFloodingWaterTile(tile)) {
|
||||||
FloodingBehaviour fb = GetFloodingBehaviour(tile);
|
FloodingBehaviour fb = GetFloodingBehaviour(tile);
|
||||||
if (fb != FLOOD_NONE) TileLoopWaterFlooding(fb, tile);
|
if (fb != FLOOD_NONE) TileLoopWaterFlooding(fb, tile);
|
||||||
}
|
}
|
||||||
|
@ -524,4 +524,14 @@ static inline bool IsNonFloodingWaterTile(TileIndex t)
|
|||||||
return IsTileType(t, MP_WATER) && HasBit(_m[t].m3, 0);
|
return IsTileType(t, MP_WATER) && HasBit(_m[t].m3, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the tile type could have flooding behaviour
|
||||||
|
* @return true iff the tile type is one where GetFloodingBehaviour could return a value other than FLOOD_NONE.
|
||||||
|
*/
|
||||||
|
static inline bool IsFloodingTypeTile(TileIndex t)
|
||||||
|
{
|
||||||
|
static const uint16 mask = (1 << MP_WATER) | (1 << MP_STATION) | (1 << MP_INDUSTRY) | (1 << MP_RAILWAY) | (1 << MP_TREES) | (1 << MP_OBJECT) | (1 << MP_VOID);
|
||||||
|
return HasBit(mask, GetTileType(t));
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* WATER_MAP_H */
|
#endif /* WATER_MAP_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user