1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Show Seer Hut quest icon on right click. Fix broken tooltip.

This commit is contained in:
Ivan Savenko 2023-11-02 15:50:24 +02:00
parent 1ebb151b41
commit c1c2119f3d
3 changed files with 36 additions and 2 deletions

View File

@ -513,6 +513,35 @@ std::string CGSeerHut::getHoverText(PlayerColor player) const
return hoverName; return hoverName;
} }
std::string CGSeerHut::getHoverText(const CGHeroInstance * hero) const
{
return getHoverText(hero->getOwner());
}
std::string CGSeerHut::getPopupText(PlayerColor player) const
{
return getHoverText(player);
}
std::string CGSeerHut::getPopupText(const CGHeroInstance * hero) const
{
return getHoverText(hero->getOwner());
}
std::vector<Component> CGSeerHut::getPopupComponents(PlayerColor player) const
{
std::vector<Component> result;
quest->mission.loadComponents(result, nullptr);
return result;
}
std::vector<Component> CGSeerHut::getPopupComponents(const CGHeroInstance * hero) const
{
std::vector<Component> result;
quest->mission.loadComponents(result, hero);
return result;
}
void CGSeerHut::setPropertyDer(ui8 what, ui32 val) void CGSeerHut::setPropertyDer(ui8 what, ui32 val)
{ {
switch(what) switch(what)

View File

@ -119,6 +119,11 @@ public:
void initObj(CRandomGenerator & rand) override; void initObj(CRandomGenerator & rand) override;
std::string getHoverText(PlayerColor player) const override; std::string getHoverText(PlayerColor player) const override;
std::string getHoverText(const CGHeroInstance * hero) const override;
std::string getPopupText(PlayerColor player) const override;
std::string getPopupText(const CGHeroInstance * hero) const override;
std::vector<Component> getPopupComponents(PlayerColor player) const override;
std::vector<Component> getPopupComponents(const CGHeroInstance * hero) const override;
void newTurn(CRandomGenerator & rand) const override; void newTurn(CRandomGenerator & rand) const override;
void onHeroVisit(const CGHeroInstance * h) const override; void onHeroVisit(const CGHeroInstance * h) const override;
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override;

View File

@ -187,14 +187,14 @@ void Rewardable::Limiter::loadComponents(std::vector<Component> & comps,
const CGHeroInstance * h) const const CGHeroInstance * h) const
{ {
if (heroExperience) if (heroExperience)
comps.emplace_back(ComponentType::EXPERIENCE, static_cast<si32>(h->calculateXp(heroExperience))); comps.emplace_back(ComponentType::EXPERIENCE, static_cast<si32>(h ? h->calculateXp(heroExperience) : heroExperience));
if (heroLevel > 0) if (heroLevel > 0)
comps.emplace_back(ComponentType::EXPERIENCE, heroLevel); comps.emplace_back(ComponentType::EXPERIENCE, heroLevel);
if (manaPoints || manaPercentage > 0) if (manaPoints || manaPercentage > 0)
{ {
int absoluteMana = h->manaLimit() ? (manaPercentage * h->mana / h->manaLimit() / 100) : 0; int absoluteMana = (h && h->manaLimit()) ? (manaPercentage * h->mana / h->manaLimit() / 100) : 0;
comps.emplace_back(ComponentType::MANA, absoluteMana + manaPoints); comps.emplace_back(ComponentType::MANA, absoluteMana + manaPoints);
} }