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

map editor: Allow to customize hero spells

This commit is contained in:
godric3
2024-03-24 10:01:20 +01:00
parent a373ec6743
commit acceca0139
8 changed files with 469 additions and 7 deletions

View File

@@ -362,6 +362,10 @@ const HeroType * HeroTypeID::toEntity(const Services * services) const
si32 SpellID::decode(const std::string & identifier)
{
if (identifier == "preset")
return SpellID::PRESET;
if (identifier == "spellbook_preset")
return SpellID::SPELLBOOK_PRESET;
return resolveIdentifier("spell", identifier);
}
@@ -369,6 +373,10 @@ std::string SpellID::encode(const si32 index)
{
if (index == -1)
return "";
if (index == SpellID::PRESET)
return "preset";
if (index == SpellID::SPELLBOOK_PRESET)
return "spellbook_preset";
return VLC->spells()->getByIndex(index)->getJsonKey();
}