From a9f557483ec00638683f22b18fa0fe673d365cf3 Mon Sep 17 00:00:00 2001 From: Nikolay Borodin Date: Wed, 14 Feb 2024 13:56:17 +0200 Subject: [PATCH] Let's also display assigned group number on UI --- src/hci/manufacture.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/hci/manufacture.cpp b/src/hci/manufacture.cpp index bdf5aec9d40..250d648f3f1 100644 --- a/src/hci/manufacture.cpp +++ b/src/hci/manufacture.cpp @@ -240,7 +240,10 @@ class ManufactureObjectButton : public ObjectButton void initialize() { attach(factoryNumberLabel = std::make_shared()); + attach(factoryAssignGroupLabel = std::make_shared()); factoryNumberLabel->setGeometry(OBJ_TEXTX, OBJ_B1TEXTY, 16, 16); + factoryAssignGroupLabel->setGeometry(OBJ_TEXTX + 48, OBJ_B1TEXTY, 16, 16); + factoryAssignGroupLabel->setFontColour(pal_RGBA(255, 220, 115, 255) /* gold */); } void display(int xOffset, int yOffset) override @@ -262,7 +265,8 @@ class ManufactureObjectButton : public ObjectButton void updateLayout() override { BaseWidget::updateLayout(); - auto factory = getFactoryOrNullptr(controller->getObjectAt(objectIndex)); + auto psStruct = controller->getObjectAt(objectIndex); + auto factory = getFactoryOrNullptr(psStruct); ASSERT_NOT_NULLPTR_OR_RETURN(, factory); if (factory->psAssemblyPoint == nullptr) { @@ -270,6 +274,14 @@ class ManufactureObjectButton : public ObjectButton return; } factoryNumberLabel->setString(WzString::fromUtf8(astringf("%u", factory->psAssemblyPoint->factoryInc + 1))); + if (psStruct->productToGroup != UBYTE_MAX) + { + factoryAssignGroupLabel->setString(WzString::fromUtf8(astringf("%u", psStruct->productToGroup))); + } + else + { + factoryAssignGroupLabel->setString(""); + } } std::string getTip() override @@ -287,6 +299,7 @@ class ManufactureObjectButton : public ObjectButton private: std::shared_ptr controller; std::shared_ptr factoryNumberLabel; + std::shared_ptr factoryAssignGroupLabel; }; class ManufactureStatsButton: public StatsButton