Massive copyright update. I'm sorry if I'm crediting Matze for something he didn...
[supertux.git] / src / badguy / zeekling.cpp
index f6d795d..9030ec9 100644 (file)
@@ -1,5 +1,5 @@
 //  $Id$
-// 
+//
 //  Zeekling - flyer that swoops down when she spots the player
 //  Copyright (C) 2005 Matthias Braun <matze@braunis.de>
 //  Copyright (C) 2006 Christoph Sommer <supertux@2006.expires.deltadevelopment.de>
@@ -13,7 +13,7 @@
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 //  GNU General Public License for more details.
-// 
+//
 //  You should have received a copy of the GNU General Public License
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -129,7 +129,9 @@ Zeekling::collision_solid(GameObject& , const CollisionHit& hit)
  */
 bool 
 Zeekling::should_we_dive() {
-  const MovingObject* player = Sector::current()->player;
+  const MovingObject* player = this->get_nearest_player();
+  if (!player) return false;
+
   const MovingObject* badguy = this;
 
   const Vector playerPos = player->get_pos();