(svn r22768) -Add: progress bar updates for river building

This commit is contained in:
rubidium 2011-08-20 14:15:40 +00:00
parent 56fedc4db9
commit 21b1026ca0
4 changed files with 10 additions and 3 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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<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;

View File

@ -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