[critical] Space/D keys fire DrawRequestEvent during replay playback #8

Closed
opened 2026-05-19 18:42:00 +00:00 by funman300 · 0 comments
Owner

File

solitaire_engine/src/input_plugin.rs lines 241–244

Description

handle_keyboard_core emits DrawRequestEvent on Space (and the D-key draw path) with no guard for active replay playback. handle_pause_keyboard in replay_overlay.rs handles the same Space key to toggle pause — both systems run in the same Update schedule with no ordering between them.

Pressing Space during a replay simultaneously toggles the pause state and fires a DrawRequestEvent into handle_draw, which mutates GameStateResource. This breaks replay determinism — the recorded move sequence diverges from what the engine is executing.

Fix

Add if replay_state.is_some_and(|s| s.is_active()) { return; } at the top of handle_keyboard_core, or gate the draw path on replay not being active.

## File `solitaire_engine/src/input_plugin.rs` lines 241–244 ## Description `handle_keyboard_core` emits `DrawRequestEvent` on `Space` (and the D-key draw path) with no guard for active replay playback. `handle_pause_keyboard` in `replay_overlay.rs` handles the same `Space` key to toggle pause — both systems run in the same `Update` schedule with no ordering between them. Pressing `Space` during a replay simultaneously toggles the pause state **and** fires a `DrawRequestEvent` into `handle_draw`, which mutates `GameStateResource`. This breaks replay determinism — the recorded move sequence diverges from what the engine is executing. ## Fix Add `if replay_state.is_some_and(|s| s.is_active()) { return; }` at the top of `handle_keyboard_core`, or gate the draw path on replay not being active.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#8