diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-02-25 07:54:38 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-02-25 07:54:38 -0700 |
commit | 7a65eb17a322cb22e7940504797844114fb77d79 (patch) | |
tree | c961a8bb4d43f557bf7b4d3b1977fd27a0f8303f /src/beingmanager.cpp | |
parent | a996d4bff3cc5a35ee5cdb6cb5bdef920cf44120 (diff) | |
download | mana-client-7a65eb17a322cb22e7940504797844114fb77d79.tar.gz mana-client-7a65eb17a322cb22e7940504797844114fb77d79.tar.bz2 mana-client-7a65eb17a322cb22e7940504797844114fb77d79.tar.xz mana-client-7a65eb17a322cb22e7940504797844114fb77d79.zip |
Fix some problems with deleting NPCs early
Diffstat (limited to 'src/beingmanager.cpp')
-rw-r--r-- | src/beingmanager.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index 3c8edf86..3b73d29f 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -96,7 +96,10 @@ Being* BeingManager::createBeing(Uint32 id, Uint16 job) void BeingManager::destroyBeing(Being *being) { mBeings.remove(being); - delete being; + if (being == current_npc) + current_npc->handleDeath(); + else + delete being; } Being* BeingManager::findBeing(Uint32 id) @@ -193,6 +196,12 @@ void BeingManager::clear() mBeings.remove(player_node); } + if (current_npc) + { + mBeings.remove(current_npc); + current_npc->handleDeath(); + } + delete_all(mBeings); mBeings.clear(); |