1
0
Fork 0

(svn r18851) -Codechange: enumify number of steps needed to generate landscape

release/1.0
smatz 2010-01-17 21:40:35 +00:00
parent 3850b5912f
commit 2469752559
1 changed files with 12 additions and 8 deletions

View File

@ -857,23 +857,31 @@ static void CreateDesertOrRainForest()
void GenerateLandscape(byte mode) 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) { 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); LoadHeightmap(_file_to_saveload.name);
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE); IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
} else if (_settings_game.game_creation.land_generator == LG_TERRAGENESIS) { } 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(); GenerateTerrainPerlin();
} else { } else {
SetGeneratingWorldProgress(GWP_LANDSCAPE, steps + GLS_ORIGINAL);
if (_settings_game.construction.freeform_edges) { if (_settings_game.construction.freeform_edges) {
for (uint x = 0; x < MapSizeX(); x++) MakeVoid(TileXY(x, 0)); for (uint x = 0; x < MapSizeX(); x++) MakeVoid(TileXY(x, 0));
for (uint y = 0; y < MapSizeY(); y++) MakeVoid(TileXY(0, y)); for (uint y = 0; y < MapSizeY(); y++) MakeVoid(TileXY(0, y));
} }
switch (_settings_game.game_creation.landscape) { switch (_settings_game.game_creation.landscape) {
case LT_ARCTIC: { case LT_ARCTIC: {
SetGeneratingWorldProgress(GWP_LANDSCAPE, 2);
uint32 r = Random(); uint32 r = Random();
for (uint i = ScaleByMapSize(GB(r, 0, 7) + 950); i != 0; --i) { for (uint i = ScaleByMapSize(GB(r, 0, 7) + 950); i != 0; --i) {
@ -887,8 +895,6 @@ void GenerateLandscape(byte mode)
} break; } break;
case LT_TROPIC: { case LT_TROPIC: {
SetGeneratingWorldProgress(GWP_LANDSCAPE, 2 + gwp_desert_amount);
uint32 r = Random(); uint32 r = Random();
for (uint i = ScaleByMapSize(GB(r, 0, 7) + 170); i != 0; --i) { for (uint i = ScaleByMapSize(GB(r, 0, 7) + 170); i != 0; --i) {
@ -908,8 +914,6 @@ void GenerateLandscape(byte mode)
} break; } break;
default: { default: {
SetGeneratingWorldProgress(GWP_LANDSCAPE, 2);
uint32 r = Random(); uint32 r = Random();
uint i = ScaleByMapSize(GB(r, 0, 7) + (3 - _settings_game.difficulty.quantity_sea_lakes) * 256 + 100); uint i = ScaleByMapSize(GB(r, 0, 7) + (3 - _settings_game.difficulty.quantity_sea_lakes) * 256 + 100);