mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
fix displaying growth bonus from Statue of Legion
This commit is contained in:
@ -1576,7 +1576,7 @@ bool NBonus::hasOfType(const CBonusSystemNode *obj, Bonus::BonusType type, int s
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Bonus::Description() const
|
std::string Bonus::Description(boost::optional<si32> customValue) const
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
|
|
||||||
@ -1615,8 +1615,8 @@ std::string Bonus::Description() const
|
|||||||
str << description;
|
str << description;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(val != 0)
|
if(auto value = customValue.value_or(val))
|
||||||
str << " " << std::showpos << val;
|
str << " " << std::showpos << value;
|
||||||
|
|
||||||
return str.str();
|
return str.str();
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ struct DLL_LINKAGE Bonus : public std::enable_shared_from_this<Bonus>
|
|||||||
return (high << 16) + low;
|
return (high << 16) + low;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Description() const;
|
std::string Description(boost::optional<si32> customValue = {}) const;
|
||||||
JsonNode toJsonNode() const;
|
JsonNode toJsonNode() const;
|
||||||
std::string nameForBonus() const; // generate suitable name for bonus - e.g. for storing in json struct
|
std::string nameForBonus() const; // generate suitable name for bonus - e.g. for storing in json struct
|
||||||
|
|
||||||
|
@ -556,7 +556,10 @@ GrowthInfo CGTownInstance::getGrowthInfo(int level) const
|
|||||||
//statue-of-legion-like bonus: % to base+castle
|
//statue-of-legion-like bonus: % to base+castle
|
||||||
TConstBonusListPtr bonuses2 = getBonuses(Selector::type()(Bonus::CREATURE_GROWTH_PERCENT));
|
TConstBonusListPtr bonuses2 = getBonuses(Selector::type()(Bonus::CREATURE_GROWTH_PERCENT));
|
||||||
for(const auto & b : *bonuses2)
|
for(const auto & b : *bonuses2)
|
||||||
ret.entries.push_back(GrowthInfo::Entry(b->val * (base + castleBonus) / 100, b->Description()));
|
{
|
||||||
|
const auto growth = b->val * (base + castleBonus) / 100;
|
||||||
|
ret.entries.push_back(GrowthInfo::Entry(growth, b->Description(growth)));
|
||||||
|
}
|
||||||
|
|
||||||
//other *-of-legion-like bonuses (%d to growth cumulative with grail)
|
//other *-of-legion-like bonuses (%d to growth cumulative with grail)
|
||||||
TConstBonusListPtr bonuses = getBonuses(Selector::type()(Bonus::CREATURE_GROWTH).And(Selector::subtype()(level)));
|
TConstBonusListPtr bonuses = getBonuses(Selector::type()(Bonus::CREATURE_GROWTH).And(Selector::subtype()(level)));
|
||||||
|
Reference in New Issue
Block a user