Show total building block cost in multi-selection panel (relevant for temporary blueprint)
This commit is contained in:
@@ -157,14 +157,8 @@ Blueprint BlueprintPanel::createBlueprintFromSelection() const
|
||||
{
|
||||
const Building* b = m_sim->buildings().findBuilding(id);
|
||||
if (!b) { continue; }
|
||||
const bool placeable = [&]() {
|
||||
for (const BuildingDef& def : m_config->buildings.buildings)
|
||||
{
|
||||
if (def.type == b->type) { return def.playerPlaceable; }
|
||||
}
|
||||
return false;
|
||||
}();
|
||||
if (placeable) { entries.push_back({ b }); }
|
||||
const BuildingDef* def = m_config->buildings.findBuildingDef(b->type);
|
||||
if (def && def->playerPlaceable) { entries.push_back({ b }); }
|
||||
}
|
||||
|
||||
if (entries.empty()) { return Blueprint{}; }
|
||||
@@ -213,14 +207,8 @@ int BlueprintPanel::computeBlueprintCost(const Blueprint& bp) const
|
||||
int total = 0;
|
||||
for (const BlueprintBuilding& bb : bp.buildings)
|
||||
{
|
||||
for (const BuildingDef& def : m_config->buildings.buildings)
|
||||
{
|
||||
if (def.type == bb.type)
|
||||
{
|
||||
total += def.cost;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const BuildingDef* def = m_config->buildings.findBuildingDef(bb.type);
|
||||
if (def) { total += def->cost; }
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user