* Returns the behaviour of a tile during flooding. * * @return Behaviour of the tile */
| 1113 | * @return Behaviour of the tile |
| 1114 | */ |
| 1115 | FloodingBehaviour GetFloodingBehaviour(TileIndex tile) |
| 1116 | { |
| 1117 | /* FLOOD_ACTIVE: 'single-corner-raised'-coast, sea, sea-shipdepots, sea-buoys, sea-docks (water part), rail with flooded halftile, sea-water-industries, sea-oilrigs |
| 1118 | * FLOOD_DRYUP: coast with more than one corner raised, coast with rail-track, coast with trees |
| 1119 | * FLOOD_PASSIVE: (not used) |
| 1120 | * FLOOD_NONE: canals, rivers, everything else |
| 1121 | */ |
| 1122 | switch (GetTileType(tile)) { |
| 1123 | case MP_WATER: |
| 1124 | if (IsCoast(tile)) { |
| 1125 | Slope tileh = GetTileSlope(tile); |
| 1126 | return (IsSlopeWithOneCornerRaised(tileh) ? FLOOD_ACTIVE : FLOOD_DRYUP); |
| 1127 | } |
| 1128 | [[fallthrough]]; |
| 1129 | case MP_STATION: |
| 1130 | case MP_INDUSTRY: |
| 1131 | case MP_OBJECT: |
| 1132 | return (GetWaterClass(tile) == WaterClass::Sea) ? FLOOD_ACTIVE : FLOOD_NONE; |
| 1133 | |
| 1134 | case MP_RAILWAY: |
| 1135 | if (GetRailGroundType(tile) == RailGroundType::HalfTileWater) { |
| 1136 | return (IsSlopeWithOneCornerRaised(GetTileSlope(tile)) ? FLOOD_ACTIVE : FLOOD_DRYUP); |
| 1137 | } |
| 1138 | return FLOOD_NONE; |
| 1139 | |
| 1140 | case MP_TREES: |
| 1141 | return (GetTreeGround(tile) == TREE_GROUND_SHORE ? FLOOD_DRYUP : FLOOD_NONE); |
| 1142 | |
| 1143 | case MP_VOID: |
| 1144 | return FLOOD_ACTIVE; |
| 1145 | |
| 1146 | default: |
| 1147 | return FLOOD_NONE; |
| 1148 | } |
| 1149 | } |
| 1150 | |
| 1151 | /** |
| 1152 | * Floods a tile. |
no test coverage detected