summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLloyd Bryant <lloyd_bryant@netzero.net>2008-08-17 06:28:13 +0000
committerLloyd Bryant <lloyd_bryant@netzero.net>2008-08-17 06:28:13 +0000
commitd5b86aa54dfa4ddf5b5f2361918c719ba8d0dd18 (patch)
treed1eb473d5d703ac37c7ed4cdcfc52e4caca5aa95 /src
parent68888853bc946a52ca368c5fc859b6709ae0e661 (diff)
downloadmana-d5b86aa54dfa4ddf5b5f2361918c719ba8d0dd18.tar.gz
mana-d5b86aa54dfa4ddf5b5f2361918c719ba8d0dd18.tar.bz2
mana-d5b86aa54dfa4ddf5b5f2361918c719ba8d0dd18.tar.xz
mana-d5b86aa54dfa4ddf5b5f2361918c719ba8d0dd18.zip
Fixed crash resulting from having a player targeted when hitting a warp point
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp1
-rw-r--r--src/monster.cpp10
-rw-r--r--src/net/beinghandler.cpp5
-rw-r--r--src/net/playerhandler.cpp7
4 files changed, 13 insertions, 10 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 822bc647..fd1b67fe 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -33,6 +33,7 @@
#include "map.h"
#include "particle.h"
#include "text.h"
+#include "localplayer.h"
#include "resources/resourcemanager.h"
#include "resources/imageset.h"
diff --git a/src/monster.cpp b/src/monster.cpp
index 5d62a9cc..e5f9f4b2 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -28,7 +28,6 @@
#include "sound.h"
#include "particle.h"
#include "text.h"
-#include "localplayer.h"
#include "gui/gui.h"
@@ -66,12 +65,11 @@ Monster::Monster(Uint32 id, Uint16 job, Map *map):
}
}
-Monster::~Monster()
-{
+Monster::~Monster() {
+
if (mText)
- {
- player_node->setTarget(0);
- }
+ delete mText;
+
}
void
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index affdcd56..5b2ac5f4 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -201,10 +201,9 @@ void BeingHandler::handleMessage(MessageIn *msg)
if (!dstBeing)
break;
- if (dstBeing == player_node->getTarget())
- {
+ // If this is player's current target, clear it.
+ if (player_node->getTarget() == dstBeing)
player_node->stopAttack();
- }
if (msg->readInt8() == 1)
{
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index 7f9e455a..e871b670 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -129,6 +129,12 @@ void PlayerHandler::handleMessage(MessageIn *msg)
logger->log("Warping to %s (%d, %d)", mapPath.c_str(), x, y);
+ /*
+ * We must clear the local player's target *before* the call
+ * to changeMap, as it deletes all beings.
+ */
+ player_node->stopAttack();
+
// Switch the actual map, deleting the previous one
engine->changeMap(mapPath);
@@ -138,7 +144,6 @@ void PlayerHandler::handleMessage(MessageIn *msg)
float scrollOffsetY = (y - player_node->mY) * 32;
player_node->setAction(Being::STAND);
- player_node->stopAttack();
player_node->mFrame = 0;
player_node->mX = x;
player_node->mY = y;