Aborting a level no longer resets Tux to the last finished level: Engine now updates...
authorChristoph Sommer <mail@christoph-sommer.de>
Mon, 8 Jan 2007 22:14:11 +0000 (22:14 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Mon, 8 Jan 2007 22:14:11 +0000 (22:14 +0000)
SVN-Revision: 4537

src/worldmap/worldmap.cpp

index 94513d2..28e39a7 100644 (file)
@@ -431,8 +431,6 @@ WorldMap::finished_level(Level* gamelevel)
   calculate_total_stats();
 
   save_state();
-  if(World::current() != NULL)
-    World::current()->save_state();
 
   if (old_level_state != level->solved && level->auto_path) {
     // Try to detect the next direction to which we should walk
@@ -581,6 +579,10 @@ WorldMap::update(float delta)
             Vector shrinkpos = Vector(level->pos.x*32 + 16 - camera_offset.x,
                                       level->pos.y*32 + 16 - camera_offset.y);
             std::string levelfile = levels_path + level->get_name();
+
+            // update state and savegame
+            save_state();
+
             main_loop->push_screen(new GameSession(levelfile, &level->statistics),
                                    new ShrinkFade(shrinkpos, 0.5));
             in_level = true;
@@ -954,6 +956,9 @@ WorldMap::save_state()
   }
 
   sq_settop(vm, oldtop);
+  
+  if(World::current() != NULL)
+    World::current()->save_state();
 }
 
 void