Mercurial > hg > openttd
changeset 17959:f3113a29d867 draft
(svn r22768) -Add: progress bar updates for river building
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sat, 20 Aug 2011 14:15:40 +0000 |
parents | 586f6c8f1eba |
children | 605fe213e42c |
files | src/genworld.h src/genworld_gui.cpp src/landscape.cpp src/lang/english.txt |
diffstat | 4 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/genworld.h +++ b/src/genworld.h @@ -59,6 +59,7 @@ 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
--- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -411,6 +411,7 @@ 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; case GLAND_BORDERS_RANDOM: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOMIZE : STR_MAPGEN_BORDER_MANUAL); break; @@ -1233,6 +1234,7 @@ 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 @@ 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 */
--- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -1167,9 +1167,12 @@ 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<bool>(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;
--- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2367,6 +2367,7 @@ 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