summaryrefslogtreecommitdiff
path: root/src/actorsprite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/actorsprite.cpp')
-rw-r--r--src/actorsprite.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 13b7abf2..6a1dcbc7 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -19,6 +19,7 @@
*/
#include "actorsprite.h"
+#include "actorspritelistener.h"
#include "client.h"
#include "effectmanager.h"
@@ -64,6 +65,11 @@ ActorSprite::~ActorSprite()
if (player_node && player_node->getTarget() == this)
player_node->setTarget(NULL);
+
+ // Notify listeners of the destruction.
+ for (ActorSpriteListenerIterator iter = mActorSpriteListeners.begin(),
+ end = mActorSpriteListeners.end(); iter != end; ++iter)
+ (*iter)->actorSpriteDestroyed(*this);
}
bool ActorSprite::draw(Graphics *graphics, int offsetX, int offsetY) const
@@ -358,6 +364,16 @@ void ActorSprite::unload()
loaded = false;
}
+void ActorSprite::addActorSpriteListener(ActorSpriteListener *listener)
+{
+ mActorSpriteListeners.push_front(listener);
+}
+
+void ActorSprite::removeActorSpriteListener(ActorSpriteListener *listener)
+{
+ mActorSpriteListeners.remove(listener);
+}
+
static const char *cursorType(int type)
{
switch (type)