# HG changeset patch # User smatz # Date 2010-01-17 21:40:35 # Node ID b0f61213c576bed666dcd33c8c994bae890fd6c7 # Parent 9ef79780929ba6a1fd347f56fa5b4337f7b1dc1a (svn r18851) -Codechange: enumify number of steps needed to generate landscape diff --git a/src/landscape.cpp b/src/landscape.cpp --- 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);