aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-10-23 15:44:33 +0000
committerMax Horn2010-10-23 15:44:33 +0000
commit360f67636bdb67eeac80e60b8e27fb88b80fa0fd (patch)
tree3c086e21d79c3c10185ca5cd56bdf30b65f70297
parentc483a22f2a8c02c2b1ecaf5f9626999fd3ed3c7e (diff)
downloadscummvm-rg350-360f67636bdb67eeac80e60b8e27fb88b80fa0fd.tar.gz
scummvm-rg350-360f67636bdb67eeac80e60b8e27fb88b80fa0fd.tar.bz2
scummvm-rg350-360f67636bdb67eeac80e60b8e27fb88b80fa0fd.zip
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. svn-id: r53735
-rw-r--r--engines/sword25/gfx/graphicengine_script.cpp13
-rw-r--r--engines/sword25/input/inputengine_script.cpp10
2 files changed, 7 insertions, 16 deletions
diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp
index fa97b80c82..835e1e20b8 100644
--- a/engines/sword25/gfx/graphicengine_script.cpp
+++ b/engines/sword25/gfx/graphicengine_script.cpp
@@ -73,15 +73,6 @@ protected:
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öglichen.
@@ -1295,6 +1286,10 @@ bool GraphicEngine::registerScriptBindings() {
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;
}
diff --git a/engines/sword25/input/inputengine_script.cpp b/engines/sword25/input/inputengine_script.cpp
index 0ada7ece5c..f68b265297 100644
--- a/engines/sword25/input/inputengine_script.cpp
+++ b/engines/sword25/input/inputengine_script.cpp
@@ -83,13 +83,6 @@ protected:
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 @@ bool InputEngine::registerScriptBindings() {
assert(commandCallbackPtr == 0);
commandCallbackPtr = new CommandCallbackClass(L);
+ CallbackRegistry::instance().registerCallbackFunction("LuaCommandCB", theCommandCallback);
+ CallbackRegistry::instance().registerCallbackFunction("LuaCharacterCB", theCharacterCallback);
+
return true;
}