From 42323014eaf359f76b388e75e788486bb0bda280 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 8 Apr 2012 23:15:50 +0300 Subject: 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. --- src/subgame.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/subgame.cpp') 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 getAvailableGameIds() { std::set gameids; -- cgit v1.2.3