From f983a74f2e07e521be0150fbcb5e77f36bb8228a Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 19 Jan 2026 23:34:56 +0000 Subject: [PATCH] Codechange: Remove CLEAR_SNOW. (#15136) Remove CLEAR_SNOW which is no longer used on the map and causes confusion. IsSnowTile() is checked instead. --- src/clear_cmd.cpp | 29 ++++++++++++++--------------- src/clear_map.h | 1 - src/saveload/afterload.cpp | 2 +- src/smallmap_gui.cpp | 5 +++-- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index 414cfc0d0f..5e87ab838d 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -115,10 +115,20 @@ static void DrawClearLandFence(const TileInfo *ti) static void DrawTile_Clear(TileInfo *ti) { - ClearGround real_ground = GetClearGround(ti->tile); - ClearGround ground = IsSnowTile(ti->tile) ? CLEAR_SNOW : real_ground; + if (IsSnowTile(ti->tile)) { + uint8_t density = GetClearDensity(ti->tile); + DrawGroundSprite(_clear_land_sprites_snow_desert[density] + SlopeToSpriteOffset(ti->tileh), PAL_NONE); + if (GetClearGround(ti->tile) == CLEAR_ROCKS) { + /* There 4 levels of snowy overlay rocks, each with 19 sprites. */ + ++density; + DrawGroundSprite(SPR_OVERLAY_ROCKS_BASE + (density * 19) + SlopeToSpriteOffset(ti->tileh), PAL_NONE); + } - switch (ground) { + DrawBridgeMiddle(ti, {}); + return; + } + + switch (GetClearGround(ti->tile)) { case CLEAR_GRASS: DrawClearLandTile(ti, GetClearDensity(ti->tile)); break; @@ -141,17 +151,6 @@ static void DrawTile_Clear(TileInfo *ti) DrawClearLandFence(ti); break; - case CLEAR_SNOW: { - uint8_t density = GetClearDensity(ti->tile); - DrawGroundSprite(_clear_land_sprites_snow_desert[density] + SlopeToSpriteOffset(ti->tileh), PAL_NONE); - if (real_ground == CLEAR_ROCKS) { - /* There 4 levels of snowy overlay rocks, each with 19 sprites. */ - ++density; - DrawGroundSprite(SPR_OVERLAY_ROCKS_BASE + (density * 19) + SlopeToSpriteOffset(ti->tileh), PAL_NONE); - } - break; - } - case CLEAR_DESERT: DrawGroundSprite(_clear_land_sprites_snow_desert[GetClearDensity(ti->tile)] + SlopeToSpriteOffset(ti->tileh), PAL_NONE); break; @@ -376,7 +375,7 @@ static void GetTileDesc_Clear(TileIndex tile, TileDesc &td) {STR_LAI_CLEAR_DESCRIPTION_ROUGH_LAND, STR_LAI_CLEAR_DESCRIPTION_SNOWY_ROUGH_LAND}, {STR_LAI_CLEAR_DESCRIPTION_ROCKS, STR_LAI_CLEAR_DESCRIPTION_SNOWY_ROCKS}, {STR_LAI_CLEAR_DESCRIPTION_FIELDS, STR_EMPTY}, - {STR_EMPTY, STR_EMPTY}, // CLEAR_SNOW does not appear in the map. + {STR_EMPTY, STR_EMPTY}, // unused entry does not appear in the map. {STR_LAI_CLEAR_DESCRIPTION_DESERT, STR_EMPTY}, }; diff --git a/src/clear_map.h b/src/clear_map.h index 756e8957c4..e6eef46c7e 100644 --- a/src/clear_map.h +++ b/src/clear_map.h @@ -21,7 +21,6 @@ enum ClearGround : uint8_t { CLEAR_ROUGH = 1, ///< 3 CLEAR_ROCKS = 2, ///< 3 CLEAR_FIELDS = 3, ///< 3 - CLEAR_SNOW = 4, ///< 0-3 (Not stored in map.) CLEAR_DESERT = 5, ///< 1,3 }; diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 48f3dda30a..a5ae89463c 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -2433,7 +2433,7 @@ bool AfterLoadGame() if (IsSavegameVersionBefore(SLV_135)) { for (auto t : Map::Iterate()) { if (IsTileType(t, MP_CLEAR)) { - if (GetClearGround(t) == CLEAR_SNOW) { // CLEAR_SNOW becomes CLEAR_GRASS with IsSnowTile() set. + if (GetClearGround(t) == ClearGround{4}) { // CLEAR_SNOW becomes CLEAR_GRASS with IsSnowTile() set. SetClearGroundDensity(t, CLEAR_GRASS, GetClearDensity(t)); SetBit(t.m3(), 4); } else { diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index cdb71ab92f..7461b4c772 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -531,7 +531,7 @@ static const uint32_t _vegetation_clear_bits[] = { MKCOLOUR_XXXX(PC_ROUGH_LAND), ///< rough land MKCOLOUR_XXXX(PC_GREY), ///< rocks MKCOLOUR_XXXX(PC_FIELDS), ///< fields - MKCOLOUR_XXXX(PC_LIGHT_BLUE), ///< snow + MKCOLOUR_XXXX(PC_GRASS_LAND), ///< unused MKCOLOUR_XXXX(PC_ORANGE), ///< desert MKCOLOUR_XXXX(PC_GRASS_LAND), ///< unused MKCOLOUR_XXXX(PC_GRASS_LAND), ///< unused @@ -548,11 +548,12 @@ static inline uint32_t GetSmallMapVegetationPixels(TileIndex tile, TileType t) { switch (t) { case MP_CLEAR: + if (IsSnowTile(tile)) return MKCOLOUR_XXXX(PC_LIGHT_BLUE); if (IsClearGround(tile, CLEAR_GRASS)) { if (GetClearDensity(tile) < 3) return MKCOLOUR_XXXX(PC_BARE_LAND); if (GetTropicZone(tile) == TROPICZONE_RAINFOREST) return MKCOLOUR_XXXX(PC_RAINFOREST); } - return _vegetation_clear_bits[IsSnowTile(tile) ? CLEAR_SNOW : GetClearGround(tile)]; + return _vegetation_clear_bits[GetClearGround(tile)]; case MP_INDUSTRY: return IsTileForestIndustry(tile) ? MKCOLOUR_XXXX(PC_GREEN) : MKCOLOUR_XXXX(PC_DARK_RED);