[Super-tux-commit] supertux/src title.cpp,1.118,1.119 worldmap.cpp,1.120,1.121
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-09-18 12:13:18
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9487/src Modified Files: title.cpp worldmap.cpp Log Message: Contrib worldmaps are now being saved. TODO: a slot based saving might be neat. Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.118 retrieving revision 1.119 diff -u -d -r1.118 -r1.119 --- title.cpp 17 Sep 2004 18:55:03 -0000 1.118 +++ title.cpp 18 Sep 2004 12:13:09 -0000 1.119 @@ -189,8 +189,20 @@ std::set<std::string>::iterator it = worldmap_list.begin(); for(int i = index - contrib_subsets.size(); i > 0; --i) ++it; - worldmap.loadmap((*it)); - worldmap.display(); + + std::string map_filename = *it; + + worldmap.loadmap(map_filename); + + // hack to erase the extension + unsigned int ext_pos = it->find_last_of("."); + if(ext_pos != std::string::npos) + map_filename.erase(ext_pos, map_filename.size() - ext_pos); + + // TODO: slots should be available for contrib maps + worldmap.loadgame(st_save_dir + "/" + map_filename + "-slot1.stsg"); + + worldmap.display(); // run the map Menu::set_current(main_menu); } Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.120 retrieving revision 1.121 diff -u -d -r1.120 -r1.121 --- worldmap.cpp 17 Sep 2004 18:56:06 -0000 1.120 +++ worldmap.cpp 18 Sep 2004 12:13:09 -0000 1.121 @@ -1254,7 +1254,6 @@ { std::cout << "loadgame: " << filename << std::endl; savegame_file = filename; - map_filename = "icyisland.stwm"; if (access(filename.c_str(), F_OK) != 0) { @@ -1282,8 +1281,10 @@ LispReader reader(cur); /* Get the Map filename and then load it before setting special_tile settings */ + std::string cur_map_filename = map_filename; reader.read_string("map", map_filename); - load_map(); + if(cur_map_filename != map_filename) + load_map(); reader.read_int("lives", player_status.lives); reader.read_int("distros", player_status.distros); |