{
std::unique_ptr<World> world(new World);
- world->load_(directory + "/info");
+ world->load_(directory);
{ // generate savegame filename
std::string worlddirname = FileSystem::basename(directory);
}
World::World() :
- m_worldmap_filename(),
m_levels(),
m_basedir(),
+ m_worldmap_filename(),
m_savegame_filename(),
m_world_thread(),
m_title(),
}
void
-World::load_(const std::string& filename)
+World::load_(const std::string& directory)
{
- m_basedir = FileSystem::dirname(filename);
- m_worldmap_filename = m_basedir + "worldmap.stwm";
+ m_basedir = directory;
+ m_worldmap_filename = m_basedir + "/worldmap.stwm";
lisp::Parser parser;
- const lisp::Lisp* root = parser.parse(filename);
+ const lisp::Lisp* root = parser.parse(m_basedir + "/info");
const lisp::Lisp* info = root->get_lisp("supertux-world");
if(info == NULL)
{
// fallback: try to load worldmap worldmap.stwm
g_screen_manager->push_screen(std::unique_ptr<Screen>(
- new worldmap::WorldMap(m_basedir + "worldmap.stwm",
+ new worldmap::WorldMap(m_worldmap_filename,
get_player_status())));
}
}
private:
World();
- void load_(const std::string& filename);
+ void load_(const std::string& directory);
public:
/**
bool is_levelset() const { return m_is_levelset; }
private:
- std::string m_worldmap_filename;
struct Level
{
Level() : fullpath(), name() {}
std::vector<Level> m_levels;
std::string m_basedir;
+ std::string m_worldmap_filename;
std::string m_savegame_filename;
HSQOBJECT m_world_thread;
std::string m_title;