Replaced Ref and RefCounter with std::shared_ptr<>
[supertux.git] / src / badguy / goldbomb.cpp
index fa180ea..87000f7 100644 (file)
@@ -38,7 +38,7 @@ GoldBomb::GoldBomb(const Reader& reader) :
   max_drop_height = 16;
 
   //Prevent stutter when Tux jumps on Gold Bomb
-  sound_manager->preload("sounds/explosion.wav");
+  SoundManager::current()->preload("sounds/explosion.wav");
 
   //Check if we need another sprite
   if( !reader.get( "sprite", sprite_name ) ){
@@ -49,7 +49,7 @@ GoldBomb::GoldBomb(const Reader& reader) :
     return;
   }
   //Replace sprite
-  sprite = sprite_manager->create( sprite_name );
+  sprite = SpriteManager::current()->create( sprite_name );
 }
 
 void
@@ -114,7 +114,7 @@ GoldBomb::collision_squished(GameObject& object)
     if (player)
       player->bounce(*this);
 
-    ticking = sound_manager->create_sound_source("sounds/fizz.wav");
+    ticking = SoundManager::current()->create_sound_source("sounds/fizz.wav");
     ticking->set_position(get_pos());
     ticking->set_looping(true);
     ticking->set_gain(2.0);
@@ -160,19 +160,19 @@ GoldBomb::kill_fall()
 
   if(is_valid()) {
     remove_me();
-    Sector::current()->add_object(new Explosion(get_bbox().get_middle()));
-    Sector::current()->add_object(new CoinExplode(get_pos() + Vector (0, -40)));
+    Sector::current()->add_object(std::make_shared<Explosion>(get_bbox().get_middle()));
+    Sector::current()->add_object(std::make_shared<CoinExplode>(get_pos() + Vector (0, -40)));
   }
 
   run_dead_script();
 }
 
 void
-GoldBomb::grab(MovingObject& object, const Vector& pos, Direction dir)
+GoldBomb::grab(MovingObject& object, const Vector& pos, Direction dir_)
 {
   if(tstate == STATE_TICKING){
     movement = pos - get_pos();
-    this->dir = dir;
+    this->dir = dir_;
 
     // We actually face the opposite direction of Tux here to make the fuse more
     // visible instead of hiding it behind Tux
@@ -183,8 +183,8 @@ GoldBomb::grab(MovingObject& object, const Vector& pos, Direction dir)
   }
   else if(frozen){
     movement = pos - get_pos();
-    this->dir = dir;
-    sprite->set_action(dir == LEFT ? "iced-left" : "iced-right");
+    this->dir = dir_;
+    sprite->set_action(dir_ == LEFT ? "iced-left" : "iced-right");
     set_colgroup_active(COLGROUP_DISABLED);
     grabbed = true;
   }