File diff r14931:fdc0797fe626 → r14932:86cf482b8249
src/ai/ai_gui.cpp
Show inline comments
 
@@ -683,49 +683,49 @@ enum AIDebugWindowWidgets {
 
	AID_WIDGET_SCROLLBAR,
 
	AID_WIDGET_COMPANY_BUTTON_START,
 
	AID_WIDGET_COMPANY_BUTTON_END = AID_WIDGET_COMPANY_BUTTON_START + 14,
 
	AID_WIDGET_BREAK_STR_ON_OFF_BTN,
 
	AID_WIDGET_BREAK_STR_EDIT_BOX,
 
	AID_WIDGET_MATCH_CASE_BTN,
 
	AID_WIDGET_CONTINUE_BTN,
 
};
 

	
 
/**
 
 * Window with everything an AI prints via AILog.
 
 */
 
struct AIDebugWindow : public QueryStringBaseWindow {
 
	static const int top_offset;    ///< Offset of the text at the top of the #AID_WIDGET_LOG_PANEL.
 
	static const int bottom_offset; ///< Offset of the text at the bottom of the #AID_WIDGET_LOG_PANEL.
 

	
 
	static const unsigned int MAX_BREAK_STR_STRING_LENGTH = 256;
 

	
 
	static CompanyID ai_debug_company;
 
	int redraw_timer;
 
	int last_vscroll_pos;
 
	bool autoscroll;
 
	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 matchding done case-sensitive
 
	static bool case_sensitive_break_check;                ///< Is the matching done case-sensitive
 
	int highlight_row;                                     ///< The output row that matches the given string, or -1
 

	
 
	AIDebugWindow(const WindowDesc *desc, WindowNumber number) : QueryStringBaseWindow(MAX_BREAK_STR_STRING_LENGTH)
 
	{
 
		this->InitNested(desc, number);
 
		/* 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));
 
		}
 
		this->DisableWidget(AID_WIDGET_RELOAD_TOGGLE);
 
		this->DisableWidget(AID_WIDGET_SETTINGS);
 
		this->DisableWidget(AID_WIDGET_CONTINUE_BTN);
 

	
 
		this->last_vscroll_pos = 0;
 
		this->autoscroll = true;
 
		this->highlight_row = -1;
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, MAX_BREAK_STR_STRING_LENGTH);
 

	
 
		/* Restore the break string value from static variable */
 
		strecpy(this->edit_str_buf, this->break_string, this->edit_str_buf + MAX_BREAK_STR_STRING_LENGTH);
 
		UpdateTextBufferSize(&this->text);
 

	
 
		/* Restore button state from static class variables */
 
		if (ai_debug_company != INVALID_COMPANY) this->LowerWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);