1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Merge remote-tracking branch 'vcmi/beta' into develop

This commit is contained in:
Ivan Savenko
2023-08-18 15:08:23 +03:00
17 changed files with 185 additions and 44 deletions

View File

@ -12,6 +12,7 @@
#include "../CGeneralTextHandler.h"
#include "../VCMI_Lib.h"
#include "../filesystem/Filesystem.h"
VCMI_LIB_NAMESPACE_BEGIN
@ -128,6 +129,48 @@ void CModInfo::loadLocalData(const JsonNode & data)
validation = validated ? PASSED : FAILED;
}
bool CModInfo::checkModGameplayAffecting() const
{
if (modGameplayAffecting.has_value())
return *modGameplayAffecting;
static const std::vector<std::string> keysToTest = {
"heroClasses",
"artifacts",
"creatures",
"factions",
"objects",
"heroes",
"spells",
"skills",
"templates",
"scripts",
"battlefields",
"terrains",
"rivers",
"roads",
"obstacles"
};
ResourceID modFileResource(CModInfo::getModFile(identifier));
if(CResourceHandler::get("initial")->existsResource(modFileResource))
{
const JsonNode modConfig(modFileResource);
for(const auto & key : keysToTest)
{
if (!modConfig[key].isNull())
{
modGameplayAffecting = true;
return *modGameplayAffecting;
}
}
}
modGameplayAffecting = false;
return *modGameplayAffecting;
}
bool CModInfo::isEnabled() const
{
return implicitlyEnabled && explicitlyEnabled;