give the selection cards their own parts instead of label blobs
This commit is contained in:
@@ -2,11 +2,9 @@
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Building.h"
|
||||
#include "BuildingTarget.h"
|
||||
#include "GameConfig.h"
|
||||
#include "RecipeSelectionControl.h"
|
||||
#include "SelectionNames.h"
|
||||
|
||||
RecipeProductionContent::RecipeProductionContent(const SelectionContext& context,
|
||||
const SelectionRequest& request,
|
||||
@@ -15,31 +13,25 @@ RecipeProductionContent::RecipeProductionContent(const SelectionContext& context
|
||||
{
|
||||
const BuildingTarget target = resolveBuildingTarget(context, getBuildingId());
|
||||
|
||||
// The control is shown for a construction site too: a site is configured exactly
|
||||
// like the building it will become (REQ-BLD-SITE-CONFIG).
|
||||
// Shown for a construction site too: a site is configured exactly like the building
|
||||
// it will become (REQ-BLD-SITE-CONFIG).
|
||||
m_recipeControl = new RecipeSelectionControl(context, getBuildingId(), target.type,
|
||||
this);
|
||||
getConfigurationLayout()->addWidget(m_recipeControl);
|
||||
getConfigurationLayout()->insertWidget(0, m_recipeControl);
|
||||
}
|
||||
|
||||
void RecipeProductionContent::refreshConfiguration()
|
||||
void RecipeProductionContent::refreshControls(const BuildingTarget& target)
|
||||
{
|
||||
const BuildingTarget target = resolveBuildingTarget(getContext(), getBuildingId());
|
||||
if (!target.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
setBuildingIdentity(target.type, getBuildingTypeName(target.type));
|
||||
m_recipeControl->setRecipeId(target.recipeId);
|
||||
}
|
||||
|
||||
BufferedBuildingContent::CycleInfo RecipeProductionContent::getCycleInfo(
|
||||
const Building& building) const
|
||||
const BuildingTarget& target) const
|
||||
{
|
||||
CycleInfo info;
|
||||
const RecipeDef* recipe = building.recipeId.empty()
|
||||
const RecipeDef* recipe = target.recipeId.empty()
|
||||
? nullptr
|
||||
: getContext().config->recipes.findRecipeDef(building.recipeId, building.type);
|
||||
: getContext().config->recipes.findRecipeDef(target.recipeId, target.type);
|
||||
if (!recipe)
|
||||
{
|
||||
return info;
|
||||
|
||||
Reference in New Issue
Block a user