1038 if (dest == INVALID_TILE) continue; |
1038 if (dest == INVALID_TILE) continue; |
1039 /* do not try to flood water tiles - increases performance a lot */ |
1039 /* do not try to flood water tiles - increases performance a lot */ |
1040 if (IsTileType(dest, MP_WATER)) continue; |
1040 if (IsTileType(dest, MP_WATER)) continue; |
1041 |
1041 |
1042 uint z_dest; |
1042 uint z_dest; |
1043 Slope slope_dest = (Slope)(GetFoundationSlope(dest, &z_dest) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP); |
1043 Slope slope_dest = GetFoundationSlope(dest, &z_dest) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP; |
1044 if (z_dest > 0) continue; |
1044 if (z_dest > 0) continue; |
1045 |
1045 |
1046 if (!HasBit(_flood_from_dirs[slope_dest], ReverseDir(dir))) continue; |
1046 if (!HasBit(_flood_from_dirs[slope_dest], ReverseDir(dir))) continue; |
1047 |
1047 |
1048 DoFloodTile(dest); |
1048 DoFloodTile(dest); |
1049 } |
1049 } |
1050 break; |
1050 break; |
1051 |
1051 |
1052 case FLOOD_DRYUP: { |
1052 case FLOOD_DRYUP: { |
1053 Slope slope_here = (Slope)(GetFoundationSlope(tile, NULL) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP); |
1053 Slope slope_here = GetFoundationSlope(tile, NULL) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP; |
1054 uint check_dirs = _flood_from_dirs[slope_here]; |
1054 uint check_dirs = _flood_from_dirs[slope_here]; |
1055 uint dir; |
1055 uint dir; |
1056 FOR_EACH_SET_BIT(dir, check_dirs) { |
1056 FOR_EACH_SET_BIT(dir, check_dirs) { |
1057 TileIndex dest = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir((Direction)dir)); |
1057 TileIndex dest = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir((Direction)dir)); |
1058 if (dest == INVALID_TILE) continue; |
1058 if (dest == INVALID_TILE) continue; |
1095 default: |
1095 default: |
1096 uint check_dirs = _flood_from_dirs[slope & ~SLOPE_STEEP]; |
1096 uint check_dirs = _flood_from_dirs[slope & ~SLOPE_STEEP]; |
1097 uint dir; |
1097 uint dir; |
1098 FOR_EACH_SET_BIT(dir, check_dirs) { |
1098 FOR_EACH_SET_BIT(dir, check_dirs) { |
1099 TileIndex dest = TILE_ADD(tile, TileOffsByDir((Direction)dir)); |
1099 TileIndex dest = TILE_ADD(tile, TileOffsByDir((Direction)dir)); |
1100 Slope slope_dest = (Slope)(GetTileSlope(dest, NULL) & ~SLOPE_STEEP); |
1100 Slope slope_dest = GetTileSlope(dest, NULL) & ~SLOPE_STEEP; |
1101 if (slope_dest == SLOPE_FLAT || IsSlopeWithOneCornerRaised(slope_dest)) { |
1101 if (slope_dest == SLOPE_FLAT || IsSlopeWithOneCornerRaised(slope_dest)) { |
1102 MakeShore(tile); |
1102 MakeShore(tile); |
1103 break; |
1103 break; |
1104 } |
1104 } |
1105 } |
1105 } |