summaryrefslogtreecommitdiff
path: root/src/ai/ai_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-03-13 21:32:40 +0000
committerfrosch <frosch@openttd.org>2011-03-13 21:32:40 +0000
commit0ff4f31723c22a53dec3c44de64b0385355e972d (patch)
tree6ead66655cbaef300833fb180d3fb01d57d2d44f /src/ai/ai_gui.cpp
parent51ddbbb13d3c6277dcd04289623efe6e00e4f1b3 (diff)
downloadopenttd-0ff4f31723c22a53dec3c44de64b0385355e972d.tar.xz
(svn r22243) -Codechange: Make AIDebugWindow::OnInvalidateData() handle command-/GUI-scope itself.
Diffstat (limited to 'src/ai/ai_gui.cpp')
-rw-r--r--src/ai/ai_gui.cpp8
1 files changed, 4 insertions, 4 deletions
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<CompanyByte> cur_company(_current_company, ai_debug_company, FILE_LINE);
AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer();