Add refund-percentage tooltip to Deconstruct button

This commit is contained in:
2026-07-23 20:46:39 +02:00
parent 60d6767d93
commit 11daa61714
2 changed files with 15 additions and 2 deletions

View File

@@ -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(