split the selection panel into one card per kind of selection

This commit is contained in:
2026-08-07 18:38:55 +02:00
parent cc0ef856e3
commit 2289277e12
60 changed files with 3014 additions and 1559 deletions

View File

@@ -0,0 +1,53 @@
#pragma once
#include <map>
#include <string>
#include "BuildingId.h"
#include "SelectionContent.h"
struct Building;
class BufferSection;
class ProductionSection;
// Shared body of the four cards that show one building with buffers -- the Miner and
// Assembler, the Smelter and Reprocessing Plant, the Shipyard, and the Salvage Bay
// (REQ-UI-SELECTION-CONTENT). All four show the same header status, buffer contents and
// production progress; they differ only in what one production cycle costs and how long
// it takes, which is what the subclass supplies.
//
// This is implementation sharing, not a catalog entry: every concrete subclass is one
// row of the content catalog.
class BufferedBuildingContent : public SelectionContent
{
Q_OBJECT
protected:
// What one production cycle of this building consumes, produces, and takes.
struct CycleInfo
{
std::map<std::string, int> perCycleInputs;
std::map<std::string, int> perCycleOutputs;
// False when the building produces nothing at all (the Salvage Bay,
// REQ-BLD-SALVAGE-BAY) or has no recipe or schematic selected yet: the
// production section is then not shown (REQ-UI-PRODUCTION-PROGRESS).
bool runsProduction = false;
// 0 while an auto-recipe building sits between cycles, when no single recipe
// names a cycle time; the progress line then reads "idle".
double durationSeconds = 0.0;
};
BufferedBuildingContent(const SelectionContext& context, BuildingId id,
QWidget* parent);
virtual CycleInfo getCycleInfo(const Building& building) const = 0;
BuildingId getBuildingId() const { return m_id; }
void refreshRuntime() override;
private:
BuildingId m_id;
BufferSection* m_buffers;
ProductionSection* m_production;
};