From d38f68e301dc8c6d893e0d9e6422a3b28a9767ed Mon Sep 17 00:00:00 2001 From: Malte Langkabel Date: Wed, 1 Jul 2026 22:06:32 +0200 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01DUsFgd2Ga6pmLz8giS8WUn --- src/ui/GameWorldView.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/ui/GameWorldView.cpp b/src/ui/GameWorldView.cpp index c5893bc..86679cd 100644 --- a/src/ui/GameWorldView.cpp +++ b/src/ui/GameWorldView.cpp @@ -310,16 +310,6 @@ void GameWorldView::onFrame() 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( - currentArtifactCount, m_sim->config().world.artifacts.artifactWinCount)); - } - // Win check 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( + currentArtifactCount, m_sim->config().world.artifacts.artifactWinCount)); + } + update(); }