Changeset - r28373:6d6dc72d078c
[Not reviewed]
master
0 2 0
Loïc Guilloux - 4 months ago 2023-12-31 23:43:10
glx22@users.noreply.github.com
Fix: Missing invalidations on gui.ai_developer_tools change (#11664)
2 files changed with 8 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/script/script_gui.cpp
Show inline comments
 
@@ -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 &&
src/table/settings/gui_settings.ini
Show inline comments
 
@@ -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]
0 comments (0 inline, 0 general)