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);
}
{
std::cout << "loadgame: " << filename << std::endl;
savegame_file = filename;
- map_filename = "icyisland.stwm";
if (access(filename.c_str(), F_OK) != 0)
{
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);