diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-02-28 23:37:23 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-02 18:12:20 +0100 |
commit | ba5b55f3eba0aa3898c5fe42de9838b22473c24a (patch) | |
tree | 465e70d3bc4671b75f1af763d866eafa459f5d6f /src/scripting/scriptmanager.cpp | |
parent | 05bb880a3b0ebe401bac83b7a2400aa315161f9c (diff) | |
download | manaserv-ba5b55f3eba0aa3898c5fe42de9838b22473c24a.tar.gz manaserv-ba5b55f3eba0aa3898c5fe42de9838b22473c24a.tar.bz2 manaserv-ba5b55f3eba0aa3898c5fe42de9838b22473c24a.tar.xz manaserv-ba5b55f3eba0aa3898c5fe42de9838b22473c24a.zip |
Use callbacks for handling character death and respawn
Rather than relying on the availability of global functions with certain
predefined names, the Lua script now calls API functions to set which
function should be called on these global events.
This mechanism should make it easier to avoid name collisions in the global
namespace, which is important now that there is only a single script state.
For these global events this was not likely to become a problem, but this
solution can also be used for callbacks on specific item or monster types,
or even allow setting callbacks on certain instances.
Reviewed-by: Erik Schilling
Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/scripting/scriptmanager.cpp')
-rw-r--r-- | src/scripting/scriptmanager.cpp | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/scripting/scriptmanager.cpp b/src/scripting/scriptmanager.cpp index 52515699..d58379f6 100644 --- a/src/scripting/scriptmanager.cpp +++ b/src/scripting/scriptmanager.cpp @@ -49,19 +49,6 @@ Script *ScriptManager::currentState() // TODO: Have some generic event mechanism rather than calling global functions -bool ScriptManager::executeGlobalEventFunction(const std::string &function, Being* obj) -{ - bool isScriptHandled = false; - _currentState->setMap(obj->getMap()); - _currentState->prepare(function); - _currentState->push(obj); - _currentState->execute(); - _currentState->setMap(NULL); - isScriptHandled = true; // TODO: don't set to true when execution failed - return isScriptHandled; -} - - void ScriptManager::addDataToSpecial(int id, Special *special) { /* currently only gets the recharge cost. |