Fix: Missing invalidations on gui.ai_developer_tools change (#11664)

wip-string
Loïc Guilloux 5 months ago committed by GitHub
parent 3e2060f155
commit f56a2d0f82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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<NWidgetStacked>(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<NWidgetStacked>(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 &&

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

Loading…
Cancel
Save