- just doing some C++ifying
[supertux.git] / src / badguy.cpp
index d2e1a91..29d27dc 100644 (file)
@@ -644,7 +644,8 @@ BadGuy::action_fish(double elapsed_time)
     
   // go in wait mode when back in water
   if(dying == DYING_NOT 
-      && gettile(base.x, base.y+ base.height)->attributes & Tile::WATER
+      && gettile(base.x, base.y + base.height)
+      && gettile(base.x, base.y + base.height)->attributes & Tile::WATER
       && physic.get_velocity_y() <= 0 && mode == NORMAL)
     {
       mode = FISH_WAIT;
@@ -969,7 +970,7 @@ BadGuy::draw(DrawingContext& context)
     return;
 
   if(dying == DYING_FALLING && physic.get_velocity_y() < 0)
-    sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS, VERTICAL_FLIP);
+    sprite->draw(context, Vector(base.x, base.y), LAYER_FOREGROUNDTILES+1, VERTICAL_FLIP);
   else
     sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS);