show recipes visually instead of describing them in text
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#include "DisplayName.h"
|
||||
#include "FactoryQueries.h"
|
||||
#include "ProductionSection.h"
|
||||
#include "RecipeSummaryRow.h"
|
||||
#include "RecipeLineRow.h"
|
||||
#include "SectionBox.h"
|
||||
#include "SelectionNames.h"
|
||||
#include "Simulation.h"
|
||||
@@ -18,13 +18,13 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
std::vector<RecipeSummaryRow::Amount> toAmounts(const std::map<std::string, int>& map)
|
||||
std::vector<RecipeLineRow::Amount> toAmounts(const std::map<std::string, int>& map)
|
||||
{
|
||||
std::vector<RecipeSummaryRow::Amount> amounts;
|
||||
std::vector<RecipeLineRow::Amount> amounts;
|
||||
amounts.reserve(map.size());
|
||||
for (const std::pair<const std::string, int>& entry : map)
|
||||
{
|
||||
amounts.push_back(RecipeSummaryRow::Amount{ entry.first, entry.second });
|
||||
amounts.push_back(RecipeLineRow::Amount{ entry.first, entry.second });
|
||||
}
|
||||
return amounts;
|
||||
}
|
||||
@@ -66,17 +66,17 @@ BufferedBuildingContent::BufferedBuildingContent(const SelectionContext& context
|
||||
{
|
||||
// The summary is configuration -- what the building will do -- so it sits with the
|
||||
// selection control and is shown for a construction site too (REQ-UI-RECIPE-SUMMARY).
|
||||
m_recipeSummary = new RecipeSummaryRow(context.itemIcons, this);
|
||||
m_recipeSummary = new RecipeLineRow(context.itemIcons, context.buildingIcons, this);
|
||||
getConfigurationLayout()->addWidget(m_recipeSummary);
|
||||
|
||||
m_inputSection = new SectionBox(tr("Input buffers"), this);
|
||||
m_inputChips = new ItemChipRow(context.itemIcons, m_inputSection);
|
||||
m_inputChips = new ItemChipRow(context, m_inputSection);
|
||||
m_inputSection->getContentLayout()->addWidget(m_inputChips);
|
||||
|
||||
m_production = new ProductionSection(this);
|
||||
|
||||
m_outputSection = new SectionBox(tr("Output buffer"), this);
|
||||
m_outputChips = new ItemChipRow(context.itemIcons, m_outputSection);
|
||||
m_outputChips = new ItemChipRow(context, m_outputSection);
|
||||
m_outputSection->getContentLayout()->addWidget(m_outputChips);
|
||||
|
||||
// In the direction the materials flow: what goes in, what is being made of it, what
|
||||
@@ -98,10 +98,14 @@ void BufferedBuildingContent::refreshConfiguration()
|
||||
|
||||
setBuildingIdentity(target.type, getBuildingTypeName(target.type));
|
||||
|
||||
// The card already names the building in its header, so the summary states the cycle
|
||||
// alone -- no building chip, no recipe name (REQ-UI-RECIPE-SUMMARY).
|
||||
const CycleInfo cycle = getCycleInfo(target);
|
||||
m_recipeSummary->setSummary(toAmounts(cycle.perCycleInputs),
|
||||
toAmounts(cycle.perCycleOutputs),
|
||||
cycle.durationSeconds);
|
||||
RecipeLineRow::Spec summary;
|
||||
summary.inputs = toAmounts(cycle.perCycleInputs);
|
||||
summary.outputs = toAmounts(cycle.perCycleOutputs);
|
||||
summary.durationSeconds = cycle.durationSeconds;
|
||||
m_recipeSummary->setLine(summary);
|
||||
|
||||
refreshControls(target);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user