From 8c9cc415e3eac6a7709f6a8978f213311416312e Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 25 May 2008 22:36:44 +0000 Subject: (svn r13255) -Codechange: move _opt to _settings. --- src/settings_gui.cpp | 62 ++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'src/settings_gui.cpp') diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 63173d811..7b2fbdaef 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -142,11 +142,11 @@ static void ShowTownnameDropdown(Window *w, int sel) static void ShowCustCurrency(); struct GameOptionsWindow : Window { - GameOptions *opt; + Settings *opt; GameOptionsWindow(const WindowDesc *desc) : Window(desc) { - this->opt = (_game_mode == GM_MENU) ? &_opt_newgame : &_opt; + this->opt = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings; this->FindWindowPlacementAndResize(desc); } @@ -162,11 +162,11 @@ struct GameOptionsWindow : Window { this->SetWidgetDisabledState(GAMEOPT_VEHICLENAME_SAVE, !(_vehicle_design_names & 1)); if (!this->IsWidgetDisabled(GAMEOPT_VEHICLENAME_SAVE)) str = STR_02BF_CUSTOM; SetDParam(0, str); - SetDParam(1, _currency_specs[this->opt->currency].name); - SetDParam(2, STR_UNITS_IMPERIAL + this->opt->units); - SetDParam(3, STR_02E9_DRIVE_ON_LEFT + this->opt->road_side); - SetDParam(4, TownName(this->opt->town_name)); - SetDParam(5, _autosave_dropdown[this->opt->autosave]); + SetDParam(1, _currency_specs[this->opt->gui.currency].name); + SetDParam(2, STR_UNITS_IMPERIAL + this->opt->gui.units); + SetDParam(3, STR_02E9_DRIVE_ON_LEFT + this->opt->vehicle.road_side); + SetDParam(4, TownName(this->opt->game_creation.town_name)); + SetDParam(5, _autosave_dropdown[this->opt->gui.autosave]); SetDParam(6, SPECSTR_LANGUAGE_START + _dynlang.curr); int i = GetCurRes(); SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i); @@ -181,11 +181,11 @@ struct GameOptionsWindow : Window { { switch (widget) { case GAMEOPT_CURRENCY_BTN: // Setup currencies dropdown - ShowDropDownMenu(this, BuildCurrencyDropdown(), this->opt->currency, GAMEOPT_CURRENCY_BTN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0); + ShowDropDownMenu(this, BuildCurrencyDropdown(), this->opt->gui.currency, GAMEOPT_CURRENCY_BTN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0); break; case GAMEOPT_DISTANCE_BTN: // Setup distance unit dropdown - ShowDropDownMenu(this, _units_dropdown, this->opt->units, GAMEOPT_DISTANCE_BTN, 0, 0); + ShowDropDownMenu(this, _units_dropdown, this->opt->gui.units, GAMEOPT_DISTANCE_BTN, 0, 0); break; case GAMEOPT_ROADSIDE_BTN: { // Setup road-side dropdown @@ -195,18 +195,18 @@ struct GameOptionsWindow : Window { /* You can only change the drive side if you are in the menu or ingame with * no vehicles present. In a networking game only the server can change it */ if ((_game_mode != GM_MENU && RoadVehiclesAreBuilt()) || (_networking && !_network_server)) { - i = (-1) ^ (1 << this->opt->road_side); // disable the other value + i = (-1) ^ (1 << this->opt->vehicle.road_side); // disable the other value } - ShowDropDownMenu(this, _driveside_dropdown, this->opt->road_side, GAMEOPT_ROADSIDE_BTN, i, 0); + ShowDropDownMenu(this, _driveside_dropdown, this->opt->vehicle.road_side, GAMEOPT_ROADSIDE_BTN, i, 0); } break; case GAMEOPT_TOWNNAME_BTN: // Setup townname dropdown - ShowTownnameDropdown(this, this->opt->town_name); + ShowTownnameDropdown(this, this->opt->game_creation.town_name); break; case GAMEOPT_AUTOSAVE_BTN: // Setup autosave dropdown - ShowDropDownMenu(this, _autosave_dropdown, this->opt->autosave, GAMEOPT_AUTOSAVE_BTN, 0, 0); + ShowDropDownMenu(this, _autosave_dropdown, this->opt->gui.autosave, GAMEOPT_AUTOSAVE_BTN, 0, 0); break; case GAMEOPT_VEHICLENAME_BTN: // Setup customized vehicle-names dropdown @@ -265,17 +265,17 @@ struct GameOptionsWindow : Window { case GAMEOPT_CURRENCY_BTN: /* Currency */ if (index == CUSTOM_CURRENCY_ID) ShowCustCurrency(); - this->opt->currency = index; + this->opt->gui.currency = index; MarkWholeScreenDirty(); break; case GAMEOPT_DISTANCE_BTN: // Measuring units - this->opt->units = index; + this->opt->gui.units = index; MarkWholeScreenDirty(); break; case GAMEOPT_ROADSIDE_BTN: // Road side - if (this->opt->road_side != index) { // only change if setting changed + if (this->opt->vehicle.road_side != index) { // only change if setting changed DoCommandP(0, index, 0, NULL, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_00B4_CAN_T_DO_THIS)); MarkWholeScreenDirty(); } @@ -283,13 +283,13 @@ struct GameOptionsWindow : Window { case GAMEOPT_TOWNNAME_BTN: // Town names if (_game_mode == GM_MENU) { - this->opt->town_name = index; + this->opt->game_creation.town_name = index; InvalidateWindow(WC_GAME_OPTIONS, 0); } break; case GAMEOPT_AUTOSAVE_BTN: // Autosave options - _opt.autosave = _opt_newgame.autosave = index; + _settings.gui.autosave = _settings.gui.autosave = index; this->SetDirty(); break; @@ -416,7 +416,7 @@ static const GDType _default_game_diff[3][GAME_DIFFICULTY_NUM] = { /* {7, 0, 3, 3, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, ///< hard }; -void SetDifficultyLevel(int mode, GameOptions *gm_opt) +void SetDifficultyLevel(int mode, DifficultySettings *gm_opt) { int i; assert(mode <= 3); @@ -424,7 +424,7 @@ void SetDifficultyLevel(int mode, GameOptions *gm_opt) gm_opt->diff_level = mode; if (mode != 3) { // not custom for (i = 0; i != GAME_DIFFICULTY_NUM; i++) - ((GDType*)&gm_opt->diff)[i] = _default_game_diff[mode][i]; + ((GDType*)gm_opt)[i] = _default_game_diff[mode][i]; } } @@ -434,11 +434,11 @@ void SetDifficultyLevel(int mode, GameOptions *gm_opt) */ void CheckDifficultyLevels() { - if (_opt_newgame.diff_level != 3) { - SetDifficultyLevel(_opt_newgame.diff_level, &_opt_newgame); + if (_settings_newgame.difficulty.diff_level != 3) { + SetDifficultyLevel(_settings_newgame.difficulty.diff_level, &_settings_newgame.difficulty); } else { for (uint i = 0; i < GAME_DIFFICULTY_NUM; i++) { - GDType *diff = ((GDType*)&_opt_newgame.diff) + i; + GDType *diff = ((GDType*)&_settings_newgame.difficulty) + i; *diff = Clamp(*diff, _game_setting_info[i].min, _game_setting_info[i].max); *diff -= *diff % _game_setting_info[i].step; } @@ -479,7 +479,7 @@ private: uint8 timeout; /* Temporary holding place of values in the difficulty window until 'Save' is clicked */ - GameOptions opt_mod_temp; + DifficultySettings opt_mod_temp; enum { GAMEDIFF_WND_TOP_OFFSET = 45, @@ -510,7 +510,7 @@ public: { /* Copy current settings (ingame or in intro) to temporary holding place * change that when setting stuff, copy back on clicking 'OK' */ - this->opt_mod_temp = (_game_mode == GM_MENU) ? _opt_newgame : _opt; + this->opt_mod_temp = (_game_mode == GM_MENU) ? _settings_newgame.difficulty : _settings.difficulty; this->clicked_increase = false; this->clicked_button = NO_SETTINGS_BUTTON; this->timeout = 0; @@ -549,7 +549,7 @@ public: int y = GAMEDIFF_WND_TOP_OFFSET; for (uint i = 0; i != GAME_DIFFICULTY_NUM; i++) { const GameSettingData *gsd = &_game_setting_info[i]; - value = ((GDType*)&this->opt_mod_temp.diff)[i]; + value = ((GDType*)&this->opt_mod_temp)[i]; DrawArrowButtons(5, y, 3, (this->clicked_button == i) ? 1 + !!this->clicked_increase : 0, @@ -587,7 +587,7 @@ public: this->timeout = 5; - int16 val = ((GDType*)&this->opt_mod_temp.diff)[btn]; + int16 val = ((GDType*)&this->opt_mod_temp)[btn]; const GameSettingData *info = &_game_setting_info[btn]; // get information about the difficulty setting if (x >= 10) { @@ -603,7 +603,7 @@ public: this->clicked_button = btn; /* save value in temporary variable */ - ((GDType*)&this->opt_mod_temp.diff)[btn] = val; + ((GDType*)&this->opt_mod_temp)[btn] = val; this->RaiseWidget(GDW_LVL_EASY + this->opt_mod_temp.diff_level); SetDifficultyLevel(3, &this->opt_mod_temp); // set difficulty level to custom this->LowerWidget(GDW_LVL_CUSTOM); @@ -627,11 +627,11 @@ public: case GDW_ACCEPT: { // Save button - save changes GDType btn, val; - GameOptions *opt_ptr = (_game_mode == GM_MENU) ? &_opt_newgame : &_opt; + Settings *opt_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings; for (btn = 0; btn != GAME_DIFFICULTY_NUM; btn++) { - val = ((GDType*)&this->opt_mod_temp.diff)[btn]; + val = ((GDType*)&this->opt_mod_temp)[btn]; /* if setting has changed, change it */ - if (val != ((GDType*)&opt_ptr->diff)[btn]) { + if (val != ((GDType*)&opt_ptr->difficulty)[btn]) { DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); } } -- cgit v1.2.3-70-g09d2