From 69162621d81c82b832cccc8d59179fc0e4472af2 Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 4 Nov 2011 10:25:58 +0000 Subject: (svn r23096) -Codechange: remove useless divisions and multiplications by TILE_HEIGHT for the snow line code --- src/tree_cmd.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/tree_cmd.cpp') diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index 238f551c9..e66649dde 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -232,7 +232,7 @@ static void PlaceTreeAtSameHeight(TileIndex tile, uint height) if (!CanPlantTreesOnTile(cur_tile, true)) continue; /* Not too much height difference */ - if (Delta(GetTilePixelZ(cur_tile), height) > 2) continue; + if (Delta(GetTileZ(cur_tile), height) > 2) continue; /* Place one tree and quit */ PlaceTree(cur_tile, r); @@ -264,9 +264,9 @@ void PlaceTreesRandomly() /* Place a number of trees based on the tile height. * This gives a cool effect of multiple trees close together. * It is almost real life ;) */ - ht = GetTilePixelZ(tile); + ht = GetTileZ(tile); /* The higher we get, the more trees we plant */ - j = GetTilePixelZ(tile) / TILE_HEIGHT * 2; + j = GetTileZ(tile) * 2; /* Above snowline more trees! */ if (_settings_game.game_creation.landscape == LT_ARCTIC && ht > GetSnowLine()) j *= 3; while (j--) { @@ -588,7 +588,7 @@ static void TileLoopTreesDesert(TileIndex tile) static void TileLoopTreesAlps(TileIndex tile) { - int k = GetTilePixelZ(tile) - GetSnowLine() + TILE_HEIGHT; + int k = GetTileZ(tile) - GetSnowLine() + 1; if (k < 0) { switch (GetTreeGround(tile)) { @@ -597,7 +597,7 @@ static void TileLoopTreesAlps(TileIndex tile) default: return; } } else { - uint density = min((uint)k / TILE_HEIGHT, 3); + uint density = min(k, 3); if (GetTreeGround(tile) != TREE_GROUND_SNOW_DESERT && GetTreeGround(tile) != TREE_GROUND_ROUGH_SNOW) { TreeGround tg = GetTreeGround(tile) == TREE_GROUND_ROUGH ? TREE_GROUND_ROUGH_SNOW : TREE_GROUND_SNOW_DESERT; -- cgit v1.2.3-54-g00ecf