https://bugs.kde.org/show_bug.cgi?id=522467
Bug ID: 522467
Summary: In a human vs human game, undoing first move switches
current player to white
Classification: Applications
Product: kreversi
Version First 2.1.260390
Reported In:
Platform: Other
OS: Linux
Status: REPORTED
Severity: minor
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
Created attachment 193914
--> https://bugs.kde.org/attachment.cgi?id=193914&action=edit
Undo patch
DESCRIPTION
When playing a human vs human game, and only making one first move for black,
then undoing it, then suddenly it's white's turn.
STEPS TO REPRODUCE
1. Start a human vs human game
2. Make one move for black and no more moves
3. Undo move
OBSERVED RESULT
White to move
EXPECTED RESULT
Black to move
SOFTWARE/OS VERSIONS
Operating System (available in the Info Center app, or by running `kinfo` in a
terminal window): Arch Linux
KDE Plasma Version: 6.7.1
KDE Frameworks Version: 6.27.0
Qt Version: 6.11.1
ADDITIONAL INFORMATION
I have prepared a fix, which I tried to open a PR for in the GitHub mirror,
but, since it's a mirror, the PR got automatically rejected, and I don't have
an account with invent.kde.org. Here's my fix (also attached as patch file):
```
diff --git a/src/kreversigame.cpp b/src/kreversigame.cpp
index c461fed..f5a1da0 100644
--- a/src/kreversigame.cpp
+++ b/src/kreversigame.cpp
@@ -153,6 +153,12 @@ int KReversiGame::undo()
m_changedChips.clear();
Q_EMIT boardChanged();
+
+ if (movesUndone % 2 == 1) {
+ m_curPlayer = Utils::opponentColorFor(m_curPlayer);
+ m_lastPlayer = Utils::opponentColorFor(m_curPlayer);
+ }
+
kickCurrentPlayer();
return movesUndone;
```
--
You are receiving this mail because:
You are watching all bug changes.