diff options
author | Roderic Morris <roderic@ccs.neu.edu> | 2008-10-24 00:28:05 +0000 |
---|---|---|
committer | Roderic Morris <roderic@ccs.neu.edu> | 2008-10-24 00:28:05 +0000 |
commit | 0b2235dfff7f7c0f534746271ff66275297fd328 (patch) | |
tree | 27d0ed8f487ccf7793606f20d8ce5d9814343efd /src/beingmanager.cpp | |
parent | afa57ceea0df1ce1ca494d7794e2f6542befc214 (diff) | |
download | mana-0b2235dfff7f7c0f534746271ff66275297fd328.tar.gz mana-0b2235dfff7f7c0f534746271ff66275297fd328.tar.bz2 mana-0b2235dfff7f7c0f534746271ff66275297fd328.tar.xz mana-0b2235dfff7f7c0f534746271ff66275297fd328.zip |
fixes for targetting (by Chuck Miller)
Diffstat (limited to 'src/beingmanager.cpp')
-rw-r--r-- | src/beingmanager.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index abb23f5e..22b3de9b 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -89,6 +89,8 @@ Being* BeingManager::createBeing(int id, int type, int subtype) void BeingManager::destroyBeing(Being *being) { mBeings.remove(being); + if(being == player_node->getTarget()) + player_node->setTarget(NULL); delete being; } @@ -179,7 +181,7 @@ Being* BeingManager::findNearestLivingBeing(Uint16 x, Uint16 y, int maxdist, } } - return (maxdist >= dist) ? closestBeing : NULL; + return (maxdist >= dist) ? NULL : closestBeing; } Being* BeingManager::findNearestLivingBeing(Being *aroundBeing, int maxdist, @@ -207,5 +209,5 @@ Being* BeingManager::findNearestLivingBeing(Being *aroundBeing, int maxdist, } } - return (maxdist >= dist) ? closestBeing : NULL; + return (maxdist >= dist) ? NULL : closestBeing; } |