From 253cca379b94575b699e7bc9438f3ad635c98384 Mon Sep 17 00:00:00 2001 From: MrSimbax Date: Thu, 23 Jul 2020 18:07:02 +0200 Subject: [PATCH] List which level subdirectory a mod changes --- src/app/modman.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/modman.cpp b/src/app/modman.cpp index 54596b63..76afa079 100644 --- a/src/app/modman.cpp +++ b/src/app/modman.cpp @@ -281,6 +281,17 @@ void CModManager::LoadModData(Mod& mod) // Changes data.changes = CResourceManager::ListDirectories("temp/mod"); + auto levelsIt = std::find(data.changes.begin(), data.changes.end(), "levels"); + if (levelsIt != data.changes.end()) + { + auto levelsDirs = CResourceManager::ListDirectories("temp/mod/levels"); + if (!levelsDirs.empty()) + { + std::transform(levelsDirs.begin(), levelsDirs.end(), levelsDirs.begin(), [](const std::string& dir) { return "levels/" + dir; }); + levelsIt = data.changes.erase(levelsIt); + data.changes.insert(levelsIt, levelsDirs.begin(), levelsDirs.end()); + } + } } void CModManager::MountMod(const Mod& mod, const std::string& mountPoint)