1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Fixes mod install / uninstall / updates

This commit is contained in:
Ivan Savenko
2024-11-15 13:25:36 +00:00
parent 30ed066cea
commit 85ffb449ca
4 changed files with 38 additions and 51 deletions

View File

@@ -192,7 +192,28 @@ bool ModDescription::isInstalled() const
bool ModDescription::affectsGameplay() const
{
return true; // TODO
static const std::array keysToTest = {
"artifacts",
"battlefields",
"creatures",
"factions",
"heroClasses",
"heroes",
"objects",
"obstacles",
"rivers",
"roads",
"settings",
"skills",
"spells",
"terrains",
};
for(const auto & key : keysToTest)
if (!getLocalValue(key).isNull())
return true;
return false;
}
VCMI_LIB_NAMESPACE_END

View File

@@ -503,7 +503,7 @@ void ModManager::tryEnableMod(const TModID & modName)
auto additionalActiveMods = getActiveMods();
assert(!vstd::contains(additionalActiveMods, modName));
assert(vstd::contains(requiredActiveMods, modName));
assert(vstd::contains(requiredActiveMods, modName));// FIXME: fails on attempt to enable broken mod / translation to other language
ModDependenciesResolver testResolver(requiredActiveMods, *modsStorage);
assert(testResolver.getBrokenMods().empty());
@@ -555,6 +555,8 @@ void ModManager::updatePreset(const ModDependenciesResolver & testResolver)
std::vector<TModID> desiredModList = modsPreset->getActiveMods();
depedencyResolver = std::make_unique<ModDependenciesResolver>(desiredModList, *modsStorage);
// TODO: check activation status of submods of new mods
modsPreset->saveConfigurationState();
}