summaryrefslogtreecommitdiff
path: root/src/gamelog.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-07-18 12:11:46 +0000
committersmatz <smatz@openttd.org>2008-07-18 12:11:46 +0000
commit927507818fa96f341b30d5dd4229261ca476d437 (patch)
treefd97455e5c3dfbe3674411dd9562d66e1acecdd3 /src/gamelog.cpp
parent69cb2f088feb3549c63ddb747ee11c781b49e86c (diff)
downloadopenttd-927507818fa96f341b30d5dd4229261ca476d437.tar.xz
(svn r13727) -Fix (r13375): compilation with NO_DEBUG_MESSAGES was broken
Diffstat (limited to 'src/gamelog.cpp')
-rw-r--r--src/gamelog.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gamelog.cpp b/src/gamelog.cpp
index 11b651851..f612f8951 100644
--- a/src/gamelog.cpp
+++ b/src/gamelog.cpp
@@ -114,10 +114,12 @@ void GamelogStopAction()
{
assert(_gamelog_action_type != GLAT_NONE); // nobody should try to stop if there is no action in progress
+ bool print = _current_action != NULL;
+
_current_action = NULL;
_gamelog_action_type = GLAT_NONE;
- if (_debug_gamelog_level > 4) GamelogPrintDebug();
+ if (print) GamelogPrintDebug(5);
}
/** Resets and frees all memory allocated - used before loading or starting a new game
@@ -318,14 +320,22 @@ void GamelogPrintConsole()
GamelogPrint(&GamelogPrintConsoleProc);
}
+static int _gamelog_print_level = 0; ///< gamelog debug level we need to print stuff
static void GamelogPrintDebugProc(const char *s)
{
- debug_print("gamelog", s);
+ DEBUG(gamelog, _gamelog_print_level, s);
}
-void GamelogPrintDebug()
+
+/** Prints gamelog to debug output. Code is executed even when
+ * there will be no output. It is called very seldom, so it
+ * doesn't matter that much. At least it gives more uniform code...
+ * @param level debug level we need to print stuff
+ */
+void GamelogPrintDebug(int level)
{
+ _gamelog_print_level = level;
GamelogPrint(&GamelogPrintDebugProc);
}