Browse Source

Fixes 1852 - fixed typo in tower config and added check to detect such cases

Ivan Savenko 11 years ago
parent
commit
33acdc51bb
2 changed files with 7 additions and 2 deletions
  1. 1 1
      config/factions/tower.json
  2. 6 1
      lib/CTownHandler.cpp

+ 1 - 1
config/factions/tower.json

@@ -180,7 +180,7 @@
 				"dwellingLvl4":   { "id" : 33, "requires" : [ "allOf", [ "mageGuild1" ], [ "dwellingLvl2" ], [ "dwellingLvl3" ] ] },
 				"dwellingLvl5":   { "id" : 34, "requires" : [ "dwellingLvl4" ] },
 				"dwellingLvl6":   { "id" : 35, "requires" : [ "dwellingLvl4" ] },
-				"dwellingLvl7":   { "id" : 36, "requires" : [ "dwellingLvl5", "dwellingLvl6" ] },
+				"dwellingLvl7":   { "id" : 36, "requires" : [ "allOf", [ "dwellingLvl5" ], [ "dwellingLvl6" ] ] },
 
 				"dwellingUpLvl1": { "id" : 37, "upgrades" : "dwellingLvl1" },
 				"dwellingUpLvl2": { "id" : 38, "upgrades" : "dwellingLvl2" },

+ 6 - 1
lib/CTownHandler.cpp

@@ -745,8 +745,13 @@ void CTownHandler::initializeRequirements()
 	// must be done separately after all ID's are known
 	for (auto & requirement : requirementsToLoad)
 	{
-		requirement.building->requirements = CBuilding::TRequired(requirement.json, [&](const JsonNode & node)
+		requirement.building->requirements = CBuilding::TRequired(requirement.json, [&](const JsonNode & node) -> BuildingID
 		{
+			if (node.Vector().size() > 1)
+			{
+				logGlobal->warnStream() << "Unexpected length of town buildings requirements: " << node.Vector().size();
+				logGlobal->warnStream() << "Entry contains " << node;
+			}
 			return BuildingID(VLC->modh->identifiers.getIdentifier("building." + requirement.faction->identifier, node.Vector()[0]).get());
 		});
 	}