From 36a51228e6cd7b818d9854302f00eda7c6a459ec Mon Sep 17 00:00:00 2001 From: George King <98261225+GeorgeK1ng@users.noreply.github.com> Date: Wed, 3 Sep 2025 13:37:26 +0200 Subject: [PATCH 1/8] Update InfoWindows.cpp --- client/windows/InfoWindows.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/windows/InfoWindows.cpp b/client/windows/InfoWindows.cpp index 10bd84aa3..fe8e43c5b 100644 --- a/client/windows/InfoWindows.cpp +++ b/client/windows/InfoWindows.cpp @@ -316,13 +316,13 @@ CInfoBoxPopup::CInfoBoxPopup(Point position, const CGHeroInstance * hero) } CInfoBoxPopup::CInfoBoxPopup(Point position, const CGGarrison * garr) - : AdventureMapPopup(RCLICK_POPUP | PLAYER_COLORED, ImagePath::builtin("TOWNQVBK"), position) + : AdventureMapPopup(RCLICK_POPUP | PLAYER_COLORED, ImagePath::builtin("GARRIPOP"), position) { InfoAboutTown iah; GAME->interface()->cb->getTownInfo(garr, iah); OBJECT_CONSTRUCTION; - tooltip = std::make_shared(Point(9, 10), iah); + tooltip = std::make_shared(Point(9, 10), iah); addUsedEvents(DRAG_POPUP); From 1114afb4790a6c3c721a2953fbe9362a1b54de1f Mon Sep 17 00:00:00 2001 From: George King <98261225+GeorgeK1ng@users.noreply.github.com> Date: Wed, 3 Sep 2025 13:38:45 +0200 Subject: [PATCH 2/8] Update MiscWidgets.h --- client/widgets/MiscWidgets.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/client/widgets/MiscWidgets.h b/client/widgets/MiscWidgets.h index 729466f02..7a35bfa0e 100644 --- a/client/widgets/MiscWidgets.h +++ b/client/widgets/MiscWidgets.h @@ -62,7 +62,7 @@ public: void showPopupWindow(const Point & cursorPosition) override; }; -/// base class for hero/town/garrison tooltips +/// base class for hero/town tooltips class CArmyTooltip : public CIntObject { std::shared_ptr title; @@ -74,6 +74,17 @@ public: CArmyTooltip(Point pos, const CArmedInstance * army); }; +/// base class garrison tooltips +class CGarrisonTooltip : public CIntObject +{ + std::shared_ptr title; + std::vector> icons; + std::vector> subtitles; + void init(const InfoAboutArmy& army); +public: + CGarrisonTooltip(Point pos, const InfoAboutArmy& army); +}; + /// Class for hero tooltip. Does not have any background! /// background for infoBox: ADSTATHR /// background for tooltip: HEROQVBK From 04d30cbc5e7ca5dc9a9f63967e259ed2e282da44 Mon Sep 17 00:00:00 2001 From: George King <98261225+GeorgeK1ng@users.noreply.github.com> Date: Wed, 3 Sep 2025 13:52:49 +0200 Subject: [PATCH 3/8] Update MiscWidgets.cpp --- client/widgets/MiscWidgets.cpp | 90 ++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 30 deletions(-) diff --git a/client/widgets/MiscWidgets.cpp b/client/widgets/MiscWidgets.cpp index 342b65046..e5d8539a1 100644 --- a/client/widgets/MiscWidgets.cpp +++ b/client/widgets/MiscWidgets.cpp @@ -257,6 +257,45 @@ CMinorResDataBar::CMinorResDataBar() CMinorResDataBar::~CMinorResDataBar() = default; +void BuildArmyStacksUI(const InfoAboutArmy& army, const std::vector& slotsPos, std::vector>& icons, std::vector>& subtitles) +{ + for(const auto& slot : army.army) + { + if(slot.first.getNum() >= GameConstants::ARMY_SIZE) + { + logGlobal->warn("%s has stack in slot %d", army.name, slot.first.getNum()); + continue; + } + + // Creature icon + icons.push_back(std::make_shared(AnimationPath::builtin("CPRSMALL"), slot.second.getType()->getIconIndex(), 0, slotsPos[slot.first.getNum()].x, slotsPos[slot.first.getNum()].y)); + + // Subtitle + std::string subtitle; + if(army.army.isDetailed) + { + subtitle = TextOperations::formatMetric(slot.second.getCount(), 4); + } + else + { + //if =0 - we have no information about stack size at all + if (slot.second.getCount()) + { + if (settings["gameTweaks"]["numericCreaturesQuantities"].Bool()) + { + subtitle = CCreature::getQuantityRangeStringForId((CCreature::CreatureQuantityId)slot.second.getCount()); + } + else + { + subtitle = LIBRARY->generaltexth->arraytxt[171 + 3 * (slot.second.getCount())]; + } + } + } + + subtitles.push_back(std::make_shared(slotsPos[slot.first.getNum()].x + 17, slotsPos[slot.first.getNum()].y + 39, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, subtitle)); + } +} + void CArmyTooltip::init(const InfoAboutArmy &army) { OBJECT_CONSTRUCTION; @@ -272,40 +311,25 @@ void CArmyTooltip::init(const InfoAboutArmy &army) slotsPos.push_back(Point(90, 122)); slotsPos.push_back(Point(126, 122)); - for(auto & slot : army.army) - { - if(slot.first.getNum() >= GameConstants::ARMY_SIZE) - { - logGlobal->warn("%s has stack in slot %d", army.name, slot.first.getNum()); - continue; - } + BuildArmyStacksUI(army, slotsPos, icons, subtitles); +} - icons.push_back(std::make_shared(AnimationPath::builtin("CPRSMALL"), slot.second.getType()->getIconIndex(), 0, slotsPos[slot.first.getNum()].x, slotsPos[slot.first.getNum()].y)); +void CGarrisonTooltip::init(const InfoAboutArmy& army) +{ + OBJECT_CONSTRUCTION; - std::string subtitle; - if(army.army.isDetailed) - { - subtitle = TextOperations::formatMetric(slot.second.getCount(), 4); - } - else - { - //if =0 - we have no information about stack size at all - if(slot.second.getCount()) - { - if(settings["gameTweaks"]["numericCreaturesQuantities"].Bool()) - { - subtitle = CCreature::getQuantityRangeStringForId((CCreature::CreatureQuantityId)slot.second.getCount()); - } - else - { - subtitle = LIBRARY->generaltexth->arraytxt[171 + 3*(slot.second.getCount())]; - } - } - } + title = std::make_shared(142, 26, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, army.name); - subtitles.push_back(std::make_shared(slotsPos[slot.first.getNum()].x + 17, slotsPos[slot.first.getNum()].y + 39, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, subtitle)); - } + std::vector slotsPos; + slotsPos.push_back(Point(14, 48)); + slotsPos.push_back(Point(50, 48)); + slotsPos.push_back(Point(86, 48)); + slotsPos.push_back(Point(122, 48)); + slotsPos.push_back(Point(158, 48)); + slotsPos.push_back(Point(194, 48)); + slotsPos.push_back(Point(230, 48)); + BuildArmyStacksUI(army, slotsPos, icons, subtitles); } CArmyTooltip::CArmyTooltip(Point pos, const InfoAboutArmy & army): @@ -314,6 +338,12 @@ CArmyTooltip::CArmyTooltip(Point pos, const InfoAboutArmy & army): init(army); } +CGarrisonTooltip::CGarrisonTooltip(Point pos, const InfoAboutArmy & army) + : CIntObject(0, pos) +{ + init(army); +} + CArmyTooltip::CArmyTooltip(Point pos, const CArmedInstance * army): CIntObject(0, pos) { From 247942a178dd13b9d15739c0cd2aaaf74734b27f Mon Sep 17 00:00:00 2001 From: George King <98261225+GeorgeK1ng@users.noreply.github.com> Date: Wed, 3 Sep 2025 14:07:47 +0200 Subject: [PATCH 4/8] Update MiscWidgets.cpp --- client/widgets/MiscWidgets.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/widgets/MiscWidgets.cpp b/client/widgets/MiscWidgets.cpp index e5d8539a1..c851fde55 100644 --- a/client/widgets/MiscWidgets.cpp +++ b/client/widgets/MiscWidgets.cpp @@ -279,9 +279,9 @@ void BuildArmyStacksUI(const InfoAboutArmy& army, const std::vector& slot else { //if =0 - we have no information about stack size at all - if (slot.second.getCount()) + if(slot.second.getCount()) { - if (settings["gameTweaks"]["numericCreaturesQuantities"].Bool()) + if(settings["gameTweaks"]["numericCreaturesQuantities"].Bool()) { subtitle = CCreature::getQuantityRangeStringForId((CCreature::CreatureQuantityId)slot.second.getCount()); } From 872f2311c592ccb55e40daf39e0ef9c4ac12d90d Mon Sep 17 00:00:00 2001 From: George King <98261225+GeorgeK1ng@users.noreply.github.com> Date: Thu, 4 Sep 2025 13:05:18 +0200 Subject: [PATCH 5/8] Use only when is enableUiEnhancements toogled --- client/windows/InfoWindows.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/windows/InfoWindows.cpp b/client/windows/InfoWindows.cpp index fe8e43c5b..f01b2c884 100644 --- a/client/windows/InfoWindows.cpp +++ b/client/windows/InfoWindows.cpp @@ -316,13 +316,17 @@ CInfoBoxPopup::CInfoBoxPopup(Point position, const CGHeroInstance * hero) } CInfoBoxPopup::CInfoBoxPopup(Point position, const CGGarrison * garr) - : AdventureMapPopup(RCLICK_POPUP | PLAYER_COLORED, ImagePath::builtin("GARRIPOP"), position) + : AdventureMapPopup(RCLICK_POPUP | PLAYER_COLORED, ImagePath::builtin(settings["general"]["enableUiEnhancements"].Bool() ? "GARRIPOP" : "TOWNQVBK"), position) { InfoAboutTown iah; GAME->interface()->cb->getTownInfo(garr, iah); OBJECT_CONSTRUCTION; - tooltip = std::make_shared(Point(9, 10), iah); + + if(settings["general"]["enableUiEnhancements"].Bool()) + tooltip = std::make_shared(Point(9, 10), iah); + else + tooltip = std::make_shared(Point(9, 10), iah); addUsedEvents(DRAG_POPUP); From bc3b77684f249bd6400154c882fde060f4a01af9 Mon Sep 17 00:00:00 2001 From: George King <98261225+GeorgeK1ng@users.noreply.github.com> Date: Thu, 4 Sep 2025 13:13:01 +0200 Subject: [PATCH 6/8] Fix build --- client/windows/InfoWindows.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/windows/InfoWindows.cpp b/client/windows/InfoWindows.cpp index f01b2c884..940ffcc05 100644 --- a/client/windows/InfoWindows.cpp +++ b/client/windows/InfoWindows.cpp @@ -327,7 +327,7 @@ CInfoBoxPopup::CInfoBoxPopup(Point position, const CGGarrison * garr) tooltip = std::make_shared(Point(9, 10), iah); else tooltip = std::make_shared(Point(9, 10), iah); - + addUsedEvents(DRAG_POPUP); fitToScreen(10); From c9e814ac219c24b87c7a1f7f55d90adf94c03351 Mon Sep 17 00:00:00 2001 From: George King <98261225+GeorgeK1ng@users.noreply.github.com> Date: Thu, 4 Sep 2025 13:20:47 +0200 Subject: [PATCH 7/8] Fix build --- client/windows/InfoWindows.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/windows/InfoWindows.cpp b/client/windows/InfoWindows.cpp index 940ffcc05..41d6b708e 100644 --- a/client/windows/InfoWindows.cpp +++ b/client/windows/InfoWindows.cpp @@ -323,10 +323,14 @@ CInfoBoxPopup::CInfoBoxPopup(Point position, const CGGarrison * garr) OBJECT_CONSTRUCTION; - if(settings["general"]["enableUiEnhancements"].Bool()) + if(settings["general"]["enableUiEnhancements"].Bool()) + { tooltip = std::make_shared(Point(9, 10), iah); - else + } + else + { tooltip = std::make_shared(Point(9, 10), iah); + } addUsedEvents(DRAG_POPUP); From e96f3989f29f02c05d94de5228d18a38083b62c0 Mon Sep 17 00:00:00 2001 From: George King <98261225+GeorgeK1ng@users.noreply.github.com> Date: Thu, 11 Sep 2025 21:49:52 +0200 Subject: [PATCH 8/8] Update client/windows/InfoWindows.cpp Co-authored-by: Laserlicht <13953785+Laserlicht@users.noreply.github.com> --- client/windows/InfoWindows.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/windows/InfoWindows.cpp b/client/windows/InfoWindows.cpp index 41d6b708e..017e8b5a7 100644 --- a/client/windows/InfoWindows.cpp +++ b/client/windows/InfoWindows.cpp @@ -329,7 +329,7 @@ CInfoBoxPopup::CInfoBoxPopup(Point position, const CGGarrison * garr) } else { - tooltip = std::make_shared(Point(9, 10), iah); + tooltip = std::make_shared(Point(9, 10), iah); } addUsedEvents(DRAG_POPUP);