Add map bit to suppress water flooding checks

Set if all neighbour tiles are also water
This reduces the overhead of flood checks on large maps
This commit is contained in:
Jonathan G Rennison
2021-02-21 21:11:35 +00:00
parent 0df3e785cb
commit f595696e97
6 changed files with 42 additions and 2 deletions

View File

@@ -504,4 +504,24 @@ static inline void MakeLock(TileIndex t, Owner o, DiagDirection d, WaterClass wc
MakeLockTile(t + delta, IsWaterTile(t + delta) ? GetTileOwner(t + delta) : o, LOCK_PART_UPPER, d, wc_upper);
}
/**
* Set the non-flooding water tile state of a tile.
* @param t the tile
* @param b the non-flooding water tile state
*/
static inline void SetNonFloodingWaterTile(TileIndex t, bool b)
{
assert(IsTileType(t, MP_WATER));
SB(_m[t].m3, 0, 1, b ? 1 : 0);
}
/**
* Checks whether the tile is marked as a non-flooding water tile.
* @return true iff the tile is marked as a non-flooding water tile.
*/
static inline bool IsNonFloodingWaterTile(TileIndex t)
{
return IsTileType(t, MP_WATER) && HasBit(_m[t].m3, 0);
}
#endif /* WATER_MAP_H */