summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-10-11 15:40:53 +0000
committerbelugas <belugas@openttd.org>2007-10-11 15:40:53 +0000
commit0bedd88870c67a747c720ecd9fc65bed700d8a45 (patch)
tree945701c87ddb670e1afe79e4f42a51cc490703ef /src
parent8b7f864c2dbe193ad043762697e7b1f6021cc030 (diff)
downloadopenttd-0bedd88870c67a747c720ecd9fc65bed700d8a45.tar.xz
(svn r11246) -Codechange: beautify some conditions from "if else" into trinary operator
Diffstat (limited to 'src')
-rw-r--r--src/tree_cmd.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index 062670066..a901143a3 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -511,10 +511,8 @@ static void GetTileDesc_Trees(TileIndex tile, TileDesc *td)
if (IS_INT_INSIDE(tt, TREE_RAINFOREST, TREE_CACTUS)) {
td->str = STR_280F_RAINFOREST;
- } else if (tt == TREE_CACTUS) {
- td->str = STR_2810_CACTUS_PLANTS;
} else {
- td->str = STR_280E_TREES;
+ td->str = tt == TREE_CACTUS ? STR_2810_CACTUS_PLANTS : STR_280E_TREES;
}
td->owner = GetTileOwner(tile);
@@ -661,8 +659,7 @@ static void TileLoop_Trees(TileIndex tile)
case TREE_GROUND_GRASS: MakeClear(tile, CLEAR_GRASS, GetTreeDensity(tile)); break;
case TREE_GROUND_ROUGH: MakeClear(tile, CLEAR_ROUGH, 3); break;
default: // snow or desert
- if (_opt.landscape == LT_TROPIC) MakeClear(tile, CLEAR_DESERT, GetTreeDensity(tile));
- else MakeClear(tile, CLEAR_SNOW, GetTreeDensity(tile));
+ MakeClear(tile, _opt.landscape == LT_TROPIC ? CLEAR_DESERT : CLEAR_SNOW, GetTreeDensity(tile));
break;
}
}
@@ -690,7 +687,7 @@ void OnTick_Trees()
!IsBridgeAbove(tile) &&
(ct = GetClearGround(tile), ct == CLEAR_GRASS || ct == CLEAR_ROUGH) &&
(tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TREE_INVALID) {
- MakeTree(tile, tree, 0, 0, ct == CLEAR_ROUGH ? TREE_GROUND_ROUGH : TREE_GROUND_GRASS, GetClearDensity(tile));
+ MakeTree(tile, tree, 0, 0, ct == CLEAR_ROUGH ? TREE_GROUND_ROUGH : TREE_GROUND_GRASS, GetClearDensity(tile));
}
/* byte underflow */