MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DoDryUp

Function DoDryUp

src/water_cmd.cpp:1222–1261  ·  view source on GitHub ↗

* Drys a tile up. */

Source from the content-addressed store, hash-verified

1220 * Drys a tile up.
1221 */
1222static void DoDryUp(TileIndex tile)
1223{
1224 Backup<CompanyID> cur_company(_current_company, OWNER_WATER);
1225
1226 switch (GetTileType(tile)) {
1227 case MP_RAILWAY:
1228 assert(IsPlainRail(tile));
1229 assert(GetRailGroundType(tile) == RailGroundType::HalfTileWater);
1230
1231 RailGroundType new_ground;
1232 switch (GetTrackBits(tile)) {
1233 case TRACK_BIT_UPPER: new_ground = RailGroundType::FenceHoriz1; break;
1234 case TRACK_BIT_LOWER: new_ground = RailGroundType::FenceHoriz2; break;
1235 case TRACK_BIT_LEFT: new_ground = RailGroundType::FenceVert1; break;
1236 case TRACK_BIT_RIGHT: new_ground = RailGroundType::FenceVert2; break;
1237 default: NOT_REACHED();
1238 }
1239 SetRailGroundType(tile, new_ground);
1240 MarkTileDirtyByTile(tile);
1241 break;
1242
1243 case MP_TREES:
1244 SetTreeGroundDensity(tile, TREE_GROUND_GRASS, 3);
1245 MarkTileDirtyByTile(tile);
1246 break;
1247
1248 case MP_WATER:
1249 assert(IsCoast(tile));
1250
1251 if (Command<CMD_LANDSCAPE_CLEAR>::Do(DoCommandFlag::Execute, tile).Succeeded()) {
1252 MakeClear(tile, CLEAR_GRASS, 3);
1253 MarkTileDirtyByTile(tile);
1254 }
1255 break;
1256
1257 default: NOT_REACHED();
1258 }
1259
1260 cur_company.Restore();
1261}
1262
1263/**
1264 * Let a water tile floods its diagonal adjoining tiles

Callers 1

TileLoop_WaterFunction · 0.85

Calls 12

GetTileTypeFunction · 0.85
IsPlainRailFunction · 0.85
GetRailGroundTypeFunction · 0.85
GetTrackBitsFunction · 0.85
NOT_REACHEDFunction · 0.85
SetRailGroundTypeFunction · 0.85
SetTreeGroundDensityFunction · 0.85
IsCoastFunction · 0.85
MakeClearFunction · 0.85
SucceededMethod · 0.80
MarkTileDirtyByTileFunction · 0.70
RestoreMethod · 0.45

Tested by

no test coverage detected