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

Ignore illegal 'index' entries in mods

This commit is contained in:
Ivan Savenko
2024-01-04 23:52:01 +02:00
parent ef5686634d
commit 3b66701ffe
2 changed files with 20 additions and 10 deletions

View File

@ -115,11 +115,13 @@ bool ContentTypeHandler::loadMod(const std::string & modName, bool validate)
continue;
}
if (vstd::contains(data.Struct(), "index") && !data["index"].isNull())
{
if (modName != "core")
logMod->warn("Mod %s is attempting to load original data! This should be reserved for built-in mod.", modName);
bool hasIndex = vstd::contains(data.Struct(), "index") && !data["index"].isNull();
if (hasIndex && modName != "core")
logMod->error("Mod %s is attempting to load original data! This option is reserved for built-in mod.", modName);
if (hasIndex && modName == "core")
{
// try to add H3 object data
size_t index = static_cast<size_t>(data["index"].Float());