Removed some obsolete stuff from supertux/globals.hpp
[supertux.git] / src / object / brick.cpp
index f9a1d61..4b2b90c 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
 
 #include "audio/sound_manager.hpp"
 #include "badguy/badguy.hpp"
-#include "object/flower.hpp"
 #include "object/bouncy_coin.hpp"
+#include "object/explosion.hpp"
+#include "object/flower.hpp"
 #include "object/player.hpp"
 #include "object/portable.hpp"
 #include "sprite/sprite_manager.hpp"
 #include "supertux/constants.hpp"
 #include "supertux/sector.hpp"
 
-Brick::Brick(const Vector& pos, int data)
-  : Block(sprite_manager->create("images/objects/bonus_block/brick.sprite")), breakable(false),
+Brick::Brick(const Vector& pos, int data, const std::string& spriteName)
+  : Block(SpriteManager::current()->create(spriteName)), breakable(false),
     coin_counter(0)
 {
   bbox.set_pos(pos);
@@ -47,7 +48,7 @@ Brick::hit(Player& player)
 }
 
 HitResponse
-Brick::collision(GameObject& other, const CollisionHit& hit){
+Brick::collision(GameObject& other, const CollisionHit& hit_){
 
   Player* player = dynamic_cast<Player*> (&other);
   if (player) {
@@ -70,7 +71,11 @@ Brick::collision(GameObject& other, const CollisionHit& hit){
       try_break(player);
     }
   }
-  return Block::collision(other, hit);
+  Explosion* explosion = dynamic_cast<Explosion*> (&other);
+  if(explosion && explosion->hurts()) {
+    try_break(player);
+  }
+  return Block::collision(other, hit_);
 }
 
 void
@@ -79,7 +84,7 @@ Brick::try_break(Player* player)
   if(sprite->get_action() == "empty")
     return;
 
-  sound_manager->play("sounds/brick.wav");
+  SoundManager::current()->play("sounds/brick.wav");
   Sector* sector = Sector::current();
   Player& player_one = *(sector->player);
   if(coin_counter > 0) {