Tune caves
[oweals/minetest.git] / src / subgame.h
index ba2f235ed607cdd671d8e26680bc42461bb8b498..49e526d76b9f2ab616ff12e6b6f1e2e7d25bec49 100644 (file)
@@ -22,19 +22,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include <string>
 #include <set>
+#include <vector>
 
 struct SubgameSpec
 {
        std::string id; // "" = game does not exist
        std::string path;
-       std::set<std::string> addon_paths;
+       std::set<std::string> mods_paths;
+       std::string name;
 
        SubgameSpec(const std::string &id_="",
                        const std::string &path_="",
-                       const std::set<std::string> &addon_paths_=std::set<std::string>()):
+                       const std::set<std::string> &mods_paths_=std::set<std::string>(),
+                       const std::string &name_=""):
                id(id_),
                path(path_),
-               addon_paths(addon_paths_)
+               mods_paths(mods_paths_),
+               name(name_)
        {}
 
        bool isValid() const
@@ -46,8 +50,38 @@ struct SubgameSpec
 SubgameSpec findSubgame(const std::string &id);
 
 std::set<std::string> getAvailableGameIds();
+std::vector<SubgameSpec> getAvailableGames();
 
-std::string getWorldGameId(const std::string &world_path);
+bool getWorldExists(const std::string &world_path);
+std::string getWorldGameId(const std::string &world_path,
+               bool can_be_legacy=false);
+
+struct WorldSpec
+{
+       std::string path;
+       std::string name;
+       std::string gameid;
+
+       WorldSpec(
+               const std::string &path_="",
+               const std::string &name_="",
+               const std::string &gameid_=""
+       ):
+               path(path_),
+               name(name_),
+               gameid(gameid_)
+       {}
+
+       bool isValid() const
+       {
+               return (name != "" && path != "" && gameid != "");
+       }
+};
+
+std::vector<WorldSpec> getAvailableWorlds();
+
+// Create world directory and world.mt if they don't exist
+bool initializeWorld(const std::string &path, const std::string &gameid);
 
 #endif