From 50da08013086ff7bf3e92e3fec0b360319a6596b Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sat, 8 Apr 2023 00:13:38 +0300 Subject: [PATCH] Fixed UI of objects that provide one reward that can be refused --- lib/mapObjects/CRewardableObject.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/mapObjects/CRewardableObject.cpp b/lib/mapObjects/CRewardableObject.cpp index 1d3138582..0c1086e4d 100644 --- a/lib/mapObjects/CRewardableObject.cpp +++ b/lib/mapObjects/CRewardableObject.cpp @@ -152,8 +152,14 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const BlockingDialog sd(canRefuse, rewards.size() > 1); sd.player = h->tempOwner; sd.text = dialog; - for (auto index : rewards) - sd.components.push_back(info[index].reward.getDisplayedComponent(h)); + + if (rewards.size() > 1) + for (auto index : rewards) + sd.components.push_back(info[index].reward.getDisplayedComponent(h)); + + if (rewards.size() == 1) + info[rewards[0]].reward.loadComponents(sd.components, h); + cb->showBlockingDialog(&sd); };