summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-02-16 18:26:35 -0700
committerIra Rice <irarice@gmail.com>2009-02-16 18:26:35 -0700
commitfb0626ebec688dfd1b4fe4d8c324c2f7b34fada2 (patch)
treeafcf3c4dd7d8d9a76f2865a0fa2296d00bcc350d /src/being.cpp
parenta739b7d2936bc1074edc4703bd06605162efd166 (diff)
downloadmana-fb0626ebec688dfd1b4fe4d8c324c2f7b34fada2.tar.gz
mana-fb0626ebec688dfd1b4fe4d8c324c2f7b34fada2.tar.bz2
mana-fb0626ebec688dfd1b4fe4d8c324c2f7b34fada2.tar.xz
mana-fb0626ebec688dfd1b4fe4d8c324c2f7b34fada2.zip
Moved target unsetting on NPCs and monsters to the being class. This is
done to ensure that the client doesn't crash if the target dies and is removed from the map (since target drawing is based off of the specific target reporting its x and y coordinates). Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 8e07514f..c944bcf9 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -29,6 +29,7 @@
#include "effectmanager.h"
#include "game.h"
#include "graphics.h"
+#include "localplayer.h"
#include "log.h"
#include "map.h"
#include "particle.h"
@@ -128,6 +129,9 @@ Being::~Being()
delete_all(mSprites);
clearPath();
+ if (player_node->getTarget() == this)
+ player_node->setTarget(NULL);
+
setMap(NULL);
instances--;