1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Add workaround & logging for mods that use incorrect building ID's

This commit is contained in:
Ivan Savenko
2025-07-20 16:21:53 +03:00
parent 7fcb0246fb
commit 81d09aee14

View File

@@ -889,6 +889,13 @@ void CTownHandler::beforeValidate(JsonNode & object)
return;
JsonNode baseCopy(buildingsLibrary[name]);
if (target.Struct().count("id") && baseCopy.Struct().count("id"))
{
logMod->warn("Mod '%s': Town building '%s' has specified 'id' field for a predefined building! Ignoring this field.", target["id"].getModScope(), name);
target.Struct().erase("id");
}
baseCopy.setModScope(target.getModScope());
JsonUtils::inherit(target, baseCopy);
};