* Update squirrel to 2.2.3
[supertux.git] / src / trigger / switch.cpp
index f260b4b..b32e5ed 100644 (file)
@@ -53,10 +53,10 @@ void
 Switch::write(lisp::Writer& writer)
 {
   writer.start_list("switch");
-  writer.write_float("x", bbox.p1.x);
-  writer.write_float("y", bbox.p1.y);
-  writer.write_string("sprite", sprite_name);
-  writer.write_string("script", script);
+  writer.write("x", bbox.p1.x);
+  writer.write("y", bbox.p1.y);
+  writer.write("sprite", sprite_name);
+  writer.write("script", script);
   writer.end_list("switch");
 }
 
@@ -69,7 +69,9 @@ Switch::update(float )
     case TURN_ON:
       if(sprite->animation_done()) {
     std::istringstream stream(script);
-    Sector::current()->run_script(stream, "Switch");
+    std::ostringstream location;
+    location << "switch" << bbox.p1;
+    Sector::current()->run_script(stream, location.str());
 
     sprite->set_action("on", 1);
     state = ON;