Codechange: Make void tiles flood edge tiles, instead of edge tiles flooding themselves (#8517)

This commit is contained in:
SamuXarick
2023-01-26 20:57:25 +00:00
committed by GitHub
parent ede1201b6a
commit 46dc6da270
3 changed files with 8 additions and 13 deletions

View File

@@ -1089,6 +1089,9 @@ FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
case MP_TREES:
return (GetTreeGround(tile) == TREE_GROUND_SHORE ? FLOOD_DRYUP : FLOOD_NONE);
case MP_VOID:
return FLOOD_ACTIVE;
default:
return FLOOD_NONE;
}
@@ -1240,7 +1243,7 @@ void TileLoop_Water(TileIndex tile)
Slope slope_here = GetFoundationSlope(tile) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP;
for (uint dir : SetBitIterator(_flood_from_dirs[slope_here])) {
TileIndex dest = tile + TileOffsByDir((Direction)dir);
if (!IsValidTile(dest)) continue;
if (dest >= Map::Size()) continue;
FloodingBehaviour dest_behaviour = GetFloodingBehaviour(dest);
if ((dest_behaviour == FLOOD_ACTIVE) || (dest_behaviour == FLOOD_PASSIVE)) return;
@@ -1279,7 +1282,7 @@ void ConvertGroundTilesIntoWaterTiles()
for (uint dir : SetBitIterator(_flood_from_dirs[slope & ~SLOPE_STEEP])) {
TileIndex dest = TileAddByDir(tile, (Direction)dir);
Slope slope_dest = GetTileSlope(dest) & ~SLOPE_STEEP;
if (slope_dest == SLOPE_FLAT || IsSlopeWithOneCornerRaised(slope_dest)) {
if (slope_dest == SLOPE_FLAT || IsSlopeWithOneCornerRaised(slope_dest) || IsTileType(dest, MP_VOID)) {
MakeShore(tile);
break;
}