aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPaweł Kołodziejski2002-09-18 10:56:23 +0000
committerPaweł Kołodziejski2002-09-18 10:56:23 +0000
commite6352e3a32b5382c5f215e3fafa3b28654768f04 (patch)
tree8e5eebfea2528551b3b13cfaea1a5689bb288a67 /common
parent462d26937c17961834e4226add1766d273ecd517 (diff)
downloadscummvm-rg350-e6352e3a32b5382c5f215e3fafa3b28654768f04.tar.gz
scummvm-rg350-e6352e3a32b5382c5f215e3fafa3b28654768f04.tar.bz2
scummvm-rg350-e6352e3a32b5382c5f215e3fafa3b28654768f04.zip
moved warning, debug, checkheap to engine
svn-id: r4965
Diffstat (limited to 'common')
-rw-r--r--common/engine.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/common/engine.cpp b/common/engine.cpp
index 7aa9100f81..5352fd025c 100644
--- a/common/engine.cpp
+++ b/common/engine.cpp
@@ -103,3 +103,51 @@ Engine *Engine::createFromDetector(GameDetector *detector, OSystem *syst)
return engine;
}
+
+void CDECL warning(const char *s, ...)
+{
+ char buf[1024];
+ va_list va;
+
+ va_start(va, s);
+ vsprintf(buf, s, va);
+ va_end(va);
+
+ fprintf(stderr, "WARNING: %s!\n", buf);
+#if defined( USE_WINDBG )
+ sprintf(&buf[strlen(buf)], "\n");
+ OutputDebugString(buf);
+#endif
+}
+
+uint16 _debugLevel = 1;
+
+void CDECL debug(int level, const char *s, ...)
+{
+ char buf[1024];
+ va_list va;
+
+ if (level > _debugLevel)
+ return;
+
+ va_start(va, s);
+ vsprintf(buf, s, va);
+ va_end(va);
+ printf("%s\n", buf);
+
+#if defined( USE_WINDBG )
+ sprintf(&buf[strlen(buf)], "\n");
+ OutputDebugString(buf);
+#endif
+
+ fflush(stdout);
+}
+
+void checkHeap()
+{
+#if defined(WIN32)
+ if (_heapchk() != _HEAPOK) {
+ error("Heap is invalid!");
+ }
+#endif
+}