rekey the temporary blueprint to C, add V to re-place it
This commit is contained in:
@@ -10,8 +10,10 @@
|
||||
#include "BuildingId.h"
|
||||
#include "EventHandler.h"
|
||||
#include "GameConfig.h"
|
||||
#include "GameResetEvent.h"
|
||||
#include "SelectionChangedEvent.h"
|
||||
#include "TemporaryBlueprintRequestedEvent.h"
|
||||
#include "TemporaryBlueprintCaptureRequestedEvent.h"
|
||||
#include "TemporaryBlueprintPlaceRequestedEvent.h"
|
||||
|
||||
class Simulation;
|
||||
class QWidget;
|
||||
@@ -24,9 +26,12 @@ class QWidget;
|
||||
// (REQ-UI-BLUEPRINT-DIALOG), and the modal dialogs that present them must be driven from
|
||||
// MainWindow, the only widget that can pause the game (ModalPauseScope) and raise the dim
|
||||
// overlay. This class is the model those dialogs read and mutate.
|
||||
class BlueprintLibrary : public CombinedEventHandler<SelectionChangedEvent,
|
||||
BlueprintModeExitedEvent,
|
||||
TemporaryBlueprintRequestedEvent>
|
||||
class BlueprintLibrary
|
||||
: public CombinedEventHandler<SelectionChangedEvent,
|
||||
BlueprintModeExitedEvent,
|
||||
TemporaryBlueprintCaptureRequestedEvent,
|
||||
TemporaryBlueprintPlaceRequestedEvent,
|
||||
GameResetEvent>
|
||||
{
|
||||
public:
|
||||
// dialogParent parents the load-failure message box (REQ-UI-BLUEPRINT-LOAD) and is
|
||||
@@ -67,7 +72,11 @@ public:
|
||||
private:
|
||||
void handleEvent(std::shared_ptr<const SelectionChangedEvent> event) override;
|
||||
void handleEvent(std::shared_ptr<const BlueprintModeExitedEvent> event) override;
|
||||
void handleEvent(std::shared_ptr<const TemporaryBlueprintRequestedEvent> event) override;
|
||||
void handleEvent(
|
||||
std::shared_ptr<const TemporaryBlueprintCaptureRequestedEvent> event) override;
|
||||
void handleEvent(
|
||||
std::shared_ptr<const TemporaryBlueprintPlaceRequestedEvent> event) override;
|
||||
void handleEvent(std::shared_ptr<const GameResetEvent> event) override;
|
||||
|
||||
Blueprint createBlueprintFromSelection() const;
|
||||
void loadFromDisk();
|
||||
@@ -83,4 +92,10 @@ private:
|
||||
// Index of the blueprint currently in placement mode, so deleting it can exit that
|
||||
// mode (REQ-UI-BLUEPRINT-DELETE). nullopt = no saved blueprint is being placed.
|
||||
std::optional<int> m_activeIndex;
|
||||
// The one unnamed blueprint captured with C and re-placed with V
|
||||
// (REQ-UI-BLUEPRINT-TEMP). Deliberately kept out of m_blueprints: it is never named,
|
||||
// never listed in the selection dialog, and never written to blueprints.toml. It
|
||||
// outlives its placement mode, so V can re-enter it. nullopt = none captured since
|
||||
// startup or the last restart.
|
||||
std::optional<Blueprint> m_temporaryBlueprint;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user