1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fix initialization of visitDir in templates

This commit is contained in:
Ivan Savenko 2023-01-20 02:07:22 +02:00
parent a3846f1b31
commit 8b2d336562
3 changed files with 14 additions and 6 deletions

View File

@ -530,6 +530,11 @@
"index" :20,
"handler": "dwelling",
"lastReservedIndex" : 1,
"base" : {
"base" : {
"visitableFrom" : [ "---", "+++", "+++" ]
}
},
"types" : {
"elementalConflux" : {
"index" : 0,

View File

@ -359,13 +359,13 @@ void CObjectClassesHandler::beforeValidate(JsonNode & object)
{
auto const & vector = object["subObjects"].Vector();
if (!entry.second.Struct().count("index"))
continue;
if (entry.second.Struct().count("index"))
{
size_t index = entry.second["index"].Integer();
size_t index = entry.second["index"].Integer();
if (index < vector.size())
JsonUtils::inherit(entry.second, vector[index]);
if (index < vector.size())
JsonUtils::inherit(entry.second, vector[index]);
}
}
JsonUtils::inherit(entry.second, object["base"]);

View File

@ -559,6 +559,9 @@ void ObjectTemplate::recalculate()
calculateBlockedOffsets();
calculateBlockMapOffset();
calculateVisitableOffset();
if (visitable && visitDir == 0)
logMod->warn("Template for %s is visitable but has no visitable directions!", animationFile);
}
VCMI_LIB_NAMESPACE_END