Fixed a Segmentation Fault when mr_iceblock was kicked into a brick containing coins...
[supertux.git] / src / object / brick.cpp
index fc48dd5..36c6d6e 100644 (file)
@@ -21,6 +21,7 @@
 #include "object/bouncy_coin.hpp"
 #include "object/explosion.hpp"
 #include "object/flower.hpp"
+#include "object/icecrusher.hpp"
 #include "object/player.hpp"
 #include "object/portable.hpp"
 #include "sprite/sprite_manager.hpp"
@@ -76,6 +77,9 @@ Brick::collision(GameObject& other, const CollisionHit& hit_){
   if(explosion && explosion->hurts()) {
     try_break(player);
   }
+  IceCrusher* icecrusher = dynamic_cast<IceCrusher*> (&other);
+  if(icecrusher && coin_counter == 0)
+    try_break(player);
   return Block::collision(other, hit_);
 }
 
@@ -88,7 +92,7 @@ Brick::try_break(Player* player)
   SoundManager::current()->play("sounds/brick.wav");
   Sector* sector = Sector::current();
   Player& player_one = *(sector->player);
-  if(coin_counter > 0 && !player->is_stone()) {
+  if(coin_counter > 0 ){
     sector->add_object(std::make_shared<BouncyCoin>(get_pos(), true));
     coin_counter--;
     player_one.get_status()->add_coins(1);