Set countMe flag to false for headless snomen
[supertux.git] / src / badguy / snowman.cpp
index a10951f..6170ae1 100644 (file)
@@ -1,5 +1,5 @@
 //  SuperTux
-//  Copyright (C) 2010 Ingo Ruhnke <grumbel@gmx.de>
+//  Copyright (C) 2010 Ingo Ruhnke <grumbel@gmail.com>
 //
 //  This program is free software: you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ Snowman::Snowman(const Reader& reader) :
   WalkingBadguy(reader, "images/creatures/snowman/snowman.sprite", "walk-left", "walk-right")
 {
   walk_speed = 40;
-  sound_manager->preload("sounds/pop.ogg");
+  SoundManager::current()->preload("sounds/pop.ogg");
 }
 
 void
@@ -45,9 +45,10 @@ Snowman::loose_head()
   physic.set_acceleration_y(0);
   physic.enable_gravity(true);
   set_state (STATE_FALLING);
+  countMe = false;
 
   /* Create a new snowball where the snowman's head was */
-  SnowBall* snowball = new SnowBall(snowball_pos, dir, dead_script);
+  auto snowball = std::make_shared<SnowBall>(snowball_pos, dir, dead_script);
   Sector::current()->add_object(snowball);
 }
 
@@ -58,7 +59,7 @@ Snowman::collision_bullet(Bullet& bullet, const CollisionHit& hit)
     // fire bullets destroy snowman's body
     loose_head();
 
-    sound_manager->play("sounds/pop.ogg", get_pos()); // this could be a different sound
+    SoundManager::current()->play("sounds/pop.ogg", get_pos()); // this could be a different sound
     bullet.remove_me();
 
     return ABORT_MOVE;
@@ -78,7 +79,7 @@ Snowman::collision_squished(GameObject& object)
   if (player)
     player->bounce(*this);
 
-  sound_manager->play("sounds/pop.ogg", get_pos());
+  SoundManager::current()->play("sounds/pop.ogg", get_pos());
 
   loose_head();