From 591527d8787b6dfaafd2113bc001fe892b3eb0fb Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 13 Mar 2012 00:06:37 +0200 Subject: World creation button and dialog and functionality --- src/subgame.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/subgame.cpp') diff --git a/src/subgame.cpp b/src/subgame.cpp index 2fa3b7944..58881ecb8 100644 --- a/src/subgame.cpp +++ b/src/subgame.cpp @@ -46,7 +46,9 @@ SubgameSpec findSubgame(const std::string &id) + DIR_DELIM + id); addon_paths.insert(user_server + DIR_DELIM + "addons" + DIR_DELIM + id); - return SubgameSpec(id, game_path, addon_paths); + // TODO: Read proper name from game_path/game.conf + std::string game_name = id; + return SubgameSpec(id, game_path, addon_paths, game_name); } std::set getAvailableGameIds() @@ -69,6 +71,16 @@ std::set getAvailableGameIds() return gameids; } +std::vector getAvailableGames() +{ + std::vector specs; + std::set gameids = getAvailableGameIds(); + for(std::set::const_iterator i = gameids.begin(); + i != gameids.end(); i++) + specs.push_back(findSubgame(*i)); + return specs; +} + #define LEGACY_GAMEID "mesetint" std::string getWorldGameId(const std::string &world_path, bool can_be_legacy) @@ -132,4 +144,18 @@ std::vector getAvailableWorlds() return worlds; } +bool initializeWorld(const std::string &path, const std::string &gameid) +{ + infostream<<"Initializing world at "<