[Scummvm-cvs-logs] SF.net SVN: scummvm:[53610] scummvm/trunk/engines/sword25

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Oct 19 11:44:48 CEST 2010


Revision: 53610
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53610&view=rev
Author:   fingolfin
Date:     2010-10-19 09:44:48 +0000 (Tue, 19 Oct 2010)

Log Message:
-----------
SWORD25: Simplify log listener code (and get rid of another global constructor)

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/kernel/log.cpp
    scummvm/trunk/engines/sword25/kernel/log.h
    scummvm/trunk/engines/sword25/sword25.cpp

Modified: scummvm/trunk/engines/sword25/kernel/log.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/log.cpp	2010-10-19 09:44:29 UTC (rev 53609)
+++ scummvm/trunk/engines/sword25/kernel/log.cpp	2010-10-19 09:44:48 UTC (rev 53610)
@@ -52,7 +52,6 @@
 const char                                     *BS_Log::_File = NULL;
 int                                             BS_Log::_Line = 0;
 bool                                            BS_Log::_AutoNewline = false;
-Common::Array<BS_Log::LOG_LISTENER_CALLBACK>    BS_Log::_LogListener;
 
 bool BS_Log::_CreateLog() {
 	// Open the log file
@@ -185,11 +184,10 @@
 }
 
 int BS_Log::_WriteLog(const char *Message) {
-	if (!_LogFile) if (!_CreateLog()) return false;
+	if (!_LogFile && !_CreateLog())
+		return false;
 
-	Common::Array<LOG_LISTENER_CALLBACK>::iterator Iter = _LogListener.begin();
-	for (; Iter != _LogListener.end(); ++Iter)
-		(*Iter)(Message);
+	debugN(0, "%s", Message);
 
 	_LogFile->writeString(Message);
 

Modified: scummvm/trunk/engines/sword25/kernel/log.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/log.h	2010-10-19 09:44:29 UTC (rev 53609)
+++ scummvm/trunk/engines/sword25/kernel/log.h	2010-10-19 09:44:48 UTC (rev 53610)
@@ -76,18 +76,6 @@
 		_AutoNewline = AutoNewline;
 	}
 
-	typedef void (*LOG_LISTENER_CALLBACK)(const char *);
-	static void RegisterLogListener(LOG_LISTENER_CALLBACK Callback) {
-		_LogListener.push_back(Callback);
-	}
-	static bool IsListenerRegistered(LOG_LISTENER_CALLBACK Callback) {
-		Common::Array<LOG_LISTENER_CALLBACK>::iterator i;
-		for (i = _LogListener.begin(); i != _LogListener.end(); ++i) {
-			if (**i == Callback)
-				return true;
-		}
-		return false;
-	}
 	static void _CloseLog();
 
 private:
@@ -97,7 +85,6 @@
 	static const char                          *_File;
 	static int                                  _Line;
 	static bool                                 _AutoNewline;
-	static Common::Array<LOG_LISTENER_CALLBACK> _LogListener;
 
 	static bool _CreateLog();
 

Modified: scummvm/trunk/engines/sword25/sword25.cpp
===================================================================
--- scummvm/trunk/engines/sword25/sword25.cpp	2010-10-19 09:44:29 UTC (rev 53609)
+++ scummvm/trunk/engines/sword25/sword25.cpp	2010-10-19 09:44:48 UTC (rev 53610)
@@ -53,10 +53,6 @@
 const char *const PACKAGE_MANAGER = "archiveFS";
 const char *const DEFAULT_SCRIPT_FILE = "/system/boot.lua";
 
-void logToStdout(const char *Message) {
-	debugN(0, "%s", Message);
-}
-
 Sword25Engine::Sword25Engine(OSystem *syst, const ADGameDescription *gameDesc):
 	Engine(syst),
 	_gameDescription(gameDesc) {
@@ -87,9 +83,6 @@
 }
 
 Common::Error Sword25Engine::appStart() {
-	// All log messages will be sent to StdOut
-	BS_Log::RegisterLogListener(logToStdout);
-
 	// Initialise the graphics mode to ARGB8888
 	Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24);
 	initGraphics(800, 600, true, &format);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list