diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-04-08 23:15:50 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-04-08 23:17:02 +0300 |
commit | 42323014eaf359f76b388e75e788486bb0bda280 (patch) | |
tree | 46490264492dd1d69fc5b3528f5406d31ae64b08 /src/subgame.cpp | |
parent | c59d139eebf06680bb4ea019b9a952c20e334154 (diff) | |
download | minetest-42323014eaf359f76b388e75e788486bb0bda280.tar.gz minetest-42323014eaf359f76b388e75e788486bb0bda280.tar.bz2 minetest-42323014eaf359f76b388e75e788486bb0bda280.zip |
Support placing a minetest game inside $world/game to allow creating proper adventure maps
Pro-tip: You can open a world in minetest by opening the world.mt file using minetest.
Diffstat (limited to 'src/subgame.cpp')
-rw-r--r-- | src/subgame.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/subgame.cpp b/src/subgame.cpp index 243bdc048..eafa1ec70 100644 --- a/src/subgame.cpp +++ b/src/subgame.cpp @@ -87,6 +87,24 @@ SubgameSpec findSubgame(const std::string &id) return SubgameSpec(id, game_path, mods_paths, game_name); } +SubgameSpec findWorldSubgame(const std::string &world_path) +{ + std::string world_gameid = getWorldGameId(world_path, true); + // See if world contains an embedded game; if so, use it. + std::string world_gamepath = world_path + DIR_DELIM + "game"; + if(fs::PathExists(world_gamepath)){ + SubgameSpec gamespec; + gamespec.id = world_gameid; + gamespec.path = world_gamepath; + gamespec.mods_paths.insert(world_gamepath + DIR_DELIM + "mods"); + gamespec.name = getGameName(world_gamepath); + if(gamespec.name == "") + gamespec.name = "unknown"; + return gamespec; + } + return findSubgame(world_gameid); +} + std::set<std::string> getAvailableGameIds() { std::set<std::string> gameids; |