mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-14 10:12:59 +02:00
Automatically enable all applicable compatibility patches
This commit is contained in:
parent
b529de99ba
commit
1678b137d8
@ -376,7 +376,8 @@ ModManager::ModManager(const JsonNode & repositoryList)
|
||||
addNewModsToPreset();
|
||||
|
||||
std::vector<TModID> desiredModList = modsPreset->getActiveMods();
|
||||
depedencyResolver = std::make_unique<ModDependenciesResolver>(desiredModList, *modsStorage);
|
||||
ModDependenciesResolver newResolver(desiredModList, *modsStorage);
|
||||
updatePreset(newResolver);
|
||||
}
|
||||
|
||||
ModManager::~ModManager() = default;
|
||||
@ -572,10 +573,24 @@ void ModManager::updatePreset(const ModDependenciesResolver & testResolver)
|
||||
}
|
||||
|
||||
std::vector<TModID> desiredModList = modsPreset->getActiveMods();
|
||||
|
||||
// Try to enable all existing compatibility patches. Ignore on failure
|
||||
for (const auto & rootMod : modsPreset->getActiveRootMods())
|
||||
{
|
||||
for (const auto & modSetting : modsPreset->getModSettings(rootMod))
|
||||
{
|
||||
if (modSetting.second)
|
||||
continue;
|
||||
|
||||
TModID fullModID = rootMod + '.' + modSetting.first;
|
||||
const auto & modDescription = modsStorage->getMod(fullModID);
|
||||
|
||||
if (modDescription.isCompatibility())
|
||||
desiredModList.push_back(fullModID);
|
||||
}
|
||||
}
|
||||
|
||||
depedencyResolver = std::make_unique<ModDependenciesResolver>(desiredModList, *modsStorage);
|
||||
|
||||
// TODO: check activation status of submods of new mods
|
||||
|
||||
modsPreset->saveConfigurationState();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user