[games/kapman] 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 7c43b14d889ad5bd2d7e78ae3aaa03b5e1867d30 by Jack Hill, on behalf of unexplored test.
Committed on 01/08/2026 at 09:30.
Pushed by jackh into branch 'master'.
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.
M +2 -2 src/game.cpp
https://invent.kde.org/games/kapman/-/commit/7c43b14d889ad5bd2d7e78ae3aaa03b5e1867d30
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);