From 9915c2ade44d2271256e287ec066ff2196af1ae2 Mon Sep 17 00:00:00 2001 From: Malte Langkabel Date: Thu, 23 Jul 2026 11:33:31 +0200 Subject: [PATCH] Show refund-percentage tooltip on Deconstruct button The build grid's Deconstruct button now sets a hover tooltip composed from world.refund_percentage (REQ-UI-DECONSTRUCT-BUTTON, REQ-BLD-DECONSTRUCT): it states the partial refund for finished buildings and the full refund for construction sites, collapsing to a single-case wording when the percentage is 100%. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Y7N59FsLA5e2kuVdqe4Uhc --- src/ui/BuildButtonGrid.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ui/BuildButtonGrid.cpp b/src/ui/BuildButtonGrid.cpp index 465866a..02d9252 100644 --- a/src/ui/BuildButtonGrid.cpp +++ b/src/ui/BuildButtonGrid.cpp @@ -143,6 +143,19 @@ BuildButtonGrid::BuildButtonGrid(Simulation* sim, const GameConfig* config, m_deconstructButton->setIcon(loadBuildingIcon( QString::fromStdString(m_iconDir) + "/deconstruct.svg")); m_deconstructButton->setIconSize(kIconSize); + // Refund tooltip composed from world.refund_percentage (REQ-UI-DECONSTRUCT-BUTTON, + // REQ-BLD-DECONSTRUCT). A finished building refunds the configured percentage; a + // construction site removed before it is built is refunded in full. When the + // percentage is 100% both cases coincide, so the tooltip is simplified to one case. + const int refundPercentage = m_config->world.refundPercentage; + const QString deconstructTooltip = (refundPercentage >= 100) + ? tr("Deconstruct buildings. Refunds %1% of the building block cost.") + .arg(refundPercentage) + : tr("Deconstruct buildings. A finished building refunds %1% of its building " + "block cost once removed; a construction site removed before it is built " + "is refunded in full.") + .arg(refundPercentage); + m_deconstructButton->setToolTip(deconstructTooltip); layout->addWidget(m_deconstructButton, row, col); connect(m_deconstructButton, &QPushButton::clicked, this, [this]() { EventManager::getInstance()->sendEventImmediately(