mirror of https://github.com/OpenTTD/OpenTTD
Codefix: do not wrap-around the map when flooding tiles
parent
5e8da0479a
commit
8ca417baa9
|
@ -1235,7 +1235,7 @@ void TileLoop_Water(TileIndex tile)
|
||||||
switch (GetFloodingBehaviour(tile)) {
|
switch (GetFloodingBehaviour(tile)) {
|
||||||
case FLOOD_ACTIVE:
|
case FLOOD_ACTIVE:
|
||||||
for (Direction dir = DIR_BEGIN; dir < DIR_END; dir++) {
|
for (Direction dir = DIR_BEGIN; dir < DIR_END; dir++) {
|
||||||
TileIndex dest = tile + TileOffsByDir(dir);
|
TileIndex dest = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir(dir));
|
||||||
if (!IsValidTile(dest)) continue;
|
if (!IsValidTile(dest)) continue;
|
||||||
/* do not try to flood water tiles - increases performance a lot */
|
/* do not try to flood water tiles - increases performance a lot */
|
||||||
if (IsTileType(dest, MP_WATER)) continue;
|
if (IsTileType(dest, MP_WATER)) continue;
|
||||||
|
@ -1255,8 +1255,8 @@ void TileLoop_Water(TileIndex tile)
|
||||||
case FLOOD_DRYUP: {
|
case FLOOD_DRYUP: {
|
||||||
Slope slope_here = std::get<0>(GetFoundationSlope(tile)) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP;
|
Slope slope_here = std::get<0>(GetFoundationSlope(tile)) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP;
|
||||||
for (uint dir : SetBitIterator(_flood_from_dirs[slope_here])) {
|
for (uint dir : SetBitIterator(_flood_from_dirs[slope_here])) {
|
||||||
TileIndex dest = tile + TileOffsByDir((Direction)dir);
|
TileIndex dest = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir(static_cast<Direction>(dir)));
|
||||||
if (dest >= Map::Size()) continue;
|
if (!IsValidTile(dest)) continue;
|
||||||
|
|
||||||
FloodingBehaviour dest_behaviour = GetFloodingBehaviour(dest);
|
FloodingBehaviour dest_behaviour = GetFloodingBehaviour(dest);
|
||||||
if ((dest_behaviour == FLOOD_ACTIVE) || (dest_behaviour == FLOOD_PASSIVE)) return;
|
if ((dest_behaviour == FLOOD_ACTIVE) || (dest_behaviour == FLOOD_PASSIVE)) return;
|
||||||
|
|
Loading…
Reference in New Issue