[games/kapman/release/26.08] src: Check if pausing is locked before unpausing in Game::switchPause
Jack Hill <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit cfc1288c42ca063fa675c4e9edeecb20f219326e by Jack Hill. Committed on 03/08/2026 at 18:19. Pushed by jackh into branch 'release/26.08'. Check if pausing is locked before unpausing in Game::switchPause There is a bug where, if the game is paused during death and the user also pauses the game manually (with Q or Esc), the game temporarily unpauses and moves until the player is killed a second time. The user can then unpause again, take more damage, and even “lose” multiple times. The problem is in `Game::switchPause` as we don’t check whether pausing is locked, and that causes the user to be able to pause despite it being locked. This PR fixes the issue by checking whether unpausing is locked before proceeding. (cherry picked from commit 7c43b14d889ad5bd2d7e78ae3aaa03b5e1867d30) b6b018c3 Check if pausing is locked before unpausing in Game::switchPause Co-authored-by: unexplored test <[email protected]> M +2 -2 src/game.cpp https://invent.kde.org/games/kapman/-/commit/cfc1288c42ca063fa675c4e9edeecb20f219326e diff --git a/src/game.cpp b/src/game.cpp index 4667525..aa336c7 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -159,8 +159,8 @@ void Game::switchPause(bool p_locked) pause(p_locked); Q_EMIT pauseChanged(true, true); } - // If the Game is already paused - else { + // If the Game is already paused and user is allowed to unpause + else if (m_state == PAUSED_UNLOCKED) { // Resume the Game start(); Q_EMIT pauseChanged(false, true);