summaryrefslogtreecommitdiff
path: root/src/tree_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-04 10:25:58 +0000
committerrubidium <rubidium@openttd.org>2011-11-04 10:25:58 +0000
commit69162621d81c82b832cccc8d59179fc0e4472af2 (patch)
tree84b0875823153321225331b2a4a5862a60fdc345 /src/tree_cmd.cpp
parentb167c0a3967a62b4cbe98a12f2c4d932ee8df510 (diff)
downloadopenttd-69162621d81c82b832cccc8d59179fc0e4472af2.tar.xz
(svn r23096) -Codechange: remove useless divisions and multiplications by TILE_HEIGHT for the snow line code
Diffstat (limited to 'src/tree_cmd.cpp')
-rw-r--r--src/tree_cmd.cpp10
1 files changed, 5 insertions, 5 deletions
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<uint>(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;