From: Florian Forster Date: Sun, 28 Feb 2010 10:53:34 +0000 (+0000) Subject: supertux/sector.hpp: Add a version of Sector::get_nearest_player() that uses a Rectf. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=65037c27da145f226bbf6ecfceac91387c484a7f;p=supertux.git supertux/sector.hpp: Add a version of Sector::get_nearest_player() that uses a Rectf. This way the bouding box can be passed to the method. No need to calculate an anchor point everywhere. SVN-Revision: 6449 --- diff --git a/src/supertux/sector.hpp b/src/supertux/sector.hpp index 4bf38d4ee..69f2d7041 100644 --- a/src/supertux/sector.hpp +++ b/src/supertux/sector.hpp @@ -27,6 +27,7 @@ #include "util/writer_fwd.hpp" #include "util/currenton.hpp" #include "video/color.hpp" +#include "object/anchor_point.hpp" namespace collision { class Constraints; @@ -159,6 +160,10 @@ public: return std::vector(1, this->player); } Player *get_nearest_player (const Vector& pos); + Player *get_nearest_player (const Rectf& pos) + { + return (get_nearest_player (get_anchor_pos (pos, ANCHOR_MIDDLE))); + } Rectf get_active_region();