From 4982802756a2fceb3f9811a59d09f24e652292c8 Mon Sep 17 00:00:00 2001 From: florianf Date: Sun, 28 Feb 2010 11:08:43 +0000 Subject: [PATCH] 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 --- src/badguy/badguy.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) 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 -- 2.11.0