mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Fix incorrect tooltip when right-clicking Witch Hut if selected hero
already has this skill
This commit is contained in:
@@ -348,7 +348,12 @@ std::vector<Component> CRewardableObject::getPopupComponentsImpl(PlayerColor pla
|
|||||||
|
|
||||||
auto rewardIndices = getAvailableRewards(hero, Rewardable::EEventType::EVENT_FIRST_VISIT);
|
auto rewardIndices = getAvailableRewards(hero, Rewardable::EEventType::EVENT_FIRST_VISIT);
|
||||||
if (rewardIndices.empty() && !configuration.info.empty())
|
if (rewardIndices.empty() && !configuration.info.empty())
|
||||||
rewardIndices.push_back(0);
|
{
|
||||||
|
// Object has valid config, but current hero has no rewards that he can receive.
|
||||||
|
// Usually this happens if hero has already visited this object -> show reward using context without any hero
|
||||||
|
// since reward may be context-sensitive - e.g. Witch Hut that gives 1 skill, but always at basic level
|
||||||
|
return loadComponents(nullptr, {0});
|
||||||
|
}
|
||||||
|
|
||||||
if (rewardIndices.empty())
|
if (rewardIndices.empty())
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
Reference in New Issue
Block a user