From 23cb47b457f97f3f75f33dac5a232237d6876b3f Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 21 Dec 2022 12:58:40 +0200 Subject: [PATCH] Fixed several scenarios with incorrect scope for requesting identifiers --- lib/GameConstants.cpp | 2 +- lib/mapObjects/CGHeroInstance.cpp | 2 +- lib/spells/CSpellHandler.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/GameConstants.cpp b/lib/GameConstants.cpp index e4374656c..38c00d67e 100644 --- a/lib/GameConstants.cpp +++ b/lib/GameConstants.cpp @@ -62,7 +62,7 @@ namespace GameConstants si32 HeroTypeID::decode(const std::string & identifier) { - auto rawId = VLC->modh->identifiers.getIdentifier(CModHandler::scopeBuiltin(), "hero", identifier); + auto rawId = VLC->modh->identifiers.getIdentifier(CModHandler::scopeMap(), "hero", identifier); if(rawId) return rawId.get(); else diff --git a/lib/mapObjects/CGHeroInstance.cpp b/lib/mapObjects/CGHeroInstance.cpp index c784b249e..e876b1cdc 100644 --- a/lib/mapObjects/CGHeroInstance.cpp +++ b/lib/mapObjects/CGHeroInstance.cpp @@ -1413,7 +1413,7 @@ void CGHeroInstance::setHeroTypeName(const std::string & identifier) { if(ID == Obj::HERO || ID == Obj::PRISON) { - auto rawId = VLC->modh->identifiers.getIdentifier(CModHandler::scopeBuiltin(), "hero", identifier); + auto rawId = VLC->modh->identifiers.getIdentifier(CModHandler::scopeMap(), "hero", identifier); if(rawId) subID = rawId.get(); diff --git a/lib/spells/CSpellHandler.cpp b/lib/spells/CSpellHandler.cpp index 678523cd5..39321516b 100644 --- a/lib/spells/CSpellHandler.cpp +++ b/lib/spells/CSpellHandler.cpp @@ -763,7 +763,7 @@ CSpell * CSpellHandler::loadFromJson(const std::string & scope, const JsonNode & { if(counteredSpell.second.Bool()) { - VLC->modh->identifiers.requestIdentifier(json.meta, counteredSpell.first, [=](si32 id) + VLC->modh->identifiers.requestIdentifier(counteredSpell.second.meta, counteredSpell.first, [=](si32 id) { spell->counteredSpells.push_back(SpellID(id)); });