From 11a4e402c60c07b734e74db8e4bf7b18c7267d7a Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 20 Aug 2011 14:15:40 +0000 Subject: (svn r22768) -Add: progress bar updates for river building --- src/genworld.h | 1 + src/genworld_gui.cpp | 6 ++++-- src/landscape.cpp | 5 ++++- src/lang/english.txt | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/genworld.h b/src/genworld.h index af8965caf..535da923b 100644 --- a/src/genworld.h +++ b/src/genworld.h @@ -59,6 +59,7 @@ struct GenWorldInfo { enum GenWorldProgress { GWP_MAP_INIT, ///< Initialize/allocate the map, start economy GWP_LANDSCAPE, ///< Create the landscape + GWP_RIVER, ///< Create the rivers GWP_ROUGH_ROCKY, ///< Make rough and rocky areas GWP_TOWN, ///< Generate towns GWP_INDUSTRY, ///< Generate industries diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 440e88b0d..0987a2157 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -410,6 +410,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { } break; + case GLAND_RIVER_PULLDOWN: SetDParam(0, _rivers[_settings_newgame.game_creation.amount_of_rivers]); break; case GLAND_RIVER_PULLDOWN: SetDParam(0, _rivers[_settings_newgame.game_creation.amount_of_rivers]); break; case GLAND_SMOOTHNESS_PULLDOWN: SetDParam(0, _smoothness[_settings_newgame.game_creation.tgen_smoothness]); break; case GLAND_VARIETY_PULLDOWN: SetDParam(0, _variety[_settings_newgame.game_creation.variety]); break; @@ -1233,6 +1234,7 @@ static GenWorldStatus _gws; static const StringID _generation_class_table[] = { STR_GENERATION_WORLD_GENERATION, STR_SCENEDIT_TOOLBAR_LANDSCAPE_GENERATION, + STR_GENERATION_RIVER_GENERATION, STR_GENERATION_CLEARING_TILES, STR_SCENEDIT_TOOLBAR_TOWN_GENERATION, STR_SCENEDIT_TOOLBAR_INDUSTRY_GENERATION, @@ -1343,8 +1345,8 @@ void ShowGenerateWorldProgress() static void _SetGeneratingWorldProgress(GenWorldProgress cls, uint progress, uint total) { - static const int percent_table[GWP_CLASS_COUNT + 1] = {0, 5, 15, 20, 40, 60, 65, 80, 85, 99, 100 }; - + static const int percent_table[] = {0, 5, 14, 17, 20, 40, 60, 65, 80, 85, 99, 100 }; + assert_compile(lengthof(percent_table) == GWP_CLASS_COUNT + 1); assert(cls < GWP_CLASS_COUNT); /* Do not run this function if we aren't in a thread */ diff --git a/src/landscape.cpp b/src/landscape.cpp index 0aec2cc8c..35a00e1d2 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -1167,9 +1167,12 @@ static void CreateRivers() int amount = _settings_game.game_creation.amount_of_rivers; if (amount == 0) return; + uint wells = ScaleByMapSize(4 << _settings_game.game_creation.amount_of_rivers); + SetGeneratingWorldProgress(GWP_RIVER, wells); bool *marks = CallocT(MapSize()); - for (uint wells = ScaleByMapSize(4 << _settings_game.game_creation.amount_of_rivers); wells != 0; wells--) { + for (; wells != 0; wells--) { + IncreaseGeneratingWorldProgress(GWP_RIVER); for (int tries = 0; tries < 128; tries++) { TileIndex t = RandomTile(); if (!CircularTileSearch(&t, 8, FindSpring, NULL)) continue; diff --git a/src/lang/english.txt b/src/lang/english.txt index ff3de3157..3df8c33da 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2367,6 +2367,7 @@ STR_GENERATION_ABORT_MESSAGE :{YELLOW}Do you STR_GENERATION_PROGRESS :{WHITE}{NUM}% complete STR_GENERATION_PROGRESS_NUM :{BLACK}{NUM} / {NUM} STR_GENERATION_WORLD_GENERATION :{BLACK}World generation +STR_GENERATION_RIVER_GENERATION :{BLACK}River generation STR_GENERATION_TREE_GENERATION :{BLACK}Tree generation STR_GENERATION_OBJECT_GENERATION :{BLACK}Object generation STR_GENERATION_CLEARING_TILES :{BLACK}Rough and rocky area generation -- cgit v1.2.3-70-g09d2