mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix skills loading from mods
This commit is contained in:
parent
3378a3c740
commit
c7ade44d07
@ -123,7 +123,9 @@ namespace JsonRandom
|
|||||||
std::set<std::string> defaultStats(std::begin(PrimarySkill::names), std::end(PrimarySkill::names));
|
std::set<std::string> defaultStats(std::begin(PrimarySkill::names), std::end(PrimarySkill::names));
|
||||||
for(const auto & element : value.Vector())
|
for(const auto & element : value.Vector())
|
||||||
{
|
{
|
||||||
int id = vstd::find_pos(PrimarySkill::names, loadKey(element, rng, defaultStats));
|
auto key = loadKey(element, rng, defaultStats);
|
||||||
|
defaultStats.erase(key);
|
||||||
|
int id = vstd::find_pos(PrimarySkill::names, key);
|
||||||
if(id != -1)
|
if(id != -1)
|
||||||
ret[id] += loadValue(element, rng);
|
ret[id] += loadValue(element, rng);
|
||||||
}
|
}
|
||||||
@ -153,10 +155,15 @@ namespace JsonRandom
|
|||||||
|
|
||||||
for(const auto & element : value.Vector())
|
for(const auto & element : value.Vector())
|
||||||
{
|
{
|
||||||
SecondarySkill id(VLC->modh->identifiers.getIdentifier(element.meta, "skill", loadKey(element, rng, defaultSkills)).value());
|
auto key = loadKey(element, rng, defaultSkills);
|
||||||
|
defaultSkills.erase(key); //avoid dupicates
|
||||||
|
if(auto identifier = VLC->modh->identifiers.getIdentifier(CModHandler::scopeGame(), "skill", key))
|
||||||
|
{
|
||||||
|
SecondarySkill id(identifier.value());
|
||||||
ret[id] = loadValue(element, rng);
|
ret[id] = loadValue(element, rng);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user