implement copy building settings with shift + click gesture
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "ExitBlueprintModeRequestedEvent.h"
|
||||
|
||||
#include "Building.h"
|
||||
#include "BuildingConfig.h"
|
||||
#include "BuildingSystem.h"
|
||||
#include "Simulation.h"
|
||||
|
||||
@@ -188,20 +189,19 @@ Blueprint BlueprintPanel::createBlueprintFromSelection() const
|
||||
for (const Entry& e : entries)
|
||||
{
|
||||
BlueprintBuilding bb;
|
||||
bb.type = e.building->type;
|
||||
bb.rotation = e.building->rotation;
|
||||
bb.offset = e.building->anchor - center;
|
||||
bb.recipeId = e.building->recipeId;
|
||||
bb.shipLayout = e.building->shipLayout;
|
||||
if (e.building->type == BuildingType::Splitter)
|
||||
bb.type = e.building->type;
|
||||
bb.rotation = e.building->rotation;
|
||||
bb.offset = e.building->anchor - center;
|
||||
// Recipe / schematic / layout / splitter-filter capture is shared with the
|
||||
// copy-settings gesture (REQ-BLD-COPY-CONFIG) via readBuildingConfig.
|
||||
const std::optional<BuildingConfig> config =
|
||||
readBuildingConfig(*m_sim, e.building->id);
|
||||
if (config.has_value())
|
||||
{
|
||||
const std::optional<BeltSystem::SplitterInfo> info =
|
||||
m_sim->belts().getSplitterInfo(e.building->anchor);
|
||||
if (info.has_value())
|
||||
{
|
||||
bb.splitterFilterA = info->filterA;
|
||||
bb.splitterFilterB = info->filterB;
|
||||
}
|
||||
bb.recipeId = config->recipeId.value_or(std::string());
|
||||
bb.shipLayout = config->shipLayout;
|
||||
bb.splitterFilterA = config->splitterFilterA;
|
||||
bb.splitterFilterB = config->splitterFilterB;
|
||||
}
|
||||
bp.buildings.push_back(bb);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user