fix(engine): start new game when player confirms abandon-current-game modal
Reported during 2026-04-29 smoke test: pressing Y on the
ConfirmNewGameScreen modal closed nothing and didn't start a new game.
Trace:
Frame N: handle_confirm_input despawns the modal entity (deferred),
writes NewGameRequestEvent.
End of N: command flush — modal gone.
Frame N+1: handle_new_game reads the event. needs_confirm is still
true (game state unchanged). confirm_already_open is now
false (modal flushed). Condition matches → spawn_confirm_
dialog runs again, the modal reappears, and the new game
never starts.
Add a `confirmed: bool` field to NewGameRequestEvent. handle_confirm_
input writes it as true on Y/Enter so handle_new_game's dialog-spawn
guard short-circuits and the existing despawn-and-start branch runs.
All other writers (button click, N hotkey, mode hotkeys, daily/
challenge/time-attack auto-deal, tests) stay at `confirmed: false`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,13 @@ pub struct UndoRequestEvent;
|
||||
pub struct NewGameRequestEvent {
|
||||
pub seed: Option<u64>,
|
||||
pub mode: Option<GameMode>,
|
||||
/// `true` when this request originated from the user confirming the
|
||||
/// abandon-current-game modal (Y / Enter on `ConfirmNewGameScreen`).
|
||||
/// `handle_new_game` skips spawning the dialog when this is set,
|
||||
/// otherwise it would respawn the modal in the frame after the player
|
||||
/// presses Y (the despawn-on-Y has flushed by then) and the new game
|
||||
/// would never actually start.
|
||||
pub confirmed: bool,
|
||||
}
|
||||
|
||||
/// Fired by `GamePlugin` after any successful state mutation. Rendering and
|
||||
|
||||
Reference in New Issue
Block a user