1
0
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:
Ivan Savenko 2024-11-24 17:15:41 +00:00
parent b529de99ba
commit 1678b137d8

View File

@ -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();
}