Use std::unique_ptr<> throughout the audio system
[supertux.git] / src / object / bonus_block.cpp
index 5d6afcf..2b03e5c 100644 (file)
@@ -1,5 +1,5 @@
 //  SuperTux
-//  Copyright (C) 2009 Ingo Ruhnke <grumbel@gmx.de>
+//  Copyright (C) 2009 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
@@ -45,6 +45,8 @@ BonusBlock::BonusBlock(const Vector& pos, int data) :
   contents(),
   object(0),
   hit_counter(1),
+  sprite_name(),
+  script(),
   lightsprite()
 {
   bbox.set_pos(pos);
@@ -85,6 +87,8 @@ BonusBlock::BonusBlock(const Reader& lisp) :
   contents(),
   object(0),
   hit_counter(1),
+  sprite_name(),
+  script(),
   lightsprite()
 {
   Vector pos;
@@ -422,49 +426,6 @@ BonusBlock::try_drop(Player *player)
       try_open(player);
       break;
     }
-
-    case CONTENT_STAR:
-    {
-      sector->add_object(new Star(get_pos() + Vector(0, 32), direction));
-      sound_manager->play("sounds/upgrade.wav");
-      break;
-    }
-
-    case CONTENT_1UP:
-    {
-      sector->add_object(new OneUp(get_pos(), DOWN));
-      sound_manager->play("sounds/upgrade.wav");
-      break;
-    }
-
-    case CONTENT_CUSTOM:
-    {
-      //TODO: non-portable trampolines could be moved to CONTENT_CUSTOM, but they should not drop
-      object->set_pos(get_pos() +  Vector(0, 32));
-      sector->add_object(object);
-      object = 0;
-      sound_manager->play("sounds/upgrade.wav");
-      break;
-    }
-
-    case CONTENT_SCRIPT:
-    { break; } // because scripts always run, this prevents default contents from being assumed
-
-    case CONTENT_LIGHT:
-    {
-      try_open(player);
-      break;
-    }
-    case CONTENT_TRAMPOLINE:
-    {
-      try_open(player);
-      break;
-    }
-    case CONTENT_RAIN:
-    {
-      try_open(player);
-      break;
-    }
     case CONTENT_EXPLODE:
     {
       hit_counter = 1; // multiple hits of coin explode is not allowed
@@ -480,20 +441,12 @@ BonusBlock::try_drop(Player *player)
     Sector::current()->run_script(stream, "powerup-script");
   }
 
-<<<<<<< HEAD
   if(countdown){ // only decrease hit counter if try_open was not called
     if(hit_counter == 1){
       sprite->set_action("empty");
     }else{
       hit_counter--;
     }
-=======
-  if(hit_counter <= 0 || contents == CONTENT_LIGHT){ //use 0 to allow infinite hits
-  }else if(hit_counter == 1){
-    sprite->set_action("empty");
-  }else{
-    hit_counter--;
->>>>>>> feature/sdl2
   }
 }