summaryrefslogtreecommitdiff
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
commit91cf35f7cf1d3e73f4dffbe2243fed9e9c7933a1 (patch)
tree945701c87ddb670e1afe79e4f42a51cc490703ef
parent87cac26fc049857e0aabdb91de6026a649c9d04f (diff)
downloadopenttd-91cf35f7cf1d3e73f4dffbe2243fed9e9c7933a1.tar.xz
(svn r11246) -Codechange: beautify some conditions from "if else" into trinary operator
-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 */