fixed the worldmap::save_state bug in another way (throw an exception so people know...
authorMatthias Braun <matze@braunis.de>
Sun, 28 Jan 2007 10:38:02 +0000 (10:38 +0000)
committerMatthias Braun <matze@braunis.de>
Sun, 28 Jan 2007 10:38:02 +0000 (10:38 +0000)
SVN-Revision: 4694

src/scripting/functions.cpp

index b978813..c2f8c98 100644 (file)
@@ -163,11 +163,10 @@ 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();
 }
 
@@ -175,8 +174,8 @@ void update_worldmap()
 {
   using namespace WorldMapNS;
 
-  if(World::current() == NULL)
-    throw std::runtime_error("Can't save state without active World");
+  if(WorldMap::current() == NULL)
+    throw std::runtime_error("Can't update Worldmap: none active");
 
   WorldMap::current()->load_state();
 }