1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

Launcher now supports submods. See forum thread for details.

This commit is contained in:
Ivan Savenko
2014-03-20 17:06:25 +00:00
parent fe1b16a7ec
commit 333a51a48a
10 changed files with 272 additions and 132 deletions

View File

@ -668,7 +668,7 @@ std::vector<std::string> CModHandler::getModList(std::string path)
return foundMods;
}
void CModHandler::loadMods(std::string path, std::string parent, const JsonNode & modSettings)
void CModHandler::loadMods(std::string path, std::string parent, const JsonNode & modSettings, bool enableMods)
{
for (std::string modName : getModList(path))
{
@ -682,11 +682,10 @@ void CModHandler::loadMods(std::string path, std::string parent, const JsonNode
mod.dependencies.insert(parent);
allMods[modFullName] = mod;
if (mod.enabled)
{
if (mod.enabled && enableMods)
activeMods.push_back(modFullName);
loadMods(CModInfo::getModDir(modFullName) + '/', modFullName, modSettings[modName]["mods"]);
}
loadMods(CModInfo::getModDir(modFullName) + '/', modFullName, modSettings[modName]["mods"], enableMods && mod.enabled);
}
}
}
@ -695,7 +694,7 @@ void CModHandler::loadMods()
{
const JsonNode modConfig = loadModSettings("config/modSettings.json");
loadMods("", "", modConfig["activeMods"]);
loadMods("", "", modConfig["activeMods"], true);
coreMod = CModInfo("core", modConfig["core"], JsonNode(ResourceID("config/gameConfig.json")));
coreMod.name = "Original game files";