diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index 8a8fa7b2ca331..429298de1da60 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -785,19 +785,14 @@ struct ScriptDebugWindow : public Window { this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_SCRD_VSCROLLBAR); this->hscroll = this->GetScrollbar(WID_SCRD_HSCROLLBAR); - this->show_break_box = _settings_client.gui.ai_developer_tools; - this->GetWidget(WID_SCRD_BREAK_STRING_WIDGETS)->SetDisplayedPlane(this->show_break_box ? 0 : SZSP_HORIZONTAL); this->FinishInitNested(number); - if (!this->show_break_box) this->filter.break_check_enabled = false; - this->last_vscroll_pos = 0; this->autoscroll = true; this->highlight_row = -1; this->querystrings[WID_SCRD_BREAK_STR_EDIT_BOX] = &this->break_editbox; - SetWidgetsDisabledState(!this->show_break_box, WID_SCRD_BREAK_STR_ON_OFF_BTN, WID_SCRD_BREAK_STR_EDIT_BOX, WID_SCRD_MATCH_CASE_BTN); this->hscroll->SetStepSize(10); // Speed up horizontal scrollbar /* Restore the break string value from static variable, and enable the filter. */ @@ -813,6 +808,11 @@ struct ScriptDebugWindow : public Window { void OnInit() override { + this->show_break_box = _settings_client.gui.ai_developer_tools; + this->GetWidget(WID_SCRD_BREAK_STRING_WIDGETS)->SetDisplayedPlane(this->show_break_box ? 0 : SZSP_HORIZONTAL); + if (!this->show_break_box) this->filter.break_check_enabled = false; + SetWidgetsDisabledState(!this->show_break_box, WID_SCRD_BREAK_STR_ON_OFF_BTN, WID_SCRD_BREAK_STR_EDIT_BOX, WID_SCRD_MATCH_CASE_BTN); + this->InvalidateData(-1); } @@ -1120,6 +1120,8 @@ struct ScriptDebugWindow : public Window { */ void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { + if (this->show_break_box != _settings_client.gui.ai_developer_tools) this->ReInit(); + /* If the log message is related to the active company tab, check the break string. * This needs to be done in gameloop-scope, so the AI is suspended immediately. */ if (!gui_scope && data == this->filter.script_debug_company && diff --git a/src/table/settings/gui_settings.ini b/src/table/settings/gui_settings.ini index 2986b25ebebfc..fa3eef9a9f545 100644 --- a/src/table/settings/gui_settings.ini +++ b/src/table/settings/gui_settings.ini @@ -796,7 +796,7 @@ cat = SC_EXPERT var = gui.ai_developer_tools flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC def = false -post_cb = [](auto) { InvalidateWindowClassesData(WC_SCRIPT_SETTINGS); } +post_cb = [](auto) { InvalidateWindowClassesData(WC_GAME_OPTIONS); InvalidateWindowClassesData(WC_SCRIPT_DEBUG); InvalidateWindowClassesData(WC_SCRIPT_SETTINGS); } cat = SC_EXPERT [SDTC_BOOL]