From d5b86aa54dfa4ddf5b5f2361918c719ba8d0dd18 Mon Sep 17 00:00:00 2001 From: Lloyd Bryant Date: Sun, 17 Aug 2008 06:28:13 +0000 Subject: Fixed crash resulting from having a player targeted when hitting a warp point --- ChangeLog | 31 ++++++++++++++++++------------- src/being.cpp | 1 + src/monster.cpp | 10 ++++------ src/net/beinghandler.cpp | 5 ++--- src/net/playerhandler.cpp | 7 ++++++- 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0204d81e..81fc32d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-08-16 Lloyd Bryant ("Sanga") + + * Fixed bug where client would crash if another player + was targeted when you hit a warp point. + 2008-08-14 Lloyd Bryant ("Sanga") * Uncommented line so that MP status bar correctly @@ -10,33 +15,33 @@ provided "GM flag", which prepends "(GM)" to the player's name and changes the font color. -2008-08-08 Lloyd Bryant ("Sanga") +2008-08-08 Lloyd Bryant ("Sanga") * Made "--skipupdate" skip the update download process, but still load whatever updates have been previously downloaded. -2008-07-25 Lloyd Bryant ("Sanga") +2008-07-25 Lloyd Bryant ("Sanga") * Added feature to remember window locations from one session to the next (patch from TMW by ElvenProgrammer) -2008-07-24 Lloyd Bryant ("Sanga") +2008-07-24 Lloyd Bryant ("Sanga") * Tweak in net/beinghandler.cpp to compensate for a visual bug when using the TMW server. -2008-07-23 Lloyd Bryant ("Sanga") +2008-07-23 Lloyd Bryant ("Sanga") * Added support for capes/misc1/misc2 into the character selection display -2008-07-23 Lloyd Bryant ("Sanga") +2008-07-23 Lloyd Bryant ("Sanga") * Added "chat" button to open/close chat window * Added support for viewable cape/misc1/misc2 (new eAthena version ONLY -2008-07-22 Lloyd Bryant ("Sanga") +2008-07-22 Lloyd Bryant ("Sanga") * Added handler for 0x0086 movement packet (new eAthena). * Changed startup sequence for game.cpp to send a ping packet @@ -44,11 +49,11 @@ This is required by the new eAthena version. * Added #deines for some "ping" packets. -2008-07-19 Lloyd Bryant ("Sanga") +2008-07-19 Lloyd Bryant ("Sanga") * Removed unnecessary check ("weight") from itemdb loader -2008-07-18 Lloyd Bryant ("Sanga") +2008-07-18 Lloyd Bryant ("Sanga") * Added code to provide viewable glove and shoe sprites @@ -56,18 +61,18 @@ * Added code to avoid collision between different displayed text. -2008-07-08 Lloyd Bryant ("Sanga") +2008-07-08 Lloyd Bryant ("Sanga") * Added handling for a "Stop Walking" packet. This will force the client back into sync during those "can't run away from a battle" sync error conditions. -2008-07-07 Lloyd Bryant ("Sanga") +2008-07-07 Lloyd Bryant ("Sanga") * Added support for update host provided by login server * Changed startup sequence to login first, then update -2008-07-05 Lloyd Bryant ("Sanga") +2008-07-05 Lloyd Bryant ("Sanga") * Applied patch from kraant to convert into a TME branded client * Removed redundant autoconf files @@ -153,12 +158,12 @@ now stored in an update host specific directory. Based on a patch by Sanga. -2008-06-04 Lloyd Bryant +2008-06-04 Lloyd Bryant * src/net/charserverhandler.cpp: Display shield sprite also in character select window. -2008-05-30 Lloyd Bryant +2008-05-30 Lloyd Bryant * src/net/equipmenthandler.cpp, src/net/beinghandler.cpp, src/net/protocol.h, src/being.h: Merged handling for eAthena packets 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; -- cgit v1.2.3-70-g09d2