Major rewrite of scripting support:
[supertux.git] / src / object / powerup.cpp
index 3fce45b..f731822 100644 (file)
@@ -27,7 +27,6 @@
 #include "audio/sound_manager.hpp"
 #include "object_factory.hpp"
 #include "sector.hpp"
-#include "scripting/script_interpreter.hpp"
 #include "msg.hpp"
 
 PowerUp::PowerUp(const lisp::Lisp& lisp)
@@ -57,8 +56,6 @@ PowerUp::collision(GameObject& other, const CollisionHit& hit)
     if(fabsf(hit.normal.y) > .5) { // roof or ground
       physic.set_velocity_y(0);
     } else { // bumped left or right
-      msg_debug("Normal: " << hit.normal.x << "," << hit.normal.y);
-      msg_debug("LRbounce, new speed: " << physic.get_velocity_x());
       physic.set_velocity_x(-physic.get_velocity_x());
     }
 
@@ -72,8 +69,8 @@ PowerUp::collision(GameObject& other, const CollisionHit& hit)
   remove_me();
 
   if (script != "") {
-    ScriptInterpreter::add_script_object(Sector::current(), "powerup-script",
-        script);
+    std::istringstream stream(script);
+    Sector::current()->run_script(stream, "powerup-script");
     return ABORT_MOVE;
   }