diff --git a/lib/mapObjects/CQuest.cpp b/lib/mapObjects/CQuest.cpp index 761be1090..ef35b6fbb 100644 --- a/lib/mapObjects/CQuest.cpp +++ b/lib/mapObjects/CQuest.cpp @@ -513,6 +513,35 @@ std::string CGSeerHut::getHoverText(PlayerColor player) const 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 CGSeerHut::getPopupComponents(PlayerColor player) const +{ + std::vector result; + quest->mission.loadComponents(result, nullptr); + return result; +} + +std::vector CGSeerHut::getPopupComponents(const CGHeroInstance * hero) const +{ + std::vector result; + quest->mission.loadComponents(result, hero); + return result; +} + void CGSeerHut::setPropertyDer(ui8 what, ui32 val) { switch(what) diff --git a/lib/mapObjects/CQuest.h b/lib/mapObjects/CQuest.h index bb4980611..6f9dbd017 100644 --- a/lib/mapObjects/CQuest.h +++ b/lib/mapObjects/CQuest.h @@ -119,6 +119,11 @@ public: void initObj(CRandomGenerator & rand) 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 getPopupComponents(PlayerColor player) const override; + std::vector getPopupComponents(const CGHeroInstance * hero) const override; void newTurn(CRandomGenerator & rand) const override; void onHeroVisit(const CGHeroInstance * h) const override; void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; diff --git a/lib/rewardable/Limiter.cpp b/lib/rewardable/Limiter.cpp index 05c77909a..e6fd3b361 100644 --- a/lib/rewardable/Limiter.cpp +++ b/lib/rewardable/Limiter.cpp @@ -187,14 +187,14 @@ void Rewardable::Limiter::loadComponents(std::vector & comps, const CGHeroInstance * h) const { if (heroExperience) - comps.emplace_back(ComponentType::EXPERIENCE, static_cast(h->calculateXp(heroExperience))); + comps.emplace_back(ComponentType::EXPERIENCE, static_cast(h ? h->calculateXp(heroExperience) : heroExperience)); if (heroLevel > 0) comps.emplace_back(ComponentType::EXPERIENCE, heroLevel); 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); }