From: florianf Date: Sun, 28 Feb 2010 11:08:43 +0000 (+0000) Subject: badbuy/badbuy.cpp: Use Sector::get_nearest_player(). X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4982802756a2fceb3f9811a59d09f24e652292c8;p=supertux.git badbuy/badbuy.cpp: Use Sector::get_nearest_player(). git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6451 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 0b51f7196..5ee5b9909 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -492,16 +492,7 @@ BadGuy::might_fall(int height) Player* BadGuy::get_nearest_player() { - // FIXME: does not really return nearest player - - std::vector players = Sector::current()->get_players(); - for (std::vector::iterator playerIter = players.begin(); playerIter != players.end(); ++playerIter) { - Player* player = *playerIter; - if (player->is_dying() || player->is_dead()) continue; - return player; - } - - return 0; + return Sector::current()->get_nearest_player (this->get_bbox ()); } void