summaryrefslogtreecommitdiff
path: root/src/scripting/script.hpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2009-01-31 21:49:58 +0100
committerPhilipp Sehmisch <crush@themanaworld.org>2009-01-31 22:01:39 +0100
commit393d066045fda5beee4748dc66754d70b4c82d36 (patch)
tree2ed309a5dba7595bc976762f9f625edebfcc4680 /src/scripting/script.hpp
parentc423c02890cfb4520da0ac75e00d1bd9f1663ce0 (diff)
downloadmanaserv-393d066045fda5beee4748dc66754d70b4c82d36.tar.gz
manaserv-393d066045fda5beee4748dc66754d70b4c82d36.tar.bz2
manaserv-393d066045fda5beee4748dc66754d70b4c82d36.tar.xz
manaserv-393d066045fda5beee4748dc66754d70b4c82d36.zip
Added on_remove callback to lua API
Diffstat (limited to 'src/scripting/script.hpp')
-rw-r--r--src/scripting/script.hpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/scripting/script.hpp b/src/scripting/script.hpp
index c87bf182..24a415ef 100644
--- a/src/scripting/script.hpp
+++ b/src/scripting/script.hpp
@@ -124,11 +124,13 @@ class Script
MapComposite *getMap() const
{ return mMap; }
- EventListener *getScriptDeathListener()
+ EventListener *getScriptListener()
{ return &mEventListener; }
virtual void processDeathEvent(Being* thing) = 0;
+ virtual void processRemoveEvent(Thing* thing) = 0;
+
protected:
std::string mScriptFile;
@@ -136,18 +138,19 @@ class Script
MapComposite *mMap;
EventListener mEventListener; /**< Tracking of being deaths. */
- friend struct ScriptDeathEventDispatch;
+ friend struct ScriptEventDispatch;
};
-struct ScriptDeathEventDispatch: EventDispatch
+struct ScriptEventDispatch: EventDispatch
{
- ScriptDeathEventDispatch()
+ ScriptEventDispatch()
{
typedef EventListenerFactory< Script, &Script::mEventListener > Factory;
died = &Factory::create< Being, &Script::processDeathEvent >::function;
+ removed = &Factory::create< Thing, &Script::processRemoveEvent >::function;
}
};
-static ScriptDeathEventDispatch scriptDeathEventDispatch;
+static ScriptEventDispatch scriptEventDispatch;
#endif