From 06842771a8f3a778ec519725dd4f9eeff4dbc220 Mon Sep 17 00:00:00 2001 From: yexo Date: Tue, 5 Jan 2010 22:32:47 +0000 Subject: (svn r18738) -Fix (r18719): when a tree died while there was snow the amount of snow on the tile changed --- src/clear_map.h | 6 +++--- src/tree_cmd.cpp | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/clear_map.h b/src/clear_map.h index 0177e5f7f..f5c9271d2 100644 --- a/src/clear_map.h +++ b/src/clear_map.h @@ -310,14 +310,14 @@ static inline void MakeField(TileIndex t, uint field_type, IndustryID industry) * @param t the tile to make snowy * @pre GetClearGround(t) != CLEAR_SNOW */ -static inline void MakeSnow(TileIndex t) +static inline void MakeSnow(TileIndex t, uint density = 0) { assert(GetClearGround(t) != CLEAR_SNOW); SetBit(_m[t].m3, 4); if (GetClearGround(t) == CLEAR_FIELDS) { - SetClearGroundDensity(t, CLEAR_GRASS, 0); + SetClearGroundDensity(t, CLEAR_GRASS, density); } else { - SetClearDensity(t, 0); + SetClearDensity(t, density); } } diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index f0f149db7..2d0d5582d 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -702,16 +702,19 @@ static void TileLoop_Trees(TileIndex tile) case TREE_GROUND_SHORE: MakeShore(tile); break; case TREE_GROUND_GRASS: MakeClear(tile, CLEAR_GRASS, GetTreeDensity(tile)); break; case TREE_GROUND_ROUGH: MakeClear(tile, CLEAR_ROUGH, 3); break; - case TREE_GROUND_ROUGH_SNOW: + case TREE_GROUND_ROUGH_SNOW: { + uint density = GetTreeDensity(tile); MakeClear(tile, CLEAR_ROUGH, 3); - MakeSnow(tile); + MakeSnow(tile, density); break; + } default: // snow or desert if (_settings_game.game_creation.landscape == LT_TROPIC) { MakeClear(tile, CLEAR_DESERT, GetTreeDensity(tile)); } else { - MakeClear(tile, CLEAR_GRASS, GetTreeDensity(tile)); - MakeSnow(tile); + uint density = GetTreeDensity(tile); + MakeClear(tile, CLEAR_GRASS, 3); + MakeSnow(tile, density); } break; } -- cgit v1.2.3-70-g09d2