summaryrefslogtreecommitdiff
path: root/src/beingmanager.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-02-25 13:38:55 -0700
committerJared Adams <jaxad0127@gmail.com>2009-02-25 13:38:55 -0700
commitf04a8713ffc83db8b3dc4a472b28aad25a2b2bd1 (patch)
tree1822aa7cecfbe4ef38b55216ab82b686e3b636c7 /src/beingmanager.cpp
parent9673149ea3c28f42f38fc9989faf76d68e72bd20 (diff)
downloadmana-client-f04a8713ffc83db8b3dc4a472b28aad25a2b2bd1.tar.gz
mana-client-f04a8713ffc83db8b3dc4a472b28aad25a2b2bd1.tar.bz2
mana-client-f04a8713ffc83db8b3dc4a472b28aad25a2b2bd1.tar.xz
mana-client-f04a8713ffc83db8b3dc4a472b28aad25a2b2bd1.zip
Fix NPC handling to not need a handle on the NPC
The Being ID is used instead, as that is all that was ever really needed.
Diffstat (limited to 'src/beingmanager.cpp')
-rw-r--r--src/beingmanager.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp
index 3b73d29f..273436bf 100644
--- a/src/beingmanager.cpp
+++ b/src/beingmanager.cpp
@@ -96,10 +96,7 @@ Being* BeingManager::createBeing(Uint32 id, Uint16 job)
void BeingManager::destroyBeing(Being *being)
{
mBeings.remove(being);
- if (being == current_npc)
- current_npc->handleDeath();
- else
- delete being;
+ delete being;
}
Being* BeingManager::findBeing(Uint32 id)
@@ -196,12 +193,6 @@ void BeingManager::clear()
mBeings.remove(player_node);
}
- if (current_npc)
- {
- mBeings.remove(current_npc);
- current_npc->handleDeath();
- }
-
delete_all(mBeings);
mBeings.clear();
@@ -264,3 +255,13 @@ Being* BeingManager::findNearestLivingBeing(Being *aroundBeing, int maxdist,
return (maxdist >= dist) ? closestBeing : NULL;
}
+
+bool BeingManager::hasBeing(Being *being)
+{
+ for (BeingIterator i = mBeings.begin(); i != mBeings.end(); i++)
+ {
+ if (being == *i) return true;
+ }
+
+ return false;
+}