mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-19 21:10:12 +02:00
Do not add non-existing buildings to H3 towns
Such as Mages Guild 4-5 to Fortress, or all 4 special buildings to towns without them
This commit is contained in:
parent
dfa8a956cc
commit
bc624ab654
@ -389,13 +389,10 @@ void CTownHandler::loadBuilding(CTown * town, const std::string & stringID, cons
|
|||||||
|
|
||||||
void CTownHandler::loadBuildings(CTown * town, const JsonNode & source)
|
void CTownHandler::loadBuildings(CTown * town, const JsonNode & source)
|
||||||
{
|
{
|
||||||
if(source.isStruct())
|
for(const auto & node : source.Struct())
|
||||||
{
|
{
|
||||||
for(const auto & node : source.Struct())
|
if (!node.second.isNull())
|
||||||
{
|
loadBuilding(town, node.first, node.second);
|
||||||
if (!node.second.isNull())
|
|
||||||
loadBuilding(town, node.first, node.second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -874,6 +871,9 @@ void CTownHandler::beforeValidate(JsonNode & object)
|
|||||||
|
|
||||||
for (auto & building : object["town"]["buildings"].Struct())
|
for (auto & building : object["town"]["buildings"].Struct())
|
||||||
{
|
{
|
||||||
|
if (building.second.isNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
inheritBuilding(building.first, building.second);
|
inheritBuilding(building.first, building.second);
|
||||||
if (building.second.Struct().count("type"))
|
if (building.second.Struct().count("type"))
|
||||||
inheritBuilding(building.second["type"].String(), building.second);
|
inheritBuilding(building.second["type"].String(), building.second);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user