mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Remove any modification of enabled mods during game loading
This commit is contained in:
@@ -481,7 +481,7 @@ void CModHandler::trySetActiveMods(const std::vector<std::pair<TModID, CModInfo:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<TModID> newActiveMods, missingMods, excessiveMods;
|
std::vector<TModID> missingMods, excessiveMods;
|
||||||
ModIncompatibility::ModListWithVersion missingModsResult;
|
ModIncompatibility::ModListWithVersion missingModsResult;
|
||||||
ModIncompatibility::ModList excessiveModsResult;
|
ModIncompatibility::ModList excessiveModsResult;
|
||||||
|
|
||||||
@@ -492,10 +492,7 @@ void CModHandler::trySetActiveMods(const std::vector<std::pair<TModID, CModInfo:
|
|||||||
|
|
||||||
//TODO: support actual disabling of these mods
|
//TODO: support actual disabling of these mods
|
||||||
if(getModInfo(m).checkModGameplayAffecting())
|
if(getModInfo(m).checkModGameplayAffecting())
|
||||||
{
|
|
||||||
excessiveMods.push_back(m);
|
excessiveMods.push_back(m);
|
||||||
allMods[m].setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(const auto & infoPair : modList)
|
for(const auto & infoPair : modList)
|
||||||
@@ -523,10 +520,7 @@ void CModHandler::trySetActiveMods(const std::vector<std::pair<TModID, CModInfo:
|
|||||||
bool modLocalyEnabled = vstd::contains(activeMods, remoteModId);
|
bool modLocalyEnabled = vstd::contains(activeMods, remoteModId);
|
||||||
|
|
||||||
if(modVersionCompatible && modAffectsGameplay && modLocalyEnabled)
|
if(modVersionCompatible && modAffectsGameplay && modLocalyEnabled)
|
||||||
{
|
|
||||||
newActiveMods.push_back(remoteModId);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if(modAffectsGameplay)
|
if(modAffectsGameplay)
|
||||||
missingMods.push_back(remoteModId); //incompatible mod impacts gameplay
|
missingMods.push_back(remoteModId); //incompatible mod impacts gameplay
|
||||||
@@ -555,11 +549,7 @@ void CModHandler::trySetActiveMods(const std::vector<std::pair<TModID, CModInfo:
|
|||||||
if(!missingModsResult.empty() || !excessiveModsResult.empty())
|
if(!missingModsResult.empty() || !excessiveModsResult.empty())
|
||||||
throw ModIncompatibility(missingModsResult, excessiveModsResult);
|
throw ModIncompatibility(missingModsResult, excessiveModsResult);
|
||||||
|
|
||||||
//TODO: support actual enabling of these mods
|
//TODO: support actual enabling of required mods
|
||||||
for(auto & m : newActiveMods)
|
|
||||||
allMods[m].setEnabled(true);
|
|
||||||
|
|
||||||
std::swap(activeMods, newActiveMods);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|||||||
Reference in New Issue
Block a user