1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Enabled new secondary skills to be created (#438)

* Universities, Scholars and Witch Huts may offer new skills
* Moved encode/decodeSkill to CSkillHandler
* Refactored CSkill interface and CSkill::LevelInfo image storage
* Legacy game constants renamed to ORIGINAL_XXX_QUANTITY
This commit is contained in:
Henning Koehler
2018-03-31 18:56:40 +13:00
committed by ArseniyShestakov
parent b09a54fa9c
commit 6ddcb079a4
21 changed files with 207 additions and 124 deletions

View File

@@ -15,6 +15,7 @@
#include "../CSoundBase.h"
#include "../spells/CSpellHandler.h"
#include "../CSkillHandler.h"
#include "../StartInfo.h"
#include "../IGameCallback.h"
#include "../StringConstants.h"
@@ -419,7 +420,7 @@ void CGPandoraBox::serializeJsonOptions(JsonSerializeFormat & handler)
for(size_t idx = 0; idx < abilities.size(); idx++)
{
handler.serializeEnum(NSecondarySkill::names[abilities[idx]], abilityLevels[idx], NSecondarySkill::levels);
handler.serializeEnum(CSkillHandler::encodeSkill(abilities[idx]), abilityLevels[idx], NSecondarySkill::levels);
}
}
}
@@ -437,7 +438,7 @@ void CGPandoraBox::serializeJsonOptions(JsonSerializeFormat & handler)
const std::string skillName = p.first;
const std::string levelId = p.second.String();
const int rawId = vstd::find_pos(NSecondarySkill::names, skillName);
const int rawId = CSkillHandler::decodeSkill(skillName);
if(rawId < 0)
{
logGlobal->error("Invalid secondary skill %s", skillName);