1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +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, "index" :20,
"handler": "dwelling", "handler": "dwelling",
"lastReservedIndex" : 1, "lastReservedIndex" : 1,
"base" : {
"base" : {
"visitableFrom" : [ "---", "+++", "+++" ]
}
},
"types" : { "types" : {
"elementalConflux" : { "elementalConflux" : {
"index" : 0, "index" : 0,

View File

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

View File

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