1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-08 22:26:51 +02:00

Load unknown objects as "Nothing" object

This commit is contained in:
Ivan Savenko
2025-01-20 11:10:39 +00:00
parent e4505f20b9
commit baa9b1e312
2 changed files with 18 additions and 0 deletions

View File

@@ -405,6 +405,8 @@ public:
enum Type
{
NO_OBJ = -1,
NOTHING = 0,
ALTAR_OF_SACRIFICE [[deprecated]] = 2,
ANCHOR_POINT = 3,
ARENA = 4,

View File

@@ -116,6 +116,22 @@ void MapIdentifiersH3M::remapTemplate(ObjectTemplate & objectTemplate)
objectTemplate.subid = mappedType.subID;
}
if (VLC->objtypeh->knownObjects().count(objectTemplate.id) == 0)
{
logGlobal->warn("Unknown object found: %d | %d", objectTemplate.id, objectTemplate.subid);
objectTemplate.id = Obj::NOTHING;
objectTemplate.subid = {};
}
else
{
if (VLC->objtypeh->knownSubObjects(objectTemplate.id).count(objectTemplate.subid) == 0)
{
logGlobal->warn("Unknown subobject found: %d | %d", objectTemplate.id, objectTemplate.subid);
objectTemplate.subid = {};
}
}
if (objectTemplate.id == Obj::TOWN || objectTemplate.id == Obj::RANDOM_DWELLING_FACTION)
objectTemplate.subid = remap(FactionID(objectTemplate.subid));