1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +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

@@ -249,7 +249,7 @@ void Rewardable::Limiter::serializeJson(JsonSerializeFormat & handler)
std::vector<std::pair<SecondarySkill, si32>> fieldValue(secondary.begin(), secondary.end());
a.serializeStruct<std::pair<SecondarySkill, si32>>(fieldValue, [](JsonSerializeFormat & h, std::pair<SecondarySkill, si32> & e)
{
h.serializeId("skill", e.first, SecondarySkill{}, VLC->skillh->decodeSkill, VLC->skillh->encodeSkill);
h.serializeId("skill", e.first, SecondarySkill(SecondarySkill::NONE));
h.serializeId("level", e.second, 0, [](const std::string & i){return vstd::find_pos(NSecondarySkill::levels, i);}, [](si32 i){return NSecondarySkill::levels.at(i);});
});
a.syncSize(fieldValue);