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

Serialize identifiers without implicit conversion to int

This commit is contained in:
Ivan Savenko
2023-11-02 16:31:12 +02:00
parent 2b9c362d5b
commit 8f25f1fd4b
8 changed files with 39 additions and 44 deletions

View File

@@ -262,23 +262,4 @@ std::vector<bool> CSkillHandler::getDefaultAllowed() const
return allowedSkills;
}
si32 CSkillHandler::decodeSkill(const std::string & identifier)
{
auto rawId = VLC->identifiers()->getIdentifier(ModScope::scopeMap(), "skill", identifier);
if(rawId)
return rawId.value();
else
return -1;
}
std::string CSkillHandler::encodeSkill(const si32 index)
{
return (*VLC->skillh)[SecondarySkill(index)]->identifier;
}
std::string CSkillHandler::encodeSkillWithType(const si32 index)
{
return ModUtility::makeFullIdentifier("", "skill", encodeSkill(index));
}
VCMI_LIB_NAMESPACE_END