From 0ff4f31723c22a53dec3c44de64b0385355e972d Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 13 Mar 2011 21:32:40 +0000 Subject: (svn r22243) -Codechange: Make AIDebugWindow::OnInvalidateData() handle command-/GUI-scope itself. --- src/ai/ai_gui.cpp | 8 ++++---- src/ai/api/ai_log.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ai') diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index e16644d4f..339201a94 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -1057,10 +1057,9 @@ struct AIDebugWindow : public QueryStringBaseWindow { */ virtual void OnInvalidateData(int data = 0, bool gui_scope = true) { - if (!gui_scope) return; if (data == -1 || ai_debug_company == data) this->SetDirty(); - if (data == -2) { + if (gui_scope && data == -2) { /* The continue button should be disabled when the game is unpaused and * it was previously paused by the break string ( = a line in the log * was highlighted )*/ @@ -1072,8 +1071,9 @@ struct AIDebugWindow : public QueryStringBaseWindow { } } - /* If the log message is related to the active company tab, check the break string */ - if (data == ai_debug_company && this->break_check_enabled && !StrEmpty(this->edit_str_buf)) { + /* 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 == ai_debug_company && this->break_check_enabled && !StrEmpty(this->edit_str_buf)) { /* Get the log instance of the active company */ Backup cur_company(_current_company, ai_debug_company, FILE_LINE); AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer(); diff --git a/src/ai/api/ai_log.cpp b/src/ai/api/ai_log.cpp index af2295df1..7a269030d 100644 --- a/src/ai/api/ai_log.cpp +++ b/src/ai/api/ai_log.cpp @@ -75,7 +75,7 @@ /* Also still print to debug window */ DEBUG(ai, level, "[%d] [%c] %s", (uint)_current_company, logc, log->lines[log->pos]); - InvalidateWindowData(WC_AI_DEBUG, 0, _current_company, true); // breakpoint handling needs calling Invalidate immediately. + InvalidateWindowData(WC_AI_DEBUG, 0, _current_company); } /* static */ void AILog::FreeLogPointer() -- cgit v1.2.3-70-g09d2