Show total building block cost in multi-selection panel (relevant for temporary blueprint)
This commit is contained in:
@@ -694,6 +694,7 @@ void SelectedBuildingPanel::buildMulti(const std::vector<BuildingId>& ids)
|
||||
}
|
||||
|
||||
bool hasBelt = false;
|
||||
int totalCost = 0;
|
||||
QString text;
|
||||
for (const std::pair<const BuildingType, int>& entry : counts)
|
||||
{
|
||||
@@ -703,7 +704,15 @@ void SelectedBuildingPanel::buildMulti(const std::vector<BuildingId>& ids)
|
||||
{
|
||||
hasBelt = true;
|
||||
}
|
||||
// Total placement cost counts only player-placeable buildings; the HQ
|
||||
// and defence stations are excluded (REQ-UI-MULTI-SELECTION).
|
||||
const BuildingDef* def = m_config->buildings.findBuildingDef(entry.first);
|
||||
if (def && def->playerPlaceable)
|
||||
{
|
||||
totalCost += def->cost * entry.second;
|
||||
}
|
||||
}
|
||||
text += tr("Total: %1 Building Blocks").arg(totalCost);
|
||||
m_titleLabel->setText(text.trimmed());
|
||||
m_titleLabel->show();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user