Fix artifact header showing "0/?" during replay

The artifact-count poll was gated behind if (!m_replayPlayer) (from the merge
resolution), so ArtifactCountChangedEvent never fired in replay mode: the header
stayed at its initial "Artifacts: 0/?" literal and never reflected replayed
artifact picks.

Unlike the schematic/win/game-over polls (live-input sources / interruptions
that stay gated), artifact count is a passive reflection of sim state. Move it
out of the replay gate so it tracks m_sim->artifactCount() during playback too,
including the first-frame emit that populates the win-count max.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DUsFgd2Ga6pmLz8giS8WUn
This commit is contained in:
2026-07-01 22:06:32 +02:00
parent 5bdf0d5b8a
commit d38f68e301

View File

@@ -310,16 +310,6 @@ void GameWorldView::onFrame()
m_schematicChoiceShown = false; m_schematicChoiceShown = false;
} }
// Artifact count update
const int currentArtifactCount = m_sim->artifactCount();
if (currentArtifactCount != m_lastArtifactCount)
{
m_lastArtifactCount = currentArtifactCount;
EventManager::getInstance()->sendEventImmediately(
std::make_shared<ArtifactCountChangedEvent>(
currentArtifactCount, m_sim->config().world.artifacts.artifactWinCount));
}
// Win check // Win check
if (m_sim->isWon() && !m_winShown) if (m_sim->isWon() && !m_winShown)
{ {
@@ -338,6 +328,20 @@ void GameWorldView::onFrame()
} }
} }
// Artifact count is a passive reflection of sim state (not a live-input source
// like the schematic/game-over polls above), so it updates during replay too —
// the recorded ApplySchematicChoice drives m_sim->artifactCount() forward and
// the header bar must track it. Fires on the first frame (count 0 vs the -1
// sentinel), which also populates the win-count max (replacing the "0/?" label).
const int currentArtifactCount = m_sim->artifactCount();
if (currentArtifactCount != m_lastArtifactCount)
{
m_lastArtifactCount = currentArtifactCount;
EventManager::getInstance()->sendEventImmediately(
std::make_shared<ArtifactCountChangedEvent>(
currentArtifactCount, m_sim->config().world.artifacts.artifactWinCount));
}
update(); update();
} }