move blueprints out of the sidebar into Ctrl+C / Ctrl+V dialogs
The blueprint panel is gone; the side panel column now holds the selected building panel alone at full height. Saving is Ctrl+C on the current selection, and picking one for placement is a new frameless modal card grid opened with Ctrl+V, or handed to directly after a confirmed save. BlueprintPanel sheds its widget half and becomes BlueprintLibrary: the list, its disk round-trip, capture, and the T hotkey, with no widget of its own. MainWindow owns it and drives both dialogs, because ModalPauseScope needs a GameWorldView and only MainWindow has one. Both handlers hold a single pause scope and a single dim scope across the save-to-select handoff, so the dim does not blink and the simulation is not resumed in between. The two facts a card derives -- the per-type contents summary and the plain cost total -- go into lib/sim next to captureBlueprintFromSelection so they can be unit tested; src/ui is off the test include path. They are kept apart from GameWorldView's placement total, which excludes locked types and rotate-in-place targets and is a different number by design. A card's delete icon is a sibling of the card body rather than one of its children: Qt disables a widget's children along with it, and the delete has to stay live on an unaffordable card. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcReq7hVk4KUPhTDKWAG7K
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "ShipLayout.h"
|
||||
|
||||
class Simulation;
|
||||
struct BuildingsConfig;
|
||||
|
||||
// The user-configurable settings of a single building or construction site: the
|
||||
// selected recipe / ship schematic, the shipyard module layout, and (for
|
||||
@@ -49,6 +50,29 @@ Blueprint captureBlueprintFromSelection(const Simulation& sim,
|
||||
const std::vector<BuildingId>& selectedIds);
|
||||
|
||||
// True if any selected id refers to a player-placeable building or construction site
|
||||
// (the enable condition for the Create Blueprint button, REQ-UI-BLUEPRINT-CREATE).
|
||||
// (the condition under which Ctrl+C opens the blueprint save dialog,
|
||||
// REQ-UI-BLUEPRINT-CREATE).
|
||||
bool selectionHasPlaceableBuilding(const Simulation& sim,
|
||||
const std::vector<BuildingId>& selectedIds);
|
||||
|
||||
// One "<building name> x <count>" entry of a blueprint card's contents line
|
||||
// (REQ-UI-BLUEPRINT-CARD).
|
||||
struct BlueprintContentEntry
|
||||
{
|
||||
std::string buildingName;
|
||||
int count;
|
||||
};
|
||||
|
||||
// Summarizes what a blueprint holds: one entry per building type it contains, ordered
|
||||
// by descending count with ties broken by the order the types appear in buildings.toml
|
||||
// (which is the order of the build button bar, REQ-UI-BUILD-BAR). Building types absent
|
||||
// from the config sort last. Derived display data for the blueprint card, kept here so
|
||||
// it is unit-testable rather than buried in the dialog (REQ-UI-BLUEPRINT-CARD).
|
||||
std::vector<BlueprintContentEntry> summarizeBlueprintContents(
|
||||
const Blueprint& blueprint, const BuildingsConfig& buildings);
|
||||
|
||||
// Plain sum of the placement cost of every building in the blueprint
|
||||
// (REQ-UI-BLUEPRINT-CARD). Distinct from the total charged on placement
|
||||
// (REQ-UI-BLUEPRINT-PLACE), which additionally excludes locked building types and
|
||||
// rotate-in-place targets; see GameWorldView's placement path.
|
||||
int computeBlueprintCost(const Blueprint& blueprint, const BuildingsConfig& buildings);
|
||||
|
||||
Reference in New Issue
Block a user