1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

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

This commit is contained in:
Ivan Savenko 2014-08-04 14:47:42 +03:00
parent 68e9cbd3a6
commit 33acdc51bb
2 changed files with 7 additions and 2 deletions

View File

@ -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" },

View File

@ -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());
});
}