Fix coverity #29604
[supertux.git] / src / badguy / bouncing_snowball.cpp
index 2328841..67af264 100644 (file)
@@ -20,7 +20,7 @@
 #include "supertux/object_factory.hpp"
 
 static const float JUMPSPEED = -450;
-static const float WALKSPEED = 80;
+static const float BSNOWBALL_WALKSPEED = 80;
 
 BouncingSnowball::BouncingSnowball(const Reader& reader)
   : BadGuy(reader, "images/creatures/bouncing_snowball/bouncing_snowball.sprite")
@@ -35,7 +35,7 @@ BouncingSnowball::BouncingSnowball(const Vector& pos, Direction d)
 void
 BouncingSnowball::initialize()
 {
-  physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED);
+  physic.set_velocity_x(dir == LEFT ? -BSNOWBALL_WALKSPEED : BSNOWBALL_WALKSPEED);
   sprite->set_action(dir == LEFT ? "left" : "right");
 }
 
@@ -50,6 +50,11 @@ BouncingSnowball::collision_squished(GameObject& object)
 void
 BouncingSnowball::collision_solid(const CollisionHit& hit)
 {
+  if(sprite->get_action() == "squished")
+  {
+    return;
+  }
+
   if(hit.bottom) {
     if(get_state() == STATE_ACTIVE) {
       physic.set_velocity_y(JUMPSPEED);
@@ -74,6 +79,4 @@ BouncingSnowball::collision_badguy(BadGuy& , const CollisionHit& hit)
   return CONTINUE;
 }
 
-IMPLEMENT_FACTORY(BouncingSnowball, "bouncingsnowball");
-
 /* EOF */