mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fix loading of spell immunity icons for corresponding bonus
This commit is contained in:
@@ -96,6 +96,12 @@ ImagePath CBonusTypeHandler::bonusToGraphics(const std::shared_ptr<Bonus> & bonu
|
|||||||
{
|
{
|
||||||
const CBonusType & bt = bonusTypes[vstd::to_underlying(bonus->type)];
|
const CBonusType & bt = bonusTypes[vstd::to_underlying(bonus->type)];
|
||||||
|
|
||||||
|
if (bonus->type == BonusType::SPELL_IMMUNITY && bonus->subtype.as<SpellID>().hasValue())
|
||||||
|
{
|
||||||
|
const CSpell * sp = bonus->subtype.as<SpellID>().toSpell();
|
||||||
|
return sp->getIconImmune();
|
||||||
|
}
|
||||||
|
|
||||||
if (bt.subtypeIcons.count(bonus->subtype.getNum()))
|
if (bt.subtypeIcons.count(bonus->subtype.getNum()))
|
||||||
return bt.subtypeIcons.at(bonus->subtype.getNum());
|
return bt.subtypeIcons.at(bonus->subtype.getNum());
|
||||||
|
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ bool CSpell::canCastWithoutSkip() const
|
|||||||
return castWithoutSkip;
|
return castWithoutSkip;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string & CSpell::getIconImmune() const
|
const ImagePath & CSpell::getIconImmune() const
|
||||||
{
|
{
|
||||||
return iconImmune;
|
return iconImmune;
|
||||||
}
|
}
|
||||||
@@ -948,7 +948,7 @@ std::shared_ptr<CSpell> CSpellHandler::loadFromJson(const std::string & scope, c
|
|||||||
|
|
||||||
const JsonNode & graphicsNode = json["graphics"];
|
const JsonNode & graphicsNode = json["graphics"];
|
||||||
|
|
||||||
spell->iconImmune = graphicsNode["iconImmune"].String();
|
spell->iconImmune = ImagePath::fromJson(graphicsNode["iconImmune"]);
|
||||||
spell->iconBook = graphicsNode["iconBook"].String();
|
spell->iconBook = graphicsNode["iconBook"].String();
|
||||||
spell->iconEffect = graphicsNode["iconEffect"].String();
|
spell->iconEffect = graphicsNode["iconEffect"].String();
|
||||||
spell->iconScenarioBonus = graphicsNode["iconScenarioBonus"].String();
|
spell->iconScenarioBonus = graphicsNode["iconScenarioBonus"].String();
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ public:
|
|||||||
|
|
||||||
void registerIcons(const IconRegistar & cb) const override;
|
void registerIcons(const IconRegistar & cb) const override;
|
||||||
|
|
||||||
const std::string & getIconImmune() const; ///< Returns resource name of icon for SPELL_IMMUNITY bonus
|
const ImagePath & getIconImmune() const; ///< Returns resource name of icon for SPELL_IMMUNITY bonus
|
||||||
const std::string & getIconBook() const;
|
const std::string & getIconBook() const;
|
||||||
const std::string & getIconEffect() const;
|
const std::string & getIconEffect() const;
|
||||||
const std::string & getIconScenarioBonus() const;
|
const std::string & getIconScenarioBonus() const;
|
||||||
@@ -280,7 +280,7 @@ private:
|
|||||||
spells::AimType targetType;
|
spells::AimType targetType;
|
||||||
|
|
||||||
///graphics related stuff
|
///graphics related stuff
|
||||||
std::string iconImmune;
|
ImagePath iconImmune;
|
||||||
std::string iconBook;
|
std::string iconBook;
|
||||||
std::string iconEffect;
|
std::string iconEffect;
|
||||||
std::string iconScenarioBonus;
|
std::string iconScenarioBonus;
|
||||||
|
|||||||
Reference in New Issue
Block a user