Bläddra i källkod

Fix initialization of visitDir in templates

Ivan Savenko 2 år sedan
förälder
incheckning
8b2d336562

+ 5 - 0
config/objects/dwellings.json

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

+ 6 - 6
lib/mapObjects/CObjectClassesHandler.cpp

@@ -359,13 +359,13 @@ void CObjectClassesHandler::beforeValidate(JsonNode & object)
 		{
 			auto const & vector = object["subObjects"].Vector();
 
-			if (!entry.second.Struct().count("index"))
-				continue;
-
-			size_t index = entry.second["index"].Integer();
+			if (entry.second.Struct().count("index"))
+			{
+				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"]);

+ 3 - 0
lib/mapObjects/ObjectTemplate.cpp

@@ -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