Implement config-driven unlock groups so that multiple things can be unlocked at once (including buildings)

This commit is contained in:
2026-07-22 21:34:59 +02:00
parent a8a6a04f1e
commit a9082c57f3
36 changed files with 1005 additions and 543 deletions

View File

@@ -13,6 +13,7 @@
#include "DemolishModeChangedEvent.h"
#include "EventHandler.h"
#include "GameConfig.h"
#include "UnlockedBuildingsChangedEvent.h"
class QPushButton;
class Simulation;
@@ -21,7 +22,8 @@ class BuildButtonGrid : public QWidget,
public CombinedEventHandler<BuilderModeExitedEvent,
DemolishModeChangedEvent,
BuildHotkeyPressedEvent,
BuildingBlocksChangedEvent>
BuildingBlocksChangedEvent,
UnlockedBuildingsChangedEvent>
{
Q_OBJECT
@@ -37,10 +39,15 @@ private:
// be afforded, it exits builder mode so the button does not stay selected.
void updateAffordability();
// Re-evaluates which build buttons are visible from the current per-building
// unlock state (REQ-LOCK-BUILDING); a locked building type's button is hidden.
void updateVisibility();
void handleEvent(std::shared_ptr<const BuilderModeExitedEvent> event) override;
void handleEvent(std::shared_ptr<const DemolishModeChangedEvent> event) override;
void handleEvent(std::shared_ptr<const BuildHotkeyPressedEvent> event) override;
void handleEvent(std::shared_ptr<const BuildingBlocksChangedEvent> event) override;
void handleEvent(std::shared_ptr<const UnlockedBuildingsChangedEvent> event) override;
private slots:
void onBuildButton(int index);