drop the now-dead payloads from the sim-backed state-change events
TickAdvanced, BuildingBlocksChanged, ExpansionCostChanged, BossWaveUpdated and ArtifactCountChanged all duplicated state the Simulation already owns. With every subscriber re-reading from the sim, the fields had no readers left, so the five events become payload-free refresh signals and the emitters keep the values only as locals for change detection. This makes the convention uniform: a state-change event backed by the simulation carries nothing. Events whose state lives in the view (selection, game speed, deconstruct and debug-draw modes) keep their payloads, since there is no sim getter behind them. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YHcUerKAZKWNvSKJxYKbnG
This commit is contained in:
@@ -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