drop the dead payloads from the state-change events
This commit is contained in:
@@ -2,10 +2,9 @@
|
||||
|
||||
#include "Event.h"
|
||||
|
||||
// Fired when the collected artifact count changes. Carries no payload —
|
||||
// subscribers re-read Simulation::getArtifactCount(), and the win count from
|
||||
// world.artifacts.artifactWinCount.
|
||||
class ArtifactCountChangedEvent : public Event
|
||||
{
|
||||
public:
|
||||
ArtifactCountChangedEvent(int count, int winCount) : count(count), winCount(winCount) {}
|
||||
const int count;
|
||||
const int winCount;
|
||||
};
|
||||
|
||||
@@ -2,16 +2,11 @@
|
||||
#define BOSS_WAVE_UPDATED_EVENT_H
|
||||
|
||||
#include "Event.h"
|
||||
#include "Tick.h"
|
||||
|
||||
// Fired when the boss wave counter or its countdown changes. Carries no payload —
|
||||
// subscribers re-read Simulation::getBossWaveCounter() and getBossCountdownTicks().
|
||||
class BossWaveUpdatedEvent : public Event
|
||||
{
|
||||
public:
|
||||
BossWaveUpdatedEvent(int counter, Tick countdownTicks)
|
||||
: counter(counter), countdownTicks(countdownTicks) {}
|
||||
const int counter;
|
||||
const Tick countdownTicks;
|
||||
};
|
||||
|
||||
#endif // BOSS_WAVE_UPDATED_EVENT_H
|
||||
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
|
||||
#include "Event.h"
|
||||
|
||||
// Fired when the building block stock changes. Carries no payload — subscribers
|
||||
// re-read Simulation::getBuildingBlocksStock().
|
||||
class BuildingBlocksChangedEvent : public Event
|
||||
{
|
||||
public:
|
||||
explicit BuildingBlocksChangedEvent(int blocks) : blocks(blocks) {}
|
||||
const int blocks;
|
||||
};
|
||||
|
||||
#endif // BUILDING_BLOCKS_CHANGED_EVENT_H
|
||||
|
||||
|
||||
@@ -4,14 +4,11 @@
|
||||
#include "Event.h"
|
||||
|
||||
// Fired when the current asteroid-expansion cost changes (REQ-EXP-COST): once at
|
||||
// startup and again after each expansion is purchased. Carries the cost in
|
||||
// building blocks so the header Expand button can update its caption/enabled
|
||||
// state (REQ-UI-EXPAND-BUTTON).
|
||||
// startup and again after each expansion is purchased. Carries no payload — the
|
||||
// header Expand button re-reads Simulation::getCurrentExpansionCost() to update
|
||||
// its caption and enabled state (REQ-UI-EXPAND-BUTTON).
|
||||
class ExpansionCostChangedEvent : public Event
|
||||
{
|
||||
public:
|
||||
explicit ExpansionCostChangedEvent(int cost) : cost(cost) {}
|
||||
const int cost;
|
||||
};
|
||||
|
||||
#endif // EXPANSION_COST_CHANGED_EVENT_H
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
#define TICK_ADVANCED_EVENT_H
|
||||
|
||||
#include "Event.h"
|
||||
#include "Tick.h"
|
||||
|
||||
// Fired when the simulation tick advances. Carries no payload — subscribers
|
||||
// re-read Simulation::getCurrentTick().
|
||||
class TickAdvancedEvent : public Event
|
||||
{
|
||||
public:
|
||||
explicit TickAdvancedEvent(Tick tick) : tick(tick) {}
|
||||
const Tick tick;
|
||||
};
|
||||
|
||||
#endif // TICK_ADVANCED_EVENT_H
|
||||
|
||||
|
||||
@@ -403,26 +403,26 @@ void GameWorldView::onFrame()
|
||||
{
|
||||
m_lastTick = newTick;
|
||||
EventManager::getInstance()->sendEventImmediately(
|
||||
std::make_shared<TickAdvancedEvent>(newTick));
|
||||
std::make_shared<TickAdvancedEvent>());
|
||||
}
|
||||
if (newBlocks != m_lastBlocks)
|
||||
{
|
||||
m_lastBlocks = newBlocks;
|
||||
EventManager::getInstance()->sendEventImmediately(
|
||||
std::make_shared<BuildingBlocksChangedEvent>(newBlocks));
|
||||
std::make_shared<BuildingBlocksChangedEvent>());
|
||||
}
|
||||
if (newExpCost != m_lastExpansionCost)
|
||||
{
|
||||
m_lastExpansionCost = newExpCost;
|
||||
EventManager::getInstance()->sendEventImmediately(
|
||||
std::make_shared<ExpansionCostChangedEvent>(newExpCost));
|
||||
std::make_shared<ExpansionCostChangedEvent>());
|
||||
}
|
||||
if (newBoss != m_lastBossCounter || newCountdown != m_lastBossCountdown)
|
||||
{
|
||||
m_lastBossCounter = newBoss;
|
||||
m_lastBossCountdown = newCountdown;
|
||||
EventManager::getInstance()->sendEventImmediately(
|
||||
std::make_shared<BossWaveUpdatedEvent>(newBoss, newCountdown));
|
||||
std::make_shared<BossWaveUpdatedEvent>());
|
||||
}
|
||||
|
||||
// Unlocked building set changes only after a drop is applied or on Restart
|
||||
@@ -485,8 +485,7 @@ void GameWorldView::onFrame()
|
||||
{
|
||||
m_lastArtifactCount = currentArtifactCount;
|
||||
EventManager::getInstance()->sendEventImmediately(
|
||||
std::make_shared<ArtifactCountChangedEvent>(
|
||||
currentArtifactCount, m_sim->getConfig().world.artifacts.artifactWinCount));
|
||||
std::make_shared<ArtifactCountChangedEvent>());
|
||||
}
|
||||
|
||||
update();
|
||||
|
||||
Reference in New Issue
Block a user