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

Added workaround for references to old 'torosar ' ID

This commit is contained in:
Ivan Savenko 2024-02-05 21:56:06 +02:00
parent 9e09fe08e1
commit a18f9d1e8d
2 changed files with 8 additions and 0 deletions

View File

@ -70,6 +70,7 @@
"torosar":
{
"index": 36,
"compatibilityIdentifiers" : [ "torosar " ],
"class" : "alchemist",
"female": false,
"spellbook": [ "magicArrow" ],

View File

@ -326,6 +326,8 @@ CHeroClass * CHeroClassHandler::loadFromJson(const std::string & scope, const Js
{
JsonNode classConf = node["mapObject"];
classConf["heroClass"].String() = identifier;
if (!node["compatibilityIdentifiers"].isNull())
classConf["compatibilityIdentifiers"] = node["compatibilityIdentifiers"];
classConf.setMeta(scope);
VLC->objtypeh->loadSubObject(identifier, classConf, index, heroClass->getIndex());
});
@ -756,6 +758,9 @@ void CHeroHandler::loadObject(std::string scope, std::string name, const JsonNod
objects.emplace_back(object);
registerObject(scope, "hero", name, object->getIndex());
for(const auto & compatID : data["compatibilityIdentifiers"].Vector())
registerObject(scope, "hero", compatID.String(), object->getIndex());
}
void CHeroHandler::loadObject(std::string scope, std::string name, const JsonNode & data, size_t index)
@ -767,6 +772,8 @@ void CHeroHandler::loadObject(std::string scope, std::string name, const JsonNod
objects[index] = object;
registerObject(scope, "hero", name, object->getIndex());
for(const auto & compatID : data["compatibilityIdentifiers"].Vector())
registerObject(scope, "hero", compatID.String(), object->getIndex());
}
ui32 CHeroHandler::level (TExpType experience) const