From 4ed5287792481fa6e032746cdf472ad75a589fc4 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Thu, 11 Jan 2024 12:23:23 +0000 Subject: [PATCH] Solitaire: Hide solve button when game ends `on_game_start` is not called until the player makes a move, so waiting until then means that the solve button would still be visible when starting a new game after completing one. By hiding the button in `on_game_end`, this happens when the game-over animation starts playing instead. --- Userland/Games/Solitaire/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Games/Solitaire/main.cpp b/Userland/Games/Solitaire/main.cpp index 86c0569d93..4d73afbd98 100644 --- a/Userland/Games/Solitaire/main.cpp +++ b/Userland/Games/Solitaire/main.cpp @@ -100,6 +100,7 @@ ErrorOr serenity_main(Main::Arguments arguments) game.start_solving(); solve_button.set_enabled(false); }; + solve_button.set_enabled(false); auto& statusbar = *widget->find_descendant_of_type_named("statusbar"); statusbar.set_text(0, "Score: 0"_string); @@ -126,8 +127,6 @@ ErrorOr serenity_main(Main::Arguments arguments) })); game.on_game_start = [&]() { - solve_button.set_enabled(false); - action_bar.set_visible(false); seconds_elapsed = 0; timer->start(); statusbar.set_text(2, "Time: 00:00"_string); @@ -141,6 +140,7 @@ ErrorOr serenity_main(Main::Arguments arguments) timer->stop(); solve_button.set_enabled(false); + action_bar.set_visible(false); if (reason == Solitaire::GameOverReason::Victory) { if (seconds_elapsed >= 30) {