From: Florian Forster 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=ce7093c44acbe22f06f22082f0980187cb553d31;p=supertux.git badbuy/badbuy.cpp: Use Sector::get_nearest_player(). SVN-Revision: 6451 --- 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