several bugfixes to squirrel serialisation code, serializer/load worldmap state from...
[supertux.git] / src / scripting / functions.cpp
index c3a4bf8..41e4f0d 100644 (file)
@@ -35,6 +35,7 @@
 #include "msg.hpp"
 #include "mainloop.hpp"
 #include "worldmap.hpp"
+#include "world.hpp"
 
 #include "squirrel_error.hpp"
 #include "wrapper_util.hpp"
@@ -118,5 +119,13 @@ void add_key(int new_key)
   player_status->set_keys(new_key);
 }
 
+void save_state()
+{
+  if(World::current() == NULL)
+    throw std::runtime_error("Can't save state without active World");
+
+  World::current()->save_state();
+}
+
 }