1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

fix popup in kingdom overview

This commit is contained in:
Laserlicht
2025-06-28 00:08:32 +02:00
parent de893a3575
commit 8ec2f5e11b

View File

@@ -27,6 +27,7 @@
#include "../widgets/MiscWidgets.h" #include "../widgets/MiscWidgets.h"
#include "../widgets/Buttons.h" #include "../widgets/Buttons.h"
#include "../widgets/ObjectLists.h" #include "../widgets/ObjectLists.h"
#include "../windows/CHeroWindow.h"
#include "../windows/CMarketWindow.h" #include "../windows/CMarketWindow.h"
#include "../../lib/CConfigHandler.h" #include "../../lib/CConfigHandler.h"
@@ -101,6 +102,7 @@ void InfoBox::showPopupWindow(const Point & cursorPosition)
std::shared_ptr<CComponent> comp; std::shared_ptr<CComponent> comp;
std::string text; std::string text;
data->prepareMessage(text, comp); data->prepareMessage(text, comp);
if (comp) if (comp)
CRClickPopup::createAndPush(text, CInfoWindow::TCompsInfo(1, comp)); CRClickPopup::createAndPush(text, CInfoWindow::TCompsInfo(1, comp));
else if (!text.empty()) else if (!text.empty())
@@ -115,6 +117,8 @@ void InfoBox::clickPressed(const Point & cursorPosition)
if(comp) if(comp)
GAME->interface()->showInfoDialog(text, CInfoWindow::TCompsInfo(1, comp)); GAME->interface()->showInfoDialog(text, CInfoWindow::TCompsInfo(1, comp));
else if (!text.empty())
GAME->interface()->showInfoDialog(text);
} }
IInfoBoxData::IInfoBoxData(InfoType Type) IInfoBoxData::IInfoBoxData(InfoType Type)
@@ -974,6 +978,7 @@ CHeroItem::CHeroItem(const CGHeroInstance * Hero)
portrait = std::make_shared<CAnimImage>(AnimationPath::builtin("PortraitsLarge"), hero->getIconIndex(), 0, 5, 6); portrait = std::make_shared<CAnimImage>(AnimationPath::builtin("PortraitsLarge"), hero->getIconIndex(), 0, 5, 6);
heroArea = std::make_shared<CHeroArea>(5, 6, hero); heroArea = std::make_shared<CHeroArea>(5, 6, hero);
heroArea->addRClickCallback([this](){ ENGINE->windows().createAndPushWindow<CRClickPopupInt>(std::make_shared<CHeroWindow>(hero)); });
name = std::make_shared<CLabel>(73, 7, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, hero->getNameTranslated()); name = std::make_shared<CLabel>(73, 7, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, hero->getNameTranslated());
artsText = std::make_shared<CLabel>(320, 55, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, LIBRARY->generaltexth->overview[2]); artsText = std::make_shared<CLabel>(320, 55, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, LIBRARY->generaltexth->overview[2]);