fixed the worldmap::save_state bug in another way (throw an exception so people know...
[supertux.git] / src / scripting / functions.cpp
index ecc2bf9..c2f8c98 100644 (file)
@@ -163,14 +163,23 @@ void save_state()
 {
   using namespace WorldMapNS;
 
-  if(World::current() == NULL)
+  if(World::current() == NULL || WorldMap::current() == NULL)
     throw std::runtime_error("Can't save state without active World");
 
-  if(WorldMap::current() != NULL)
-    WorldMap::current()->save_state();
+  WorldMap::current()->save_state();
   World::current()->save_state();
 }
 
+void update_worldmap()
+{
+  using namespace WorldMapNS;
+
+  if(WorldMap::current() == NULL)
+    throw std::runtime_error("Can't update Worldmap: none active");
+
+  WorldMap::current()->load_state();
+}
+
 // not added to header, function to only be used by others
 // in this file
 bool validate_sector_player()
@@ -203,7 +212,7 @@ void grease()
 {
   if (!validate_sector_player()) return;
   ::Player* tux = Sector::current()->player; // Scripting::Player != ::Player
-  tux->physic.vx = tux->physic.vx*3;
+  tux->physic.set_velocity_x(tux->physic.get_velocity_x()*3);
 }
 
 void invincible()