[Scummvm-cvs-logs] CVS: scummvm/base engine.cpp,1.28,1.29

Max Horn fingolfin at users.sourceforge.net
Sat Dec 25 11:05:05 CET 2004


Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18924/base

Modified Files:
	engine.cpp 
Log Message:
Get rid of g_debugLevel (this fixes bug #1091142)

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/engine.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- engine.cpp	12 Dec 2004 00:02:44 -0000	1.28
+++ engine.cpp	25 Dec 2004 19:04:18 -0000	1.29
@@ -32,8 +32,6 @@
 /* FIXME - BIG HACK for MidiEmu */
 Engine *g_engine = 0;
 
-uint16 g_debugLevel = 0;
-
 Engine::Engine(OSystem *syst)
 	: _system(syst), _gameDataPath(ConfMan.get("path")) {
 	g_engine = this;
@@ -44,8 +42,6 @@
 	// Add default file directory
 	File::addDefaultDirectory(_gameDataPath);
 
-	g_debugLevel = ConfMan.getInt("debuglevel");
-
 	_saveFileMan = _system->getSavefileManager();
 }
 
@@ -162,16 +158,7 @@
 #endif
 }
 
-void CDECL debug(int level, const char *s, ...) {
-	char buf[STRINGBUFLEN];
-	va_list va;
-
-	if (level > g_debugLevel)
-		return;
-
-	va_start(va, s);
-	vsprintf(buf, s, va);
-	va_end(va);
+static void debugHelper(const char *buf) {
 #ifndef _WIN32_WCE
 	printf("%s\n", buf);
 #endif
@@ -190,27 +177,29 @@
 	fflush(stdout);
 }
 
-void CDECL debug(const char *s, ...) {
+void CDECL debug(int level, const char *s, ...) {
 	char buf[STRINGBUFLEN];
 	va_list va;
 
+	if (level > ConfMan.getInt("debuglevel"))
+		return;
+
 	va_start(va, s);
 	vsprintf(buf, s, va);
 	va_end(va);
-	printf("%s\n", buf);
+	
+	debugHelper(buf);
+}
 
-#if defined( USE_WINDBG )
-	strcat(buf, "\n");
-#if defined( _WIN32_WCE )
-	TCHAR buf_unicode[1024];
-	MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode));
-	OutputDebugString(buf_unicode);
-#else
-	OutputDebugString(buf);
-#endif
-#endif
+void CDECL debug(const char *s, ...) {
+	char buf[STRINGBUFLEN];
+	va_list va;
 
-	fflush(stdout);
+	va_start(va, s);
+	vsprintf(buf, s, va);
+	va_end(va);
+
+	debugHelper(buf);
 }
 
 void checkHeap() {





More information about the Scummvm-git-logs mailing list