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

Add hero placeholder properties

This commit is contained in:
nordsoft
2023-10-16 22:24:12 +02:00
parent 02c1425939
commit f6d7755c6a
6 changed files with 105 additions and 4 deletions

View File

@@ -40,6 +40,25 @@
VCMI_LIB_NAMESPACE_BEGIN
void CGHeroPlaceholder::serializeJsonOptions(JsonSerializeFormat & handler)
{
bool isHeroType = heroType.has_value();
handler.serializeBool("placeholderType", isHeroType, false);
if(!handler.saving)
{
if(isHeroType)
heroType = HeroTypeID::NONE;
else
powerRank = 0;
}
if(isHeroType)
handler.serializeId("heroType", heroType.value(), HeroTypeID::NONE);
else
handler.serializeInt("powerRank", powerRank.value());
}
static int lowestSpeed(const CGHeroInstance * chi)
{
static const CSelector selectorSTACKS_SPEED = Selector::type()(BonusType::STACKS_SPEED);