From e06be9d121d5738413fcd43842bc06cc520e7bcb Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Fri, 12 Sep 2025 22:19:43 -0500 Subject: [PATCH] fix: prevent race end modal from breaking endless route progression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add mode detection in checkStationArrivals() to differentiate steam journey vs regular race - Skip endRace() call when in endless steam journey mode (detected by .route-path element) - Let handleRouteCompletion() properly handle 100% position in endless mode - Preserve normal race ending behavior for regular race modes - Fixes issue where gold/silver/bronze modal would appear instead of route progression Now steam train journey properly transitions between routes endlessly while maintaining normal race completion behavior for other game modes. 🚂 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/web_generator.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/web_generator.py b/src/web_generator.py index 95db9477..cb58ffc5 100644 --- a/src/web_generator.py +++ b/src/web_generator.py @@ -13812,9 +13812,19 @@ def generate_web_flashcards(numbers, config, output_path): timeSinceLastCoal > (config.starvationThreshold * 2); // Much longer grace period if (journeyComplete) {{ - const score = this.totalScore; - const deliveredCount = this.correctAnswers; // Questions answered correctly - this.endRace(`🎉 Journey Complete! Reached Capital Station! Score: ${{score}} points from ${{deliveredCount}} deliveries!`); + // Check if we're in endless steam journey mode or regular race mode + const isEndlessSteamJourney = document.querySelector('.route-path'); // Steam journey has route-path + + if (isEndlessSteamJourney) {{ + // Don't end race - let the endless route progression handle this + console.log('🚂 Journey complete detected but endless mode active - route progression will handle'); + return; + }} else {{ + // Regular race mode - end normally + const score = this.totalScore; + const deliveredCount = this.correctAnswers; + this.endRace(`🎉 Journey Complete! Reached Capital Station! Score: ${{score}} points from ${{deliveredCount}} deliveries!`); + }} }} else if (trainStuck) {{ // Train is truly stuck - but this should be very rare now with adaptive difficulty const progress = Math.round(this.trainPosition);