Add artifact win condition #3
@@ -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<ArtifactCountChangedEvent>(
|
||||
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<ArtifactCountChangedEvent>(
|
||||
currentArtifactCount, m_sim->config().world.artifacts.artifactWinCount));
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user