#include "BufferedBuildingContent.h" #include #include "Building.h" #include "BufferSection.h" #include "BuildingTarget.h" #include "FactoryQueries.h" #include "ProductionSection.h" #include "Simulation.h" BufferedBuildingContent::BufferedBuildingContent(const SelectionContext& context, BuildingId id, QWidget* parent) : SelectionContent(context, asConstructionSite(context, id), parent) , m_id(id) { m_buffers = new BufferSection(this); m_production = new ProductionSection(this); getRuntimeLayout()->addWidget(m_buffers); getRuntimeLayout()->addWidget(m_production); } void BufferedBuildingContent::refreshRuntime() { const Building* building = findBuilding(getContext().sim->getFactoryState(), m_id); if (!building) { // Gone under the card. SelectionPanel rebuilds on the same refresh; this only // has to avoid reading it. return; } setProductionStatusSlot(*building); const CycleInfo cycle = getCycleInfo(*building); m_buffers->setBuffers(*building, cycle.perCycleInputs, cycle.perCycleOutputs); m_production->setProduction(cycle.runsProduction, *building, cycle.durationSeconds, getContext().sim->getCurrentTick()); }