#include "supertux/savegame.hpp"
+#include <algorithm>
+
#include "lisp/lisp.hpp"
#include "lisp/parser.hpp"
#include "lisp/writer.hpp"
#include "physfs/ifile_streambuf.hpp"
+#include "scripting/scripting.hpp"
#include "scripting/serialize.hpp"
#include "scripting/squirrel_util.hpp"
-#include "scripting/squirrel_util.hpp"
#include "supertux/player_status.hpp"
#include "util/file_system.hpp"
#include "util/log.hpp"
{
sq_pushstring(vm, name.c_str(), -1);
sq_newtable(vm);
- if(SQ_FAILED(sq_newslot(vm, -3, SQFalse)))
+ if(SQ_FAILED(sq_createslot(vm, -3)))
{
throw std::runtime_error("failed to create '" + name + "' table entry");
}
// delete existing state table, if it exists
sq_pushroottable(vm);
{
- /*sq_pushstring(vm, "state", -1);
- if(SQ_FAILED(sq_deleteslot(vm, -2, SQFalse)))
- {
- sq_pop(vm, 1);
- }*/
-
// create a new empty state table
sq_pushstring(vm, "state", -1);
sq_newtable(vm);
- if(SQ_FAILED(sq_newslot(vm, -3, SQFalse)))
+ if(SQ_FAILED(sq_createslot(vm, -3)))
{
throw std::runtime_error("Couldn't create state table");
}
get_or_create_table_entry(vm, "levels");
get_or_create_table_entry(vm, level_filename);
- scripting::store_bool(vm, "solved", solved);
+ bool old_solved = false;
+ scripting::get_bool(vm, "solved", old_solved);
+ scripting::store_bool(vm, "solved", solved || old_solved);
}
catch(const std::exception& err)
{