From: Ingo Ruhnke Date: Sat, 17 Apr 2004 20:41:18 +0000 (+0000) Subject: - fixed loadgame X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=2bfbd8758c9711db09d2f952377ceb8e50c05585;p=supertux.git - fixed loadgame SVN-Revision: 547 --- diff --git a/src/worldmap.cpp b/src/worldmap.cpp index abf95b23f..7ee5449a4 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -517,8 +517,12 @@ WorldMap::draw(const Point& offset) for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) { - leveldot_green->draw(i->x*32 + offset.x, - i->y*32 + offset.y); + if (i->solved) + leveldot_green->draw(i->x*32 + offset.x, + i->y*32 + offset.y); + else + leveldot_red->draw(i->x*32 + offset.x, + i->y*32 + offset.y); } tux->draw(offset); @@ -673,16 +677,25 @@ WorldMap::loadgame(const std::string& filename) { while(level_cur) { - std::string name; - bool solved = false; - LispReader level_reader(level_cur); - level_reader.read_string("name", &name); - level_reader.read_bool("solved", &solved); + lisp_object_t* sym = lisp_car(lisp_car(level_cur)); + lisp_object_t* data = lisp_cdr(lisp_car(level_cur)); - for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) + if (strcmp(lisp_symbol(sym), "level") == 0) { - if (name == i->name) - i->solved = solved; + std::string name; + bool solved = false; + + LispReader level_reader(data); + level_reader.read_string("name", &name); + level_reader.read_bool("solved", &solved); + + std::cout << "Name: " << name << " " << solved << std::endl; + + for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) + { + if (name == i->name) + i->solved = solved; + } } level_cur = lisp_cdr(level_cur);