implement cost formula for asteroid expansion

This commit is contained in:
2026-07-04 15:28:19 +02:00
parent fc622670d2
commit e8786c3922
17 changed files with 141 additions and 15 deletions

View File

@@ -8,6 +8,7 @@
#include "BossWaveUpdatedEvent.h"
#include "BuildingBlocksChangedEvent.h"
#include "EventHandler.h"
#include "ExpansionCostChangedEvent.h"
#include "GameSpeedChangedEvent.h"
#include "Tick.h"
#include "TickAdvancedEvent.h"
@@ -18,6 +19,7 @@ class QPushButton;
class HeaderBar : public QWidget,
public CombinedEventHandler<TickAdvancedEvent,
BuildingBlocksChangedEvent,
ExpansionCostChangedEvent,
GameSpeedChangedEvent,
BossWaveUpdatedEvent,
ArtifactCountChangedEvent>
@@ -34,16 +36,25 @@ private slots:
private:
void handleEvent(std::shared_ptr<const TickAdvancedEvent> event) override;
void handleEvent(std::shared_ptr<const BuildingBlocksChangedEvent> event) override;
void handleEvent(std::shared_ptr<const ExpansionCostChangedEvent> event) override;
void handleEvent(std::shared_ptr<const GameSpeedChangedEvent> event) override;
void handleEvent(std::shared_ptr<const BossWaveUpdatedEvent> event) override;
void handleEvent(std::shared_ptr<const ArtifactCountChangedEvent> event) override;
// Refreshes the Expand button caption and enabled state from the current
// expansion cost and building block stock (REQ-UI-EXPAND-BUTTON).
void updateExpandButton();
QLabel* m_timeLabel;
QLabel* m_blocksLabel;
QLabel* m_artifactsLabel;
QLabel* m_bossLabel;
QPushButton* m_expandButton;
std::vector<QPushButton*> m_speedButtons;
int m_blocks = 0;
int m_expansionCost = 0;
static const double kSpeeds[];
static const int kSpeedCount;
};