summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2010-01-17 21:40:35 +0000
committersmatz <smatz@openttd.org>2010-01-17 21:40:35 +0000
commit2469752559e0afd660f2828fb1490aa47b6da7ae (patch)
treef059d04a9245cd6e70a435ff979c43042ebb5905 /src
parent3850b5912f80250526b953da5bf6359199aabc85 (diff)
downloadopenttd-2469752559e0afd660f2828fb1490aa47b6da7ae.tar.xz
(svn r18851) -Codechange: enumify number of steps needed to generate landscape
Diffstat (limited to 'src')
-rw-r--r--src/landscape.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/landscape.cpp b/src/landscape.cpp
index c53f377ac..3d4cd5034 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -857,23 +857,31 @@ static void CreateDesertOrRainForest()
void GenerateLandscape(byte mode)
{
- static const int gwp_desert_amount = 4 + 8;
+ /** Number of steps of landscape generation */
+ enum GenLandscapeSteps {
+ GLS_HEIGHTMAP = 3, ///< Loading a heightmap
+ GLS_TERRAGENESIS = 5, ///< Terragenesis generator
+ GLS_ORIGINAL = 2, ///< Original generator
+ GLS_TROPIC = 12, ///< Extra steps needed for tropic landscape
+ GLS_OTHER = 0, ///< Extra steps for other landscapes
+ };
+ uint steps = (_settings_game.game_creation.landscape == LT_TROPIC) ? GLS_TROPIC : GLS_OTHER;
if (mode == GW_HEIGHTMAP) {
- SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings_game.game_creation.landscape == LT_TROPIC) ? 3 + gwp_desert_amount : 3);
+ SetGeneratingWorldProgress(GWP_LANDSCAPE, steps + GLS_HEIGHTMAP);
LoadHeightmap(_file_to_saveload.name);
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
} else if (_settings_game.game_creation.land_generator == LG_TERRAGENESIS) {
- SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings_game.game_creation.landscape == LT_TROPIC) ? 5 + gwp_desert_amount : 5);
+ SetGeneratingWorldProgress(GWP_LANDSCAPE, steps + GLS_TERRAGENESIS);
GenerateTerrainPerlin();
} else {
+ SetGeneratingWorldProgress(GWP_LANDSCAPE, steps + GLS_ORIGINAL);
if (_settings_game.construction.freeform_edges) {
for (uint x = 0; x < MapSizeX(); x++) MakeVoid(TileXY(x, 0));
for (uint y = 0; y < MapSizeY(); y++) MakeVoid(TileXY(0, y));
}
switch (_settings_game.game_creation.landscape) {
case LT_ARCTIC: {
- SetGeneratingWorldProgress(GWP_LANDSCAPE, 2);
uint32 r = Random();
for (uint i = ScaleByMapSize(GB(r, 0, 7) + 950); i != 0; --i) {
@@ -887,8 +895,6 @@ void GenerateLandscape(byte mode)
} break;
case LT_TROPIC: {
- SetGeneratingWorldProgress(GWP_LANDSCAPE, 2 + gwp_desert_amount);
-
uint32 r = Random();
for (uint i = ScaleByMapSize(GB(r, 0, 7) + 170); i != 0; --i) {
@@ -908,8 +914,6 @@ void GenerateLandscape(byte mode)
} break;
default: {
- SetGeneratingWorldProgress(GWP_LANDSCAPE, 2);
-
uint32 r = Random();
uint i = ScaleByMapSize(GB(r, 0, 7) + (3 - _settings_game.difficulty.quantity_sea_lakes) * 256 + 100);