Use run_dead_script wherever possible and make kill_* operations only do stuff once
[supertux.git] / src / badguy / yeti.cpp
index 2547f71..f6cc57a 100644 (file)
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //  02111-1307, USA.
+
 #include <config.h>
 
-#include <float.h>
-#include <sstream>
-#include <memory>
 #include "yeti.hpp"
+
 #include "object/camera.hpp"
 #include "yeti_stalactite.hpp"
 #include "bouncing_snowball.hpp"
 #include "game_session.hpp"
 #include "level.hpp"
+#include "lisp/writer.hpp"
+#include "object_factory.hpp"
+#include "audio/sound_manager.hpp"
+#include "sector.hpp"
+#include "object/player.hpp"
+#include "sprite/sprite.hpp"
+
+#include <math.h>
+#include <float.h>
 
 namespace {
   const float JUMP_DOWN_VX = 250; /**< horizontal speed while jumping off the dais */
@@ -222,12 +230,7 @@ void Yeti::take_hit(Player& )
     set_colgroup_active(COLGROUP_MOVING_ONLY_STATIC);
     sprite->set_action("dead");
 
-    if (countMe) Sector::current()->get_level()->stats.badguys++;
-
-    if(dead_script != "") {
-      std::istringstream stream(dead_script);
-      Sector::current()->run_script(stream, "Yeti - dead-script");
-    }
+    run_dead_script();
   }
   else {
     safe_timer.start(SAFE_TIME);