1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Fix: Creature resolution failed when mod is in the custom directory

This commit is contained in:
Dmitry Orlov
2020-12-13 03:33:28 +03:00
parent 6bf0bea286
commit ef6220ebec
4 changed files with 49 additions and 37 deletions

View File

@@ -37,6 +37,18 @@ void JsonDeserializer::serializeInternal(const std::string & fieldName, si32 & v
if(identifier != "")
{
si32 rawId = decoder(identifier);
if(rawId < 0) //may be, user has installed the mod into another directory...
{
auto internalId = vstd::splitStringToPair(identifier, ':').second;
auto currentScope = getCurrent().meta;
auto actualId = currentScope.length() > 0 ? currentScope + ":" + internalId : internalId;
rawId = decoder(actualId);
if(rawId >= 0)
logMod->warn("Identifier %s has been resolved as %s instead of %s", internalId, actualId, identifier);
}
if(rawId >= 0)
value = rawId;
}