supertux/sector.hpp: Add a version of Sector::get_nearest_player() that uses a Rectf.
authorflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Sun, 28 Feb 2010 10:53:34 +0000 (10:53 +0000)
committerflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Sun, 28 Feb 2010 10:53:34 +0000 (10:53 +0000)
This way the bouding box can be passed to the method. No need to calculate an
anchor point everywhere.

git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6449 837edb03-e0f3-0310-88ca-d4d4e8b29345

src/supertux/sector.hpp

index 4bf38d4..69f2d70 100644 (file)
@@ -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<Player*>(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();