From: Christoph Sommer Date: Mon, 16 Apr 2007 17:54:15 +0000 (+0000) Subject: Fixed strange error with saved Tux' state getting reset when quitting to the title... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=be656c839c799bac5ca60dbc9d7a8dda332d5364;p=supertux.git Fixed strange error with saved Tux' state getting reset when quitting to the title screen: Worldmaps dumped the (global) player state when they were destroyed, but the screen manager delayed their destruction. SVN-Revision: 4987 --- diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index 8cc033ffa..2f5d3aa50 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -178,8 +178,6 @@ WorldMap::~WorldMap() { using namespace Scripting; - save_state(); - for(GameObjects::iterator i = game_objects.begin(); i != game_objects.end(); ++i) { GameObject* object = *i; @@ -875,9 +873,12 @@ WorldMap::setup() void WorldMap::leave() { - // remove worldmap_table from roottable using namespace Scripting; + // save state of world and player + save_state(); + + // remove worldmap_table from roottable sq_pushroottable(global_vm); sq_pushstring(global_vm, "worldmap", -1); if(SQ_FAILED(sq_deleteslot(global_vm, -2, SQFalse)))