summaryrefslogtreecommitdiff
path: root/src/scripting/script.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-02-28 23:37:23 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-02 18:12:20 +0100
commitba5b55f3eba0aa3898c5fe42de9838b22473c24a (patch)
tree465e70d3bc4671b75f1af763d866eafa459f5d6f /src/scripting/script.cpp
parent05bb880a3b0ebe401bac83b7a2400aa315161f9c (diff)
downloadmanaserv-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/script.cpp')
-rw-r--r--src/scripting/script.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/scripting/script.cpp b/src/scripting/script.cpp
index db44bd57..66720842 100644
--- a/src/scripting/script.cpp
+++ b/src/scripting/script.cpp
@@ -34,6 +34,8 @@ typedef std::map< std::string, Script::Factory > Engines;
static Engines *engines = NULL;
+Script::Ref Script::NoRef = -1;
+
Script::Script():
mMap(NULL),
mEventListener(&scriptEventDispatch)