Show total building block cost in multi-selection panel
Implement the REQ-UI-MULTI-SELECTION addition: the selected building panel now shows the total placement cost of a multi-selection, counting only player-placeable buildings (HQ and defence stations excluded). Construction sites are charged their type's full cost. Add a shared BuildingsConfig::findBuildingDef accessor and reuse it in BlueprintPanel to remove the duplicated by-type lookup loops. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DZR44tA8sn4dPqDzAVXyps
This commit is contained in:
@@ -31,4 +31,18 @@ struct BuildingDef
|
||||
struct BuildingsConfig
|
||||
{
|
||||
std::vector<BuildingDef> buildings;
|
||||
|
||||
// Returns the definition for the given building type, or nullptr if the
|
||||
// type has no entry in buildings.toml.
|
||||
const BuildingDef* findBuildingDef(BuildingType type) const
|
||||
{
|
||||
for (const BuildingDef& def : buildings)
|
||||
{
|
||||
if (def.type == type)
|
||||
{
|
||||
return &def;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user