fix(engine): send confirmed:true from game-over screen New Game handlers
Build and Deploy / build-and-push (push) Successful in 4m51s
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:
@@ -1190,7 +1190,8 @@ fn handle_game_over_input(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if keys.just_pressed(KeyCode::KeyN) || keys.just_pressed(KeyCode::Escape) {
|
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) {
|
} else if keys.just_pressed(KeyCode::KeyU) {
|
||||||
for entity in &screens {
|
for entity in &screens {
|
||||||
commands.entity(entity).despawn();
|
commands.entity(entity).despawn();
|
||||||
@@ -1217,7 +1218,8 @@ fn handle_game_over_button_input(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if new_game_buttons.iter().any(|i| *i == Interaction::Pressed) {
|
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) {
|
} else if undo_buttons.iter().any(|i| *i == Interaction::Pressed) {
|
||||||
for entity in &screens {
|
for entity in &screens {
|
||||||
commands.entity(entity).despawn();
|
commands.entity(entity).despawn();
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user