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

Compatiblity for last version of Cove (and likely any other town mods)

This commit is contained in:
Ivan Savenko 2014-06-27 00:07:09 +03:00
parent 20b0dd6211
commit bac83d8bd0

View File

@ -688,7 +688,19 @@ void CTownHandler::loadObject(std::string scope, std::string name, const JsonNod
JsonNode config = data["town"]["mapObject"]; JsonNode config = data["town"]["mapObject"];
config["faction"].String() = object->identifier; config["faction"].String() = object->identifier;
config["faction"].meta = scope; config["faction"].meta = scope;
if (config.meta.empty())// MODS COMPATIBILITY FOR 0.96
config.meta = scope;
VLC->objtypeh->loadSubObject(object->identifier, config, index, object->index); VLC->objtypeh->loadSubObject(object->identifier, config, index, object->index);
// MODS COMPATIBILITY FOR 0.96
auto & advMap = data["town"]["adventureMap"];
if (!advMap.isNull())
{
logGlobal->warnStream() << "Outdated town mod. Will try to generate valid templates out of fort";
JsonNode config;
config["animation"] = advMap["castle"];
VLC->objtypeh->getHandlerFor(index, object->index)->addTemplate(config);
}
}); });
} }
@ -717,15 +729,6 @@ void CTownHandler::loadObject(std::string scope, std::string name, const JsonNod
config["faction"].String() = object->identifier; config["faction"].String() = object->identifier;
config["faction"].meta = scope; config["faction"].meta = scope;
VLC->objtypeh->loadSubObject(object->identifier, config, index, object->index); VLC->objtypeh->loadSubObject(object->identifier, config, index, object->index);
// MODS COMPATIBILITY FOR 0.96
auto & advMap = data["town"]["adventureMap"];
if (!advMap["fort"].isNull())
{
JsonNode config;
config["appearance"] = advMap["fort"];
VLC->objtypeh->getHandlerFor(index, object->index)->addTemplate(config);
}
}); });
} }