diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ai/ai_gui.cpp | 29 | ||||
-rw-r--r-- | src/settings_type.h | 1 | ||||
-rw-r--r-- | src/table/settings.h | 1 |
3 files changed, 21 insertions, 10 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 46ba4a686..609168414 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -683,6 +683,7 @@ enum AIDebugWindowWidgets { AID_WIDGET_SCROLLBAR, AID_WIDGET_COMPANY_BUTTON_START, AID_WIDGET_COMPANY_BUTTON_END = AID_WIDGET_COMPANY_BUTTON_START + 14, + AID_BREAK_STRING_WIDGETS, AID_WIDGET_BREAK_STR_ON_OFF_BTN, AID_WIDGET_BREAK_STR_EDIT_BOX, AID_WIDGET_MATCH_CASE_BTN, @@ -702,6 +703,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { int redraw_timer; int last_vscroll_pos; bool autoscroll; + bool show_break_box; static bool break_check_enabled; ///< Stop an AI when it prints a matching string static char break_string[MAX_BREAK_STR_STRING_LENGTH]; ///< The string to match to the AI output static bool case_sensitive_break_check; ///< Is the matching done case-sensitive @@ -709,7 +711,12 @@ struct AIDebugWindow : public QueryStringBaseWindow { AIDebugWindow(const WindowDesc *desc, WindowNumber number) : QueryStringBaseWindow(MAX_BREAK_STR_STRING_LENGTH) { - this->InitNested(desc, number); + this->CreateNestedTree(desc); + this->show_break_box = _settings_client.gui.ai_developer_tools; + this->GetWidget<NWidgetStacked>(AID_BREAK_STRING_WIDGETS)->SetDisplayedPlane(this->show_break_box ? 0 : SZSP_HORIZONTAL); + this->FinishInitNested(desc, number); + + if (!this->show_break_box) break_check_enabled = false; /* Disable the companies who are not active or not an AI */ for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { this->SetWidgetDisabledState(i + AID_WIDGET_COMPANY_BUTTON_START, !Company::IsValidAiID(i)); @@ -777,7 +784,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { if (this->IsShaded()) return; // Don't draw anything when the window is shaded. - this->DrawEditBox(AID_WIDGET_BREAK_STR_EDIT_BOX); + if (this->show_break_box) this->DrawEditBox(AID_WIDGET_BREAK_STR_EDIT_BOX); /* If there are no active companies, don't display anything else. */ if (ai_debug_company == INVALID_COMPANY) return; @@ -1100,16 +1107,18 @@ static const NWidgetPart _nested_ai_debug_widgets[] = { NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_LOG_PANEL), SetMinimalSize(287, 180), SetResize(1, 1), EndContainer(), /* Break string widgets */ - NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN_2, COLOUR_GREY, AID_WIDGET_BREAK_STR_ON_OFF_BTN), SetFill(0, 1), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_AI_DEBUG_BREAK_STR_ON_OFF_TOOLTIP), - NWidget(WWT_PANEL, COLOUR_GREY), - NWidget(NWID_HORIZONTAL), - NWidget(WWT_LABEL, COLOUR_GREY), SetPadding(2, 2, 2, 4), SetDataTip(STR_AI_DEBUG_BREAK_ON_LABEL, 0x0), - NWidget(WWT_EDITBOX, COLOUR_WHITE, AID_WIDGET_BREAK_STR_EDIT_BOX), SetFill(1, 1), SetResize(1, 0), SetPadding(2, 2, 2, 2), SetDataTip(STR_AI_DEBUG_BREAK_STR_OSKTITLE, STR_AI_DEBUG_BREAK_STR_TOOLTIP), + NWidget(NWID_SELECTION, INVALID_COLOUR, AID_BREAK_STRING_WIDGETS), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_IMGBTN_2, COLOUR_GREY, AID_WIDGET_BREAK_STR_ON_OFF_BTN), SetFill(0, 1), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_AI_DEBUG_BREAK_STR_ON_OFF_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_LABEL, COLOUR_GREY), SetPadding(2, 2, 2, 4), SetDataTip(STR_AI_DEBUG_BREAK_ON_LABEL, 0x0), + NWidget(WWT_EDITBOX, COLOUR_WHITE, AID_WIDGET_BREAK_STR_EDIT_BOX), SetFill(1, 1), SetResize(1, 0), SetPadding(2, 2, 2, 2), SetDataTip(STR_AI_DEBUG_BREAK_STR_OSKTITLE, STR_AI_DEBUG_BREAK_STR_TOOLTIP), + EndContainer(), EndContainer(), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_MATCH_CASE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_MATCH_CASE, STR_AI_DEBUG_MATCH_CASE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_CONTINUE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_CONTINUE, STR_AI_DEBUG_CONTINUE_TOOLTIP), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_MATCH_CASE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_MATCH_CASE, STR_AI_DEBUG_MATCH_CASE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_CONTINUE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_CONTINUE, STR_AI_DEBUG_CONTINUE_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), diff --git a/src/settings_type.h b/src/settings_type.h index ce116c3e1..0caca95ed 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -109,6 +109,7 @@ struct GUISettings { uint8 developer; ///< print non-fatal warnings in console (>= 1), copy debug output to console (== 2) bool show_date_in_logs; ///< whether to show dates in console logs bool newgrf_developer_tools; ///< activate NewGRF developer tools + bool ai_developer_tools; ///< activate AI developer tools }; /** Settings related to currency/unit systems. */ diff --git a/src/table/settings.h b/src/table/settings.h index a820c5081..c4eba3ded 100644 --- a/src/table/settings.h +++ b/src/table/settings.h @@ -606,6 +606,7 @@ const SettingDesc _settings[] = { #endif SDTC_VAR(gui.developer, SLE_UINT8, S, 0, 1, 0, 2, 0, STR_NULL, NULL), SDTC_BOOL(gui.newgrf_developer_tools, S, 0, false, STR_NULL, NULL), + SDTC_BOOL(gui.ai_developer_tools, S, 0, false, STR_NULL, NULL), SDTC_VAR(gui.console_backlog_timeout, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL), SDTC_VAR(gui.console_backlog_length, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL), #ifdef ENABLE_NETWORK |