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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Oct 23 17:44:33 CEST 2010


Revision: 53735
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53735&view=rev
Author:   fingolfin
Date:     2010-10-23 15:44:33 +0000 (Sat, 23 Oct 2010)

Log Message:
-----------
SWORD25: Register LUA callbacks insider registerScriptBindings() methods

Previously, the constructor of an anonymous global object was used to do
this, for no apparent reason.
However, maybe there was a hidden reason which I missed, so this change
might cause regressions. I.e., please test.

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp
    scummvm/trunk/engines/sword25/input/inputengine_script.cpp

Modified: scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp	2010-10-23 15:44:04 UTC (rev 53734)
+++ scummvm/trunk/engines/sword25/gfx/graphicengine_script.cpp	2010-10-23 15:44:33 UTC (rev 53735)
@@ -73,15 +73,6 @@
 
 static LuaCallback *loopPointCallbackPtr = 0;	// FIXME: should be turned into GraphicEngine member var
 static ActionCallback *actionCallbackPtr = 0;	// FIXME: should be turned into GraphicEngine member var
-
-struct CallbackfunctionRegisterer {
-	CallbackfunctionRegisterer() {
-		CallbackRegistry::instance().registerCallbackFunction("LuaLoopPointCB", (void ( *)(int))animationLoopPointCallback);
-		CallbackRegistry::instance().registerCallbackFunction("LuaActionCB", (void ( *)(int))animationActionCallback);
-		CallbackRegistry::instance().registerCallbackFunction("LuaDeleteCB", (void ( *)(int))animationDeleteCallback);
-	}
-};
-static CallbackfunctionRegisterer Instance;
 }
 
 // Die Strings werden als #defines definiert um Stringkomposition zur Compilezeit zu erm\xF6glichen.
@@ -1295,6 +1286,10 @@
 	assert(actionCallbackPtr == 0);
 	actionCallbackPtr = new ActionCallback(L);
 
+	CallbackRegistry::instance().registerCallbackFunction("LuaLoopPointCB", (void ( *)(int))animationLoopPointCallback);
+	CallbackRegistry::instance().registerCallbackFunction("LuaActionCB", (void ( *)(int))animationActionCallback);
+	CallbackRegistry::instance().registerCallbackFunction("LuaDeleteCB", (void ( *)(int))animationDeleteCallback);
+
 	return true;
 }
 

Modified: scummvm/trunk/engines/sword25/input/inputengine_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/input/inputengine_script.cpp	2010-10-23 15:44:04 UTC (rev 53734)
+++ scummvm/trunk/engines/sword25/input/inputengine_script.cpp	2010-10-23 15:44:33 UTC (rev 53735)
@@ -83,13 +83,6 @@
 
 static CommandCallbackClass *commandCallbackPtr = 0;	// FIXME: should be turned into InputEngine member var
 
-struct CallbackfunctionRegisterer {
-	CallbackfunctionRegisterer() {
-		CallbackRegistry::instance().registerCallbackFunction("LuaCommandCB", theCommandCallback);
-		CallbackRegistry::instance().registerCallbackFunction("LuaCharacterCB", theCharacterCallback);
-	}
-};
-static CallbackfunctionRegisterer instance;
 }
 
 static InputEngine *getIE() {
@@ -298,6 +291,9 @@
 	assert(commandCallbackPtr == 0);
 	commandCallbackPtr = new CommandCallbackClass(L);
 
+	CallbackRegistry::instance().registerCallbackFunction("LuaCommandCB", theCommandCallback);
+	CallbackRegistry::instance().registerCallbackFunction("LuaCharacterCB", theCharacterCallback);
+
 	return true;
 }
 


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