mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
Fix: Missing invalidations on gui.ai_developer_tools change (#11664)
This commit is contained in:
parent
3e2060f155
commit
f56a2d0f82
@ -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…
Reference in New Issue
Block a user