From: florianf Date: Sun, 28 Feb 2010 10:29:35 +0000 (+0000) Subject: Icecrusher: Use Sector::get_nearest_player(). X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e6522b450146bae3e9e39b3eb5ad789f09762735;p=supertux.git Icecrusher: Use Sector::get_nearest_player(). The icecrusher's own implementation has been removed. git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6445 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- diff --git a/src/object/icecrusher.cpp b/src/object/icecrusher.cpp index d97b4b0f9..199ec51dc 100644 --- a/src/object/icecrusher.cpp +++ b/src/object/icecrusher.cpp @@ -166,25 +166,10 @@ IceCrusher::update(float elapsed_time) } } -Player* -IceCrusher::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; -} - bool IceCrusher::found_victim() { - Player* player = this->get_nearest_player(); + Player* player = Sector::current()->get_nearest_player (this->get_pos ()); if (!player) return false; const Rectf& player_bbox = player->get_bbox();