Public Member Functions | Data Fields | Static Public Attributes

# AIDebugWindow Struct Reference

Window with everything an AI prints via ScriptLog. More...

Inheritance diagram for AIDebugWindow:

## Public Member Functions
ScriptLog::LogData * | GetLogPointer () const
| AIDebugWindow (const WindowDesc *desc, WindowNumber number)
| Constructor for the window.
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
virtual void | OnPaint ()
virtual void | SetStringParameters (int widget) const
virtual void | DrawWidget (const Rect &r, int widget) const
void | ChangeToAI (CompanyID show_ai)
| Change all settings to select another AI.
virtual void | OnClick (Point pt, int widget, int click_count)
virtual void | OnTimeout ()
virtual void | OnMouseLoop ()
virtual EventState | OnKeyPress (uint16 key, uint16 keycode)
virtual void | OnInvalidateData (int data=0, bool gui_scope=true)
| Some data on this window has become invalid.
virtual void | OnResize ()
## Data Fields
int | redraw_timer
| Timer for redrawing the window, otherwise it'll happen every tick.
int | last_vscroll_pos
| Last position of the scrolling.
bool | autoscroll
| Whether automatically scrolling should be enabled or not.
bool | show_break_box
| Whether the break/debug box is visible.
int | highlight_row
| The output row that matches the given string, or -1.
Scrollbar * | vscroll
| Cache of the vertical scrollbar.
## Static Public Attributes
static const int | top_offset = WD_FRAMERECT_TOP + 2
| Offset of the text at the top of the WID_AID_LOG_PANEL.
static const int | bottom_offset = WD_FRAMERECT_BOTTOM
| Offset of the text at the bottom of the WID_AID_LOG_PANEL.
static const unsigned int | MAX_BREAK_STR_STRING_LENGTH = 256
| Maximum length of the break string.
static CompanyID | ai_debug_company = INVALID_COMPANY
| The AI that is (was last) being debugged.
static bool | break_check_enabled = true
| 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 = false
| Is the matching done case-sensitive.

## Detailed Description

Window with everything an AI prints via ScriptLog.

Definition at line 885 of file ai_gui.cpp.

## Constructor & Destructor Documentation

AIDebugWindow::AIDebugWindow | ( | const WindowDesc * | desc,
|  | WindowNumber | number |
| ) |  |  | `[inline]`

Constructor for the window.

Parameters:

  | desc | The description of the window.
  | number | The window number (actually unused).

Definition at line 913 of file ai_gui.cpp.

References _settings_client, ai_debug_company, GUISettings::ai_developer_tools, autoscroll, break_check_enabled, break_string, case_sensitive_break_check, COMPANY_FIRST, Window::CreateNestedTree(), Window::DisableWidget(), QueryStringBaseWindow::edit_str_buf, QueryStringBaseWindow::edit_str_size, Window::EnableWidget(), Window::FinishInitNested(), Window::GetScrollbar(), ClientSettings::gui, highlight_row, InitializeTextBuffer(), INVALID_COMPANY, Company::IsValidAiID(), last_vscroll_pos, Window::LowerWidget(), MAX_BREAK_STR_STRING_LENGTH, OWNER_DEITY, Window::SetWidgetDisabledState(), Window::SetWidgetLoweredState(), show_break_box, strecpy(), SZSP_HORIZONTAL, UpdateTextBufferSize(), vscroll, WID_AID_BREAK_STR_ON_OFF_BTN, WID_AID_COMPANY_BUTTON_START, WID_AID_CONTINUE_BTN, WID_AID_MATCH_CASE_BTN, WID_AID_RELOAD_TOGGLE, WID_AID_SCRIPT_GAME, WID_AID_SCROLLBAR, and WID_AID_SETTINGS.

## Member Function Documentation

void AIDebugWindow::ChangeToAI | ( | CompanyID | show_ai | ) | `[inline]`

Change all settings to select another AI.

Parameters:

  | show_ai | The new AI to show.

Definition at line 1122 of file ai_gui.cpp.

References ai_debug_company, autoscroll, DeleteWindowByClass(), Scrollbar::GetPosition(), last_vscroll_pos, Window::LowerWidget(), OWNER_DEITY, Window::RaiseWidget(), Scrollbar::SetCount(), Window::SetDirty(), vscroll, WC_AI_SETTINGS, WID_AID_COMPANY_BUTTON_START, and WID_AID_SCRIPT_GAME.

Referenced by ShowAIDebugWindow().

virtual void AIDebugWindow::OnInvalidateData | ( | int | data = `0`,
|  | bool | gui_scope = `true` |
| ) |  |  | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | data | Information about the changed data.
  | gui_scope | Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See InvalidateWindowData() for details.

Definition at line 1220 of file ai_gui.cpp.

References _pause_mode, ai_debug_company, break_check_enabled, case_sensitive_break_check, CMD_PAUSE, Window::DisableWidget(), DoCommandP(), QueryStringBaseWindow::edit_str_buf, Window::EnableWidget(), highlight_row, OWNER_DEITY, PM_PAUSED_NORMAL, PM_UNPAUSED, Window::SetDirty(), Window::SetWidgetDirty(), StrEmpty(), AI::Suspend(), WID_AID_CONTINUE_BTN, and WID_AID_LOG_PANEL.

The documentation for this struct was generated from the following file:

- src/ai/ai_gui.cpp