From dc5b8020ccd41053f440371ccaa290ca7a2632b9 Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Sun, 27 Dec 2020 14:05:47 +0000 Subject: Fix #6452: Reset only editable and visible settings from GUI (#7890) Also enables the Reset button while in-game for AI configs. --- src/ai/ai_gui.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/ai') diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index f1ee03fc1..9e16ec3ec 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -315,8 +315,6 @@ struct AISettingsWindow : public Window { this->vscroll = this->GetScrollbar(WID_AIS_SCROLLBAR); this->FinishInitNested(slot); // Initializes 'this->line_height' as side effect. - this->SetWidgetDisabledState(WID_AIS_RESET, _game_mode != GM_MENU && Company::IsValidID(this->slot)); - this->RebuildVisibleSettings(); } @@ -524,10 +522,8 @@ struct AISettingsWindow : public Window { break; case WID_AIS_RESET: - if (_game_mode == GM_MENU || !Company::IsValidID(this->slot)) { - this->ai_config->ResetSettings(); - this->SetDirty(); - } + this->ai_config->ResetEditableSettings(_game_mode == GM_MENU || ((this->slot != OWNER_DEITY) && !Company::IsValidID(this->slot))); + this->SetDirty(); break; } } -- cgit v1.2.3-70-g09d2