diff -r c5c9dc32c052 -r 6bdf79ffb022 src/genworld_gui.cpp --- a/src/genworld_gui.cpp Mon May 26 11:36:42 2008 +0000 +++ b/src/genworld_gui.cpp Mon May 26 13:52:59 2008 +0000 @@ -48,7 +48,7 @@ static inline void SetNewLandscapeType(byte landscape) { - _opt_newgame.landscape = landscape; + _settings_newgame.game_creation.landscape = landscape; InvalidateWindowClasses(WC_SELECT_GAME); InvalidateWindowClasses(WC_GENERATE_LANDSCAPE); } @@ -206,8 +206,6 @@ /* Copy all XXX_newgame to XXX when coming from outside the editor */ UpdatePatches(); - _opt = _opt_newgame; - _opt_ptr = &_opt; ResetGRFConfig(true); SndPlayFx(SND_15_BEEP); @@ -255,9 +253,9 @@ GenerateLandscapeWindow(const WindowDesc *desc, WindowNumber number = 0) : QueryStringBaseWindow(desc, number) { - this->LowerWidget(_opt_newgame.landscape + GLAND_TEMPERATE); + this->LowerWidget(_settings_newgame.game_creation.landscape + GLAND_TEMPERATE); - snprintf(this->edit_str_buf, sizeof(this->edit_str_buf), "%u", _patches_newgame.generation_seed); + snprintf(this->edit_str_buf, sizeof(this->edit_str_buf), "%u", _settings_newgame.game_creation.generation_seed); InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 120); this->caption = STR_NULL; this->afilter = CS_NUMERAL; @@ -271,49 +269,49 @@ { /* You can't select smoothness if not terragenesis */ if (mode == GLWP_GENERATE) { - this->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _patches_newgame.land_generator == 0); + this->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _settings_newgame.game_creation.land_generator == 0); } /* Disable snowline if not hilly */ - this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_TEXT, _opt_newgame.landscape != LT_ARCTIC); + this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_TEXT, _settings_newgame.game_creation.landscape != LT_ARCTIC); /* Disable town, industry and trees in SE */ this->SetWidgetDisabledState(GLAND_TOWN_PULLDOWN, _game_mode == GM_EDITOR); this->SetWidgetDisabledState(GLAND_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR); this->SetWidgetDisabledState(GLAND_TREE_PULLDOWN, _game_mode == GM_EDITOR); - this->SetWidgetDisabledState(GLAND_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR); - this->SetWidgetDisabledState(GLAND_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR); - this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _patches_newgame.snow_line_height <= 2 || _opt_newgame.landscape != LT_ARCTIC); - this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP, _patches_newgame.snow_line_height >= MAX_SNOWLINE_HEIGHT || _opt_newgame.landscape != LT_ARCTIC); + this->SetWidgetDisabledState(GLAND_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR); + this->SetWidgetDisabledState(GLAND_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR); + this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _settings_newgame.game_creation.snow_line_height <= 2 || _settings_newgame.game_creation.landscape != LT_ARCTIC); + this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP, _settings_newgame.game_creation.snow_line_height >= MAX_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC); - this->SetWidgetLoweredState(GLAND_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE); - this->SetWidgetLoweredState(GLAND_ARCTIC, _opt_newgame.landscape == LT_ARCTIC); - this->SetWidgetLoweredState(GLAND_TROPICAL, _opt_newgame.landscape == LT_TROPIC); - this->SetWidgetLoweredState(GLAND_TOYLAND, _opt_newgame.landscape == LT_TOYLAND); + this->SetWidgetLoweredState(GLAND_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); + this->SetWidgetLoweredState(GLAND_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC); + this->SetWidgetLoweredState(GLAND_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC); + this->SetWidgetLoweredState(GLAND_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND); if (_game_mode == GM_EDITOR) { this->widget[GLAND_TOWN_PULLDOWN].data = STR_6836_OFF; this->widget[GLAND_INDUSTRY_PULLDOWN].data = STR_6836_OFF; } else { - this->widget[GLAND_TOWN_PULLDOWN].data = _num_towns[_opt_newgame.diff.number_towns]; - this->widget[GLAND_INDUSTRY_PULLDOWN].data = _num_inds[_opt_newgame.diff.number_industries]; + this->widget[GLAND_TOWN_PULLDOWN].data = _num_towns[_settings_newgame.difficulty.number_towns]; + this->widget[GLAND_INDUSTRY_PULLDOWN].data = _num_inds[_settings_newgame.difficulty.number_industries]; } if (mode == GLWP_GENERATE) { - this->widget[GLAND_LANDSCAPE_PULLDOWN].data = _landscape[_patches_newgame.land_generator]; - this->widget[GLAND_TREE_PULLDOWN].data = _tree_placer[_patches_newgame.tree_placer]; - this->widget[GLAND_TERRAIN_PULLDOWN].data = _elevations[_opt_newgame.diff.terrain_type]; - this->widget[GLAND_WATER_PULLDOWN].data = _sea_lakes[_opt_newgame.diff.quantity_sea_lakes]; - this->widget[GLAND_SMOOTHNESS_PULLDOWN].data = _smoothness[_patches_newgame.tgen_smoothness]; + this->widget[GLAND_LANDSCAPE_PULLDOWN].data = _landscape[_settings_newgame.game_creation.land_generator]; + this->widget[GLAND_TREE_PULLDOWN].data = _tree_placer[_settings_newgame.game_creation.tree_placer]; + this->widget[GLAND_TERRAIN_PULLDOWN].data = _elevations[_settings_newgame.difficulty.terrain_type]; + this->widget[GLAND_WATER_PULLDOWN].data = _sea_lakes[_settings_newgame.difficulty.quantity_sea_lakes]; + this->widget[GLAND_SMOOTHNESS_PULLDOWN].data = _smoothness[_settings_newgame.game_creation.tgen_smoothness]; } else { - this->widget[GLAND_TREE_PULLDOWN].data = _tree_placer[_patches_newgame.tree_placer]; - this->widget[GLAND_HEIGHTMAP_ROTATION_PULLDOWN].data = _rotation[_patches_newgame.heightmap_rotation]; + this->widget[GLAND_TREE_PULLDOWN].data = _tree_placer[_settings_newgame.game_creation.tree_placer]; + this->widget[GLAND_HEIGHTMAP_ROTATION_PULLDOWN].data = _rotation[_settings_newgame.game_creation.heightmap_rotation]; } /* Set parameters for widget text that requires them. */ - SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); // GLAND_START_DATE_TEXT - SetDParam(1, 1 << _patches_newgame.map_x); // GLAND_MAPSIZE_X_PULLDOWN - SetDParam(2, 1 << _patches_newgame.map_y); // GLAND_MAPSIZE_Y_PULLDOWN - SetDParam(3, _patches_newgame.snow_line_height); // GLAND_SNOW_LEVEL_TEXT + SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); // GLAND_START_DATE_TEXT + SetDParam(1, 1 << _settings_newgame.game_creation.map_x); // GLAND_MAPSIZE_X_PULLDOWN + SetDParam(2, 1 << _settings_newgame.game_creation.map_y); // GLAND_MAPSIZE_Y_PULLDOWN + SetDParam(3, _settings_newgame.game_creation.snow_line_height); // GLAND_SNOW_LEVEL_TEXT this->DrawWidgets(); @@ -322,7 +320,7 @@ if (mode != GLWP_GENERATE) { char buffer[512]; - if (_patches_newgame.heightmap_rotation == HM_CLOCKWISE) { + if (_settings_newgame.game_creation.heightmap_rotation == HM_CLOCKWISE) { SetDParam(0, this->y); SetDParam(1, this->x); } else { @@ -347,29 +345,29 @@ case GLAND_ARCTIC: case GLAND_TROPICAL: case GLAND_TOYLAND: - this->RaiseWidget(_opt_newgame.landscape + GLAND_TEMPERATE); + this->RaiseWidget(_settings_newgame.game_creation.landscape + GLAND_TEMPERATE); SetNewLandscapeType(widget - GLAND_TEMPERATE); break; case GLAND_MAPSIZE_X_PULLDOWN: // Mapsize X - ShowDropDownList(this, BuildMapsizeDropDown(), _patches_newgame.map_x, GLAND_MAPSIZE_X_PULLDOWN); + ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, GLAND_MAPSIZE_X_PULLDOWN); break; case GLAND_MAPSIZE_Y_PULLDOWN: // Mapsize Y - ShowDropDownList(this, BuildMapsizeDropDown(), _patches_newgame.map_y, GLAND_MAPSIZE_Y_PULLDOWN); + ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, GLAND_MAPSIZE_Y_PULLDOWN); break; case GLAND_TOWN_PULLDOWN: // Number of towns - ShowDropDownMenu(this, _num_towns, _opt_newgame.diff.number_towns, GLAND_TOWN_PULLDOWN, 0, 0); + ShowDropDownMenu(this, _num_towns, _settings_newgame.difficulty.number_towns, GLAND_TOWN_PULLDOWN, 0, 0); break; case GLAND_INDUSTRY_PULLDOWN: // Number of industries - ShowDropDownMenu(this, _num_inds, _opt_newgame.diff.number_industries, GLAND_INDUSTRY_PULLDOWN, 0, 0); + ShowDropDownMenu(this, _num_inds, _settings_newgame.difficulty.number_industries, GLAND_INDUSTRY_PULLDOWN, 0, 0); break; case GLAND_RANDOM_BUTTON: // Random seed - _patches_newgame.generation_seed = InteractiveRandom(); - snprintf(this->edit_str_buf, lengthof(this->edit_str_buf), "%u", _patches_newgame.generation_seed); + _settings_newgame.game_creation.generation_seed = InteractiveRandom(); + snprintf(this->edit_str_buf, lengthof(this->edit_str_buf), "%u", _settings_newgame.game_creation.generation_seed); UpdateTextBufferSize(&this->text); this->SetDirty(); break; @@ -381,17 +379,17 @@ case GLAND_GENERATE_BUTTON: // Generate UpdatePatches(); - if (_patches.town_layout == TL_NO_ROADS) { + if (_settings.economy.town_layout == TL_NO_ROADS) { ShowQuery( STR_TOWN_LAYOUT_WARNING_CAPTION, STR_TOWN_LAYOUT_WARNING_MESSAGE, this, LandscapeGenerationCallback); } else if (mode == GLWP_HEIGHTMAP && - (this->x * 2 < (1U << _patches_newgame.map_x) || - this->x / 2 > (1U << _patches_newgame.map_x) || - this->y * 2 < (1U << _patches_newgame.map_y) || - this->y / 2 > (1U << _patches_newgame.map_y))) { + (this->x * 2 < (1U << _settings_newgame.game_creation.map_x) || + this->x / 2 > (1U << _settings_newgame.game_creation.map_x) || + this->y * 2 < (1U << _settings_newgame.game_creation.map_y) || + this->y / 2 > (1U << _settings_newgame.game_creation.map_y))) { ShowQuery( STR_HEIGHTMAP_SCALE_WARNING_CAPTION, STR_HEIGHTMAP_SCALE_WARNING_MESSAGE, @@ -409,14 +407,14 @@ this->HandleButtonClick(widget); this->SetDirty(); - _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); + _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); } _left_button_clicked = false; break; case GLAND_START_DATE_TEXT: // Year text this->widget_id = GLAND_START_DATE_TEXT; - SetDParam(0, _patches_newgame.starting_year); + SetDParam(0, _settings_newgame.game_creation.starting_year); ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL); break; @@ -427,40 +425,40 @@ this->HandleButtonClick(widget); this->SetDirty(); - _patches_newgame.snow_line_height = Clamp(_patches_newgame.snow_line_height + widget - GLAND_SNOW_LEVEL_TEXT, 2, MAX_SNOWLINE_HEIGHT); + _settings_newgame.game_creation.snow_line_height = Clamp(_settings_newgame.game_creation.snow_line_height + widget - GLAND_SNOW_LEVEL_TEXT, 2, MAX_SNOWLINE_HEIGHT); } _left_button_clicked = false; break; case GLAND_SNOW_LEVEL_TEXT: // Snow line text this->widget_id = GLAND_SNOW_LEVEL_TEXT; - SetDParam(0, _patches_newgame.snow_line_height); + SetDParam(0, _settings_newgame.game_creation.snow_line_height); ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_SNOW_LINE_QUERY_CAPT, 3, 100, this, CS_NUMERAL); break; case GLAND_TREE_PULLDOWN: // Tree placer - ShowDropDownMenu(this, _tree_placer, _patches_newgame.tree_placer, GLAND_TREE_PULLDOWN, 0, 0); + ShowDropDownMenu(this, _tree_placer, _settings_newgame.game_creation.tree_placer, GLAND_TREE_PULLDOWN, 0, 0); break; case GLAND_LANDSCAPE_PULLDOWN: // Landscape generator OR Heightmap rotation /* case GLAND_HEIGHTMAP_ROTATION_TEXT: case GLAND_HEIGHTMAP_ROTATION_PULLDOWN:*/ if (mode == GLWP_HEIGHTMAP) { - ShowDropDownMenu(this, _rotation, _patches_newgame.heightmap_rotation, GLAND_HEIGHTMAP_ROTATION_PULLDOWN, 0, 0); + ShowDropDownMenu(this, _rotation, _settings_newgame.game_creation.heightmap_rotation, GLAND_HEIGHTMAP_ROTATION_PULLDOWN, 0, 0); } else { - ShowDropDownMenu(this, _landscape, _patches_newgame.land_generator, GLAND_LANDSCAPE_PULLDOWN, 0, 0); + ShowDropDownMenu(this, _landscape, _settings_newgame.game_creation.land_generator, GLAND_LANDSCAPE_PULLDOWN, 0, 0); } break; case GLAND_TERRAIN_PULLDOWN: // Terrain type - ShowDropDownMenu(this, _elevations, _opt_newgame.diff.terrain_type, GLAND_TERRAIN_PULLDOWN, 0, 0); + ShowDropDownMenu(this, _elevations, _settings_newgame.difficulty.terrain_type, GLAND_TERRAIN_PULLDOWN, 0, 0); break; case GLAND_WATER_PULLDOWN: // Water quantity - ShowDropDownMenu(this, _sea_lakes, _opt_newgame.diff.quantity_sea_lakes, GLAND_WATER_PULLDOWN, 0, 0); + ShowDropDownMenu(this, _sea_lakes, _settings_newgame.difficulty.quantity_sea_lakes, GLAND_WATER_PULLDOWN, 0, 0); break; case GLAND_SMOOTHNESS_PULLDOWN: // Map smoothness - ShowDropDownMenu(this, _smoothness, _patches_newgame.tgen_smoothness, GLAND_SMOOTHNESS_PULLDOWN, 0, 0); + ShowDropDownMenu(this, _smoothness, _settings_newgame.game_creation.tgen_smoothness, GLAND_SMOOTHNESS_PULLDOWN, 0, 0); break; } } @@ -479,49 +477,49 @@ * (use random seed) it should not be possible to be * entered into the input field; the generate seed * button can be used instead. */ - _patches_newgame.generation_seed = minu(strtoul(this->edit_str_buf, NULL, sizeof(this->edit_str_buf) - 1), MAX_UVALUE(uint32) - 1); + _settings_newgame.game_creation.generation_seed = minu(strtoul(this->edit_str_buf, NULL, sizeof(this->edit_str_buf) - 1), MAX_UVALUE(uint32) - 1); return state; } virtual void OnDropdownSelect(int widget, int index) { switch (widget) { - case GLAND_MAPSIZE_X_PULLDOWN: _patches_newgame.map_x = index; break; - case GLAND_MAPSIZE_Y_PULLDOWN: _patches_newgame.map_y = index; break; - case GLAND_TREE_PULLDOWN: _patches_newgame.tree_placer = index; break; - case GLAND_SMOOTHNESS_PULLDOWN: _patches_newgame.tgen_smoothness = index; break; + case GLAND_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break; + case GLAND_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break; + case GLAND_TREE_PULLDOWN: _settings_newgame.game_creation.tree_placer = index; break; + case GLAND_SMOOTHNESS_PULLDOWN: _settings_newgame.game_creation.tgen_smoothness = index; break; case GLAND_TOWN_PULLDOWN: - _opt_newgame.diff.number_towns = index; - if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); - DoCommandP(0, 2, _opt_newgame.diff.number_towns, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); + _settings_newgame.difficulty.number_towns = index; + if (_settings_newgame.difficulty.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); + IConsoleSetPatchSetting("difficulty.number_towns", _settings_newgame.difficulty.number_towns); break; case GLAND_INDUSTRY_PULLDOWN: - _opt_newgame.diff.number_industries = index; - if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); - DoCommandP(0, 3, _opt_newgame.diff.number_industries, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); + _settings_newgame.difficulty.number_industries = index; + if (_settings_newgame.difficulty.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); + IConsoleSetPatchSetting("difficulty.number_industries", _settings_newgame.difficulty.number_industries); break; case GLAND_LANDSCAPE_PULLDOWN: /* case GLAND_HEIGHTMAP_PULLDOWN: */ if (mode == GLWP_HEIGHTMAP) { - _patches_newgame.heightmap_rotation = index; + _settings_newgame.game_creation.heightmap_rotation = index; } else { - _patches_newgame.land_generator = index; + _settings_newgame.game_creation.land_generator = index; } break; case GLAND_TERRAIN_PULLDOWN: - _opt_newgame.diff.terrain_type = index; - if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); - DoCommandP(0, 12, _opt_newgame.diff.terrain_type, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); + _settings_newgame.difficulty.terrain_type = index; + if (_settings_newgame.difficulty.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); + IConsoleSetPatchSetting("difficulty.terrain_type", _settings_newgame.difficulty.terrain_type); break; case GLAND_WATER_PULLDOWN: - _opt_newgame.diff.quantity_sea_lakes = index; - if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); - DoCommandP(0, 13, _opt_newgame.diff.quantity_sea_lakes, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); + _settings_newgame.difficulty.quantity_sea_lakes = index; + if (_settings_newgame.difficulty.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); + IConsoleSetPatchSetting("difficulty.quantity_sea_lakes", _settings_newgame.difficulty.quantity_sea_lakes); break; } this->SetDirty(); @@ -535,12 +533,12 @@ switch (this->widget_id) { case GLAND_START_DATE_TEXT: this->InvalidateWidget(GLAND_START_DATE_TEXT); - _patches_newgame.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR); + _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR); break; case GLAND_SNOW_LEVEL_TEXT: this->InvalidateWidget(GLAND_SNOW_LEVEL_TEXT); - _patches_newgame.snow_line_height = Clamp(value, 2, MAX_SNOWLINE_HEIGHT); + _settings_newgame.game_creation.snow_line_height = Clamp(value, 2, MAX_SNOWLINE_HEIGHT); break; } @@ -571,7 +569,7 @@ DeleteWindowByClass(WC_GENERATE_LANDSCAPE); /* Always give a new seed if not editor */ - if (_game_mode != GM_EDITOR) _patches_newgame.generation_seed = InteractiveRandom(); + if (_game_mode != GM_EDITOR) _settings_newgame.game_creation.generation_seed = InteractiveRandom(); if (mode == GLWP_HEIGHTMAP) { /* If the function returns negative, it means there was a problem loading the heightmap */ @@ -601,8 +599,8 @@ void StartScenarioEditor() { - if (_patches_newgame.town_layout == TL_NO_ROADS) { - _patches_newgame.town_layout = TL_ORIGINAL; + if (_settings_newgame.economy.town_layout == TL_NO_ROADS) { + _settings_newgame.economy.town_layout = TL_ORIGINAL; } StartGeneratingLandscape(GLWP_SCENARIO); @@ -611,7 +609,7 @@ void StartNewGameWithoutGUI(uint seed) { /* GenerateWorld takes care of the possible GENERATE_NEW_SEED value in 'seed' */ - _patches_newgame.generation_seed = seed; + _settings_newgame.game_creation.generation_seed = seed; StartGeneratingLandscape(GLWP_GENERATE); } @@ -644,26 +642,27 @@ CreateScenarioWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) { - this->LowerWidget(_opt_newgame.landscape + CSCEN_TEMPERATE); + this->LowerWidget(_settings_newgame.game_creation.landscape + CSCEN_TEMPERATE); + this->FindWindowPlacementAndResize(desc); } virtual void OnPaint() { - this->SetWidgetDisabledState(CSCEN_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR); - this->SetWidgetDisabledState(CSCEN_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR); - this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_DOWN, _patches_newgame.se_flat_world_height <= 0); - this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_UP, _patches_newgame.se_flat_world_height >= MAX_TILE_HEIGHT); + this->SetWidgetDisabledState(CSCEN_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR); + this->SetWidgetDisabledState(CSCEN_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR); + this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_DOWN, _settings_newgame.game_creation.se_flat_world_height <= 0); + this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_UP, _settings_newgame.game_creation.se_flat_world_height >= MAX_TILE_HEIGHT); - this->SetWidgetLoweredState(CSCEN_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE); - this->SetWidgetLoweredState(CSCEN_ARCTIC, _opt_newgame.landscape == LT_ARCTIC); - this->SetWidgetLoweredState(CSCEN_TROPICAL, _opt_newgame.landscape == LT_TROPIC); - this->SetWidgetLoweredState(CSCEN_TOYLAND, _opt_newgame.landscape == LT_TOYLAND); + this->SetWidgetLoweredState(CSCEN_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); + this->SetWidgetLoweredState(CSCEN_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC); + this->SetWidgetLoweredState(CSCEN_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC); + this->SetWidgetLoweredState(CSCEN_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND); /* Set parameters for widget text that requires them */ - SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); // CSCEN_START_DATE_TEXT - SetDParam(1, 1 << _patches_newgame.map_x); // CSCEN_MAPSIZE_X_PULLDOWN - SetDParam(2, 1 << _patches_newgame.map_y); // CSCEN_MAPSIZE_Y_PULLDOWN - SetDParam(3, _patches_newgame.se_flat_world_height); // CSCEN_FLAT_LAND_HEIGHT_TEXT + SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); // CSCEN_START_DATE_TEXT + SetDParam(1, 1 << _settings_newgame.game_creation.map_x); // CSCEN_MAPSIZE_X_PULLDOWN + SetDParam(2, 1 << _settings_newgame.game_creation.map_y); // CSCEN_MAPSIZE_Y_PULLDOWN + SetDParam(3, _settings_newgame.game_creation.se_flat_world_height); // CSCEN_FLAT_LAND_HEIGHT_TEXT this->DrawWidgets(); } @@ -675,16 +674,16 @@ case CSCEN_ARCTIC: case CSCEN_TROPICAL: case CSCEN_TOYLAND: - this->RaiseWidget(_opt_newgame.landscape + CSCEN_TEMPERATE); + this->RaiseWidget(_settings_newgame.game_creation.landscape + CSCEN_TEMPERATE); SetNewLandscapeType(widget - CSCEN_TEMPERATE); break; case CSCEN_MAPSIZE_X_PULLDOWN: // Mapsize X - ShowDropDownList(this, BuildMapsizeDropDown(), _patches_newgame.map_x, CSCEN_MAPSIZE_X_PULLDOWN); + ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, CSCEN_MAPSIZE_X_PULLDOWN); break; case CSCEN_MAPSIZE_Y_PULLDOWN: // Mapsize Y - ShowDropDownList(this, BuildMapsizeDropDown(), _patches_newgame.map_y, CSCEN_MAPSIZE_Y_PULLDOWN); + ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, CSCEN_MAPSIZE_Y_PULLDOWN); break; case CSCEN_EMPTY_WORLD: // Empty world / flat world @@ -702,14 +701,14 @@ this->HandleButtonClick(widget); this->SetDirty(); - _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + widget - CSCEN_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); + _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - CSCEN_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); } _left_button_clicked = false; break; case CSCEN_START_DATE_TEXT: // Year text this->widget_id = CSCEN_START_DATE_TEXT; - SetDParam(0, _patches_newgame.starting_year); + SetDParam(0, _settings_newgame.game_creation.starting_year); ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL); break; @@ -720,14 +719,14 @@ this->HandleButtonClick(widget); this->SetDirty(); - _patches_newgame.se_flat_world_height = Clamp(_patches_newgame.se_flat_world_height + widget - CSCEN_FLAT_LAND_HEIGHT_TEXT, 0, MAX_TILE_HEIGHT); + _settings_newgame.game_creation.se_flat_world_height = Clamp(_settings_newgame.game_creation.se_flat_world_height + widget - CSCEN_FLAT_LAND_HEIGHT_TEXT, 0, MAX_TILE_HEIGHT); } _left_button_clicked = false; break; case CSCEN_FLAT_LAND_HEIGHT_TEXT: // Height level text this->widget_id = CSCEN_FLAT_LAND_HEIGHT_TEXT; - SetDParam(0, _patches_newgame.se_flat_world_height); + SetDParam(0, _settings_newgame.game_creation.se_flat_world_height); ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 100, this, CS_NUMERAL); break; } @@ -736,8 +735,8 @@ virtual void OnDropdownSelect(int widget, int index) { switch (widget) { - case CSCEN_MAPSIZE_X_PULLDOWN: _patches_newgame.map_x = index; break; - case CSCEN_MAPSIZE_Y_PULLDOWN: _patches_newgame.map_y = index; break; + case CSCEN_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break; + case CSCEN_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break; } this->SetDirty(); } @@ -750,12 +749,12 @@ switch (this->widget_id) { case CSCEN_START_DATE_TEXT: this->InvalidateWidget(CSCEN_START_DATE_TEXT); - _patches_newgame.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR); + _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR); break; case CSCEN_FLAT_LAND_HEIGHT_TEXT: this->InvalidateWidget(CSCEN_FLAT_LAND_HEIGHT_TEXT); - _patches_newgame.se_flat_world_height = Clamp(value, 0, MAX_TILE_HEIGHT); + _settings_newgame.game_creation.se_flat_world_height = Clamp(value, 0, MAX_TILE_HEIGHT); break; } @@ -850,7 +849,10 @@ }; public: - GenerateProgressWindow() : Window(&_generate_progress_desc) {}; + GenerateProgressWindow() : Window(&_generate_progress_desc) + { + this->FindWindowPlacementAndResize(&_generate_progress_desc); + } virtual void OnClick(Point pt, int widget) {