diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-01-15 01:07:47 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-01-15 02:05:50 +0200 |
commit | e2150d04662a4ba8b5304dabcc74be0bacded5b7 (patch) | |
tree | cbeb05c2f056a7d5ac4a08e7b80799b5cfd4785b /src/actorspritemanager.cpp | |
parent | edda37acb9d66f2751ef712c83dced62428fa685 (diff) | |
download | manaplus-e2150d04662a4ba8b5304dabcc74be0bacded5b7.tar.gz manaplus-e2150d04662a4ba8b5304dabcc74be0bacded5b7.tar.bz2 manaplus-e2150d04662a4ba8b5304dabcc74be0bacded5b7.tar.xz manaplus-e2150d04662a4ba8b5304dabcc74be0bacded5b7.zip |
Fix code style, apply some fixes after checking with cppcheck from git.
Diffstat (limited to 'src/actorspritemanager.cpp')
-rw-r--r-- | src/actorspritemanager.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index 01eba1866..6182d81ab 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -44,7 +44,7 @@ #include <vector> #define for_actors ActorSpritesConstIterator it, it_end; \ -for (it = mActors.begin(), it_end = mActors.end() ; it != it_end; it++) +for (it = mActors.begin(), it_end = mActors.end() ; it != it_end; ++it) class FindBeingFunctor { @@ -268,6 +268,9 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y, return NULL; bool targetDead = mTargetDeadPlayers; + const int xtol = 16; + const int uptol = 32; + for_actors { if ((*it)->getType() == ActorSprite::FLOOR_ITEM @@ -278,9 +281,6 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y, Being *being = static_cast<Being*>(*it); - int xtol = 16; - int uptol = 32; - if ((being->isAlive() || (targetDead && being->getType() == Being::PLAYER)) && (allPlayers || being != player_node)) @@ -306,6 +306,9 @@ void ActorSpriteManager::findBeingsByPixel(std::list<Being*> &beings, return; bool targetDead = mTargetDeadPlayers; + const int xtol = 16; + const int uptol = 32; + for_actors { if ((*it)->getType() == ActorSprite::FLOOR_ITEM @@ -316,9 +319,6 @@ void ActorSpriteManager::findBeingsByPixel(std::list<Being*> &beings, Being *being = static_cast<Being*>(*it); - int xtol = 16; - int uptol = 32; - if ((being->isAlive() || (targetDead && being->getType() == Being::PLAYER)) && (allPlayers || being != player_node)) @@ -649,7 +649,6 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing, return 0; Being *closestBeing = 0; - int dist = 0; maxDist = maxDist * maxDist; @@ -708,6 +707,8 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing, } else { + int dist = 0; + for (ActorSprites::const_iterator i = mActors.begin(), i_end = mActors.end(); i != i_end; ++i) @@ -859,7 +860,7 @@ bool ActorSpriteManager::hasActorSprite(ActorSprite *actor) const void ActorSpriteManager::addBlock(Uint32 id) { bool alreadyBlocked(false); - for (int i = 0; i < (int)blockedBeings.size(); i++) + for (int i = 0; i < (int)blockedBeings.size(); ++i) { if (id == blockedBeings.at(i)) { @@ -887,7 +888,7 @@ void ActorSpriteManager::deleteBlock(Uint32 id) bool ActorSpriteManager::isBlocked(Uint32 id) { bool blocked(false); - for (int i = 0; i < (int)blockedBeings.size(); i++) + for (int i = 0; i < (int)blockedBeings.size(); ++i) { if (id == blockedBeings.at(i)) { |