Fix New Game/Pause actions during countdowns
There are currently two issues with the 'New Game' and 'Pause' buttons if clicked during the countdown prior to the start of any level: (1) Clicking 'Pause' immediately ends the countdown and starts the game, thus messing the game state as the game is running while the button still says pause. Clicking the button again pauses the game very briefly, then immediately unpauses it. (2) Clicking 'New Game' -> 'Cancel' immediately starts the game (while the countdown is still running) therefore causing the game to start again (kind of) once more when the countdown reaches zero. This oddly results in an increased move speed of the worms and some labels overlaying the game screen which is bad. Note that clicking 'New Game' -> 'New Game' works just fine. As discussed in the bug report comments issue (1) will be fixed by always disabling the pause button during countdowns. As for issue (2) this commit fixes it by freezing the countdown while the new game dialog is open and making sure that clicking 'Cancel' will not start the game if the countdown hasn't yet expired, following that the game will only start when the countdown reaches zero. Also use g_timeout_add_seconds instead of g_timeout_add to reduce power usage. https://bugzilla.gnome.org/show_bug.cgi?id=762016
parent
56959e33
Please register or sign in to comment