fix(engine): send confirmed:true from game-over screen New Game handlers
Build and Deploy / build-and-push (push) Successful in 4m51s

The 'No Moves Available' dialog's New Game button and keyboard shortcut
were firing NewGameRequestEvent::default() (confirmed: false). When the
player has made moves, handle_new_game sees needs_confirm = true, then
hits the scrims.is_empty() guard — which is false because the GameOver-
Screen itself is a ModalScrim — and silently returns without starting a
new game or showing the confirm dialog.

Fix: set confirmed: true in both handle_game_over_input (N/Escape key)
and handle_game_over_button_input (click). The game is already stuck so
the abandon-confirmation guard does not apply, as the doc comment on the
button handler has always said.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-06-01 15:26:07 -07:00
parent 44e90ff582
commit 20e5222148
2 changed files with 4 additions and 2 deletions
+4 -2
View File
@@ -1190,7 +1190,8 @@ fn handle_game_over_input(
};
if keys.just_pressed(KeyCode::KeyN) || keys.just_pressed(KeyCode::Escape) {
new_game.write(NewGameRequestEvent::default());
// confirmed: true — the game is already stuck; no abandon-confirmation needed.
new_game.write(NewGameRequestEvent { confirmed: true, ..default() });
} else if keys.just_pressed(KeyCode::KeyU) {
for entity in &screens {
commands.entity(entity).despawn();
@@ -1217,7 +1218,8 @@ fn handle_game_over_button_input(
return;
}
if new_game_buttons.iter().any(|i| *i == Interaction::Pressed) {
new_game.write(NewGameRequestEvent::default());
// confirmed: true — the game is already stuck; no abandon-confirmation needed.
new_game.write(NewGameRequestEvent { confirmed: true, ..default() });
} else if undo_buttons.iter().any(|i| *i == Interaction::Pressed) {
for entity in &screens {
commands.entity(entity).despawn();