diff options
author | Ira Rice <irarice@gmail.com> | 2008-09-25 00:15:44 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-09-25 00:15:44 +0000 |
commit | 489a429bea6739dfa25503b9329bd9e33bffb856 (patch) | |
tree | 8112f6fd988fdc0610329b6bc14ee3f9d5801092 /src/beingmanager.cpp | |
parent | 2dc8eadff1e67bb70b1772ecc19c9e1e2e40a5b4 (diff) | |
download | mana-489a429bea6739dfa25503b9329bd9e33bffb856.tar.gz mana-489a429bea6739dfa25503b9329bd9e33bffb856.tar.bz2 mana-489a429bea6739dfa25503b9329bd9e33bffb856.tar.xz mana-489a429bea6739dfa25503b9329bd9e33bffb856.zip |
Merged the Tametomo branch into trunk.
Diffstat (limited to 'src/beingmanager.cpp')
-rw-r--r-- | src/beingmanager.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index 47729a92..f0ce9bd3 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -21,7 +21,7 @@ * $Id: beingmanager.cpp 4237 2008-05-14 18:57:32Z b_lindeijer $ */ -#include <algorithm> +#include <cassert> #include "beingmanager.h" @@ -124,7 +124,7 @@ Being* BeingManager::findBeing(Uint16 x, Uint16 y, Being::Type type) return (i == mBeings.end()) ? NULL : *i; } -/*Being* BeingManager::findBeingByPixel(Uint16 x, Uint16 y) +Being* BeingManager::findBeingByPixel(Uint16 x, Uint16 y) { BeingIterator itr = mBeings.begin(); BeingIterator itr_end = mBeings.end(); @@ -144,7 +144,7 @@ Being* BeingManager::findBeing(Uint16 x, Uint16 y, Being::Type type) } return NULL; -}*/ +} Being* BeingManager::findBeingByName(std::string name, Being::Type type) { @@ -159,8 +159,6 @@ Being* BeingManager::findBeingByName(std::string name, Being::Type type) return NULL; } - - Beings& BeingManager::getAll() { return mBeings; @@ -193,7 +191,7 @@ void BeingManager::clear() mBeings.remove(player_node); } - for_each(mBeings.begin(), mBeings.end(), make_dtor(mBeings)); + delete_all(mBeings); mBeings.clear(); if (player_node) @@ -208,9 +206,12 @@ Being* BeingManager::findNearestLivingBeing(Uint16 x, Uint16 y, int maxdist, Being *closestBeing = NULL; int dist = 0; - for (BeingIterator i = mBeings.begin(); i != mBeings.end(); i++) + BeingIterator itr = mBeings.begin(); + BeingIterator itr_end = mBeings.end(); + + for (; itr != itr_end; ++itr) { - Being *being = (*i); + Being *being = (*itr); int d = abs(being->mX - x) + abs(being->mY - y); if ((being->getType() == type || type == Being::UNKNOWN) |