mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Added possibility to add custom components to reward description.
Used to properly display morale/luck rewards since bonuses don't provide components associated with them.
This commit is contained in:
parent
cb5b5a05c1
commit
2c8af871fc
@ -322,6 +322,9 @@ bool CObjectWithReward::wasVisited (const CGHeroInstance * h) const
|
||||
|
||||
void CRewardInfo::loadComponents(std::vector<Component> & comps) const
|
||||
{
|
||||
for (auto comp : extraComponents)
|
||||
comps.push_back(comp);
|
||||
|
||||
for (size_t i=0; i<resources.size(); i++)
|
||||
{
|
||||
if (resources[i] !=0)
|
||||
@ -589,6 +592,10 @@ void CGBonusingObject::initObj()
|
||||
{
|
||||
Bonus b(duration, type, Bonus::OBJECT, value, ID, descrID != 0 ? VLC->generaltexth->advobtxt[descrID] : "");
|
||||
visit.reward.bonuses.push_back(b);
|
||||
if (type == Bonus::MORALE)
|
||||
visit.reward.extraComponents.push_back(Component(Component::MORALE, 0, value, 0));
|
||||
if (type == Bonus::LUCK)
|
||||
visit.reward.extraComponents.push_back(Component(Component::LUCK, 0, value, 0));
|
||||
};
|
||||
|
||||
auto configureBonus = [&](CVisitInfo & visit, Bonus::BonusType type, si32 value, si32 descrID)
|
||||
|
@ -93,6 +93,9 @@ public:
|
||||
std::vector<SpellID> spells;
|
||||
std::vector<CStackBasicDescriptor> creatures;
|
||||
|
||||
/// list of components that will be added to reward description. First entry in list will override displayed component
|
||||
std::vector<Component> extraComponents;
|
||||
|
||||
/// Generates list of components that describes reward
|
||||
virtual void loadComponents(std::vector<Component> & comps) const;
|
||||
Component getDisplayedComponent() const;
|
||||
|
Loading…
Reference in New Issue
Block a user