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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y7N59FsLA5e2kuVdqe4Uhc
This commit is contained in:
@@ -143,6 +143,19 @@ BuildButtonGrid::BuildButtonGrid(Simulation* sim, const GameConfig* config,
|
|||||||
m_deconstructButton->setIcon(loadBuildingIcon(
|
m_deconstructButton->setIcon(loadBuildingIcon(
|
||||||
QString::fromStdString(m_iconDir) + "/deconstruct.svg"));
|
QString::fromStdString(m_iconDir) + "/deconstruct.svg"));
|
||||||
m_deconstructButton->setIconSize(kIconSize);
|
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);
|
layout->addWidget(m_deconstructButton, row, col);
|
||||||
connect(m_deconstructButton, &QPushButton::clicked, this, [this]() {
|
connect(m_deconstructButton, &QPushButton::clicked, this, [this]() {
|
||||||
EventManager::getInstance()->sendEventImmediately(
|
EventManager::getInstance()->sendEventImmediately(
|
||||||
|
|||||||
Reference in New Issue
Block a user