implement copy building settings with shift + click gesture
This commit is contained in:
40
src/lib/sim/BuildingConfig.h
Normal file
40
src/lib/sim/BuildingConfig.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "BuildingId.h"
|
||||
#include "BuildingType.h"
|
||||
#include "ItemType.h"
|
||||
#include "ShipLayout.h"
|
||||
|
||||
class Simulation;
|
||||
|
||||
// The user-configurable settings of a single building or construction site: the
|
||||
// selected recipe / ship schematic, the shipyard module layout, and (for
|
||||
// splitters) the two output filters. Shared by the copy-settings gesture
|
||||
// (REQ-BLD-COPY-CONFIG) and blueprint capture (REQ-UI-BLUEPRINT-STORAGE).
|
||||
struct BuildingConfig
|
||||
{
|
||||
BuildingType type = BuildingType::Miner;
|
||||
|
||||
// Selected recipe (Miner / Assembler) or ship schematic id (Shipyard); unset
|
||||
// when nothing is selected.
|
||||
std::optional<std::string> recipeId;
|
||||
|
||||
// Shipyard module layout (REQ-MOD-LAYOUT).
|
||||
std::optional<ShipLayoutConfig> shipLayout;
|
||||
|
||||
// Splitter output filters (empty = accept all). isSplitter distinguishes an
|
||||
// empty-filter splitter (a valid accept-all configuration) from a building
|
||||
// type that has no splitter filters at all.
|
||||
bool isSplitter = false;
|
||||
std::vector<ItemType> splitterFilterA;
|
||||
std::vector<ItemType> splitterFilterB;
|
||||
};
|
||||
|
||||
// Reads the current configuration of the building or construction site identified
|
||||
// by id, handling operational buildings and sites alike. Returns std::nullopt if
|
||||
// no such building or site exists.
|
||||
std::optional<BuildingConfig> readBuildingConfig(const Simulation& sim, BuildingId id);
|
||||
Reference in New Issue
Block a user