浏览代码

Merge pull request #5855 from Laserlicht/koverview

fix popup in kingdom overview
Ivan Savenko 3 月之前
父节点
当前提交
b6f1eac19b
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      client/windows/CKingdomInterface.cpp

+ 5 - 0
client/windows/CKingdomInterface.cpp

@@ -27,6 +27,7 @@
 #include "../widgets/MiscWidgets.h"
 #include "../widgets/Buttons.h"
 #include "../widgets/ObjectLists.h"
+#include "../windows/CHeroWindow.h"
 #include "../windows/CMarketWindow.h"
 
 #include "../../lib/CConfigHandler.h"
@@ -101,6 +102,7 @@ void InfoBox::showPopupWindow(const Point & cursorPosition)
 	std::shared_ptr<CComponent> comp;
 	std::string text;
 	data->prepareMessage(text, comp);
+
 	if (comp)
 		CRClickPopup::createAndPush(text, CInfoWindow::TCompsInfo(1, comp));
 	else if (!text.empty())
@@ -115,6 +117,8 @@ void InfoBox::clickPressed(const Point & cursorPosition)
 
 	if(comp)
 		GAME->interface()->showInfoDialog(text, CInfoWindow::TCompsInfo(1, comp));
+	else if (!text.empty())
+		GAME->interface()->showInfoDialog(text);
 }
 
 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);
 	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());
 	artsText = std::make_shared<CLabel>(320, 55, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, LIBRARY->generaltexth->overview[2]);