1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Fixes for loading 1.5 mods in vcmi 1.6

This commit is contained in:
Ivan Savenko 2024-10-10 09:50:56 +00:00
parent 7694e2da4b
commit a22de74323
2 changed files with 9 additions and 4 deletions

View File

@ -883,8 +883,8 @@ void CTownHandler::beforeValidate(JsonNode & object)
if (building.second.Struct().count("onVisitBonuses"))
{
building.second["configuration"]["visitMode"] = JsonNode("bonus");
building.second["configuration"]["visitMode"]["rewards"][0]["message"] = building.second["description"];
building.second["configuration"]["visitMode"]["rewards"][0]["bonuses"] = building.second["onVisitBonuses"];
building.second["configuration"]["rewards"][0]["message"] = building.second["description"];
building.second["configuration"]["rewards"][0]["bonuses"] = building.second["onVisitBonuses"];
}
}
}

View File

@ -207,8 +207,13 @@ TObjectTypeHandler CObjectClassesHandler::loadSubObjectFromJson(const std::strin
// Compatibility with 1.5 mods for 1.6. To be removed in 1.7
// Detect banks that use old format and load them using old bank hander
if (baseObject->id == Obj::CREATURE_BANK && entry.Struct().count("levels") && !entry.Struct().count("rewards"))
handler = "bank";
if (baseObject->id == Obj::CREATURE_BANK)
{
if (entry.Struct().count("levels") && !entry.Struct().count("rewards"))
handler = "bank";
else
handler = "configurable";
}
auto createdObject = handlerConstructors.at(handler)();