diff options
author | Ira Rice <irarice@gmail.com> | 2009-03-05 23:13:55 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-03-05 23:13:55 -0700 |
commit | aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5 (patch) | |
tree | 19c5a75a766b7df51ae468fb6b8fdbcfd2c6cc72 /src/beingmanager.cpp | |
parent | 93e45964f3b7a0735984616f622ec32b40a21781 (diff) | |
download | mana-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.tar.gz mana-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.tar.bz2 mana-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.tar.xz mana-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.zip |
Made some optimizations based on some profiling done by Octalot, as well
as some other optimizations that I could see that cut down on some
unneeded redraws, which in turn improved frame rates slightly.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/beingmanager.cpp')
-rw-r--r-- | src/beingmanager.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index 0cf783d8..0c7a310a 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -151,9 +151,8 @@ Being *BeingManager::findBeingByName(std::string name, Being::Type type) for (BeingIterator i = mBeings.begin(); i != mBeings.end(); i++) { Being *being = (*i); - if (being->getName() == name - && (type == Being::UNKNOWN - || type == being->getType())) + if (being->getName() == name && + (type == Being::UNKNOWN || type == being->getType())) return being; } return NULL; @@ -187,17 +186,13 @@ void BeingManager::logic() void BeingManager::clear() { if (player_node) - { mBeings.remove(player_node); - } delete_all(mBeings); mBeings.clear(); if (player_node) - { mBeings.push_back(player_node); - } } Being *BeingManager::findNearestLivingBeing(int x, int y, int maxdist, @@ -216,8 +211,7 @@ Being *BeingManager::findNearestLivingBeing(int x, int y, int maxdist, if ((being->getType() == type || type == Being::UNKNOWN) && (d < dist || closestBeing == NULL) // it is closer - && being->mAction != Being::DEAD // no dead beings - ) + && being->mAction != Being::DEAD) // no dead beings { dist = d; closestBeing = being; @@ -243,8 +237,7 @@ Being *BeingManager::findNearestLivingBeing(Being *aroundBeing, int maxdist, if ((being->getType() == type || type == Being::UNKNOWN) && (d < dist || closestBeing == NULL) // it is closer && being->mAction != Being::DEAD // no dead beings - && being != aroundBeing - ) + && being != aroundBeing) { dist = d; closestBeing = being; |