Add refund-percentage tooltip to Deconstruct button
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user