| 2003 | |
| 2004 | |
| 2005 | static void TileLoop_Road(TileIndex tile) |
| 2006 | { |
| 2007 | switch (_settings_game.game_creation.landscape) { |
| 2008 | case LandscapeType::Arctic: { |
| 2009 | /* Roads on flat foundations use the snow level of the height they are elevated to. All others use the snow level of their minimum height. */ |
| 2010 | int tile_z = (std::get<Slope>(GetFoundationSlope(tile)) == SLOPE_FLAT) ? GetTileMaxZ(tile) : GetTileZ(tile); |
| 2011 | if (IsOnSnowOrDesert(tile) != (tile_z > GetSnowLine())) { |
| 2012 | ToggleSnowOrDesert(tile); |
| 2013 | MarkTileDirtyByTile(tile); |
| 2014 | } |
| 2015 | break; |
| 2016 | } |
| 2017 | |
| 2018 | case LandscapeType::Tropic: |
| 2019 | if (GetTropicZone(tile) == TROPICZONE_DESERT && !IsOnSnowOrDesert(tile)) { |
| 2020 | ToggleSnowOrDesert(tile); |
| 2021 | MarkTileDirtyByTile(tile); |
| 2022 | } |
| 2023 | break; |
| 2024 | |
| 2025 | default: |
| 2026 | break; |
| 2027 | } |
| 2028 | |
| 2029 | if (IsRoadDepot(tile)) return; |
| 2030 | |
| 2031 | const Town *t = ClosestTownFromTile(tile, UINT_MAX); |
| 2032 | if (!HasRoadWorks(tile)) { |
| 2033 | HouseZone grp = HouseZone::TownEdge; |
| 2034 | |
| 2035 | if (t != nullptr) { |
| 2036 | grp = GetTownRadiusGroup(t, tile); |
| 2037 | |
| 2038 | /* Show an animation to indicate road work */ |
| 2039 | if (t->road_build_months != 0 && |
| 2040 | (DistanceManhattan(t->xy, tile) < 8 || grp != HouseZone::TownEdge) && |
| 2041 | IsNormalRoad(tile) && !HasAtMostOneBit(GetAllRoadBits(tile))) { |
| 2042 | if (std::get<0>(GetFoundationSlope(tile)) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile).Succeeded() && Chance16(1, 40)) { |
| 2043 | StartRoadWorks(tile); |
| 2044 | |
| 2045 | if (_settings_client.sound.ambient) SndPlayTileFx(SND_21_ROAD_WORKS, tile); |
| 2046 | CreateEffectVehicleAbove( |
| 2047 | TileX(tile) * TILE_SIZE + 7, |
| 2048 | TileY(tile) * TILE_SIZE + 7, |
| 2049 | 0, |
| 2050 | EV_BULLDOZER); |
| 2051 | MarkTileDirtyByTile(tile); |
| 2052 | return; |
| 2053 | } |
| 2054 | } |
| 2055 | } |
| 2056 | |
| 2057 | { |
| 2058 | /* Adjust road ground type depending on 'grp' (grp is the distance to the center) */ |
| 2059 | const Roadside *new_rs = (_settings_game.game_creation.landscape == LandscapeType::Toyland) ? _town_road_types_2[to_underlying(grp)] : _town_road_types[to_underlying(grp)]; |
| 2060 | Roadside cur_rs = GetRoadside(tile); |
| 2061 | |
| 2062 | /* We have our desired type, do nothing */ |
nothing calls this directly
no test coverage detected