Bug 127531

Summary: kreversi does not update score on undo
Product: [Applications] kreversi Reporter: Olivier Trichet <nive>
Component: generalAssignee: Inge Wallin <inge>
Status: RESOLVED FIXED    
Severity: normal CC: ana, me
Priority: NOR    
Version: 1.7   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Olivier Trichet 2006-05-17 21:27:41 UTC
Version:           1.7 (using KDE 3.5.2, Debian Package 4:3.5.2-2+b1 (testing/unstable))

[from : http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=362942 ]
Package: kreversi
Version: 4:3.5.2-1
Severity: normal

When I choose "undo", the score is not updated. It remains the same as before
the undo, even though the actual count is now different.

Depending on the circumstanses, this can make you loose a game you should have
won, or make you win a game by more than 64.
Comment 1 Inge Wallin 2006-07-01 20:32:25 UTC
Indeed.  How could I have missed this?  What a terribly annoying bug.

I will fix this for KDE 3.5.4 (and of course 4.0).
Comment 2 Inge Wallin 2006-07-01 21:34:24 UTC
*** Bug 125858 has been marked as a duplicate of this bug. ***
Comment 3 Inge Wallin 2006-07-03 15:42:06 UTC
SVN commit 557535 by ingwa:

Fix bug 127531: kreversi does not update score on undo.

- Keep track of score when removing a move too.

BUG: 127531



 M  +8 -0      ChangeLog  
 M  +4 -0      Position.cpp  
 M  +4 -1      qreversigameview.h  


--- branches/KDE/3.5/kdegames/kreversi/ChangeLog #557534:557535
@@ -1,3 +1,11 @@
+2006-07-03  Inge Wallin  <inge@lysator.liu.se>
+
+	* Position.cpp (undoMove): Keep track of score when undoing a
+	move.
+
+	* qreversigameview.h (removeMove): show game status after removing
+	a move.
+	
 2006-07-02  Inge Wallin  <inge@lysator.liu.se>
 
 	* qreversigameview.cpp (moveMade): Print color Red/Blue in
--- branches/KDE/3.5/kdegames/kreversi/Position.cpp #557534:557535
@@ -314,11 +314,15 @@
     int  sq = *it;
 
     m_board[sq / 10][sq % 10] = other;
+    m_score.dec(color);
+    m_score.inc(other);
   }
 
   // 2. Remove the move itself.
+  m_score.dec(color);
   m_board[move.x()][move.y()] = Nobody;
 
+
   return true;
 }
 
--- branches/KDE/3.5/kdegames/kreversi/qreversigameview.h #557534:557535
@@ -100,7 +100,10 @@
   // Proxy methods for the movelist
   // FIXME: Not all of these need to be externally reachable
   void insertMove(QString moveString) { m_movesView->insertItem(moveString); }
-  void removeMove(int moveNum) { m_movesView->removeItem(moveNum); }
+  void removeMove(int moveNum) { 
+    m_movesView->removeItem(moveNum); 
+    updateStatus();
+  }
   void setCurrentMove(int moveNum) { 
     m_movesView->setCurrentItem(moveNum); 
     m_movesView->ensureCurrentVisible();
Comment 4 Inge Wallin 2006-07-03 15:58:35 UTC
SVN commit 557545 by ingwa:

Fix bug 127531: kreversi does not update score on undo

 - Keep track of score when removing a move too.

CCBUG: 127531


 M  +8 -0      ChangeLog  
 M  +4 -0      Position.cpp  
 M  +4 -1      qreversigameview.h  


--- trunk/KDE/kdegames/kreversi/ChangeLog #557544:557545
@@ -1,3 +1,11 @@
+2006-07-03  Inge Wallin  <inge@lysator.liu.se>
+
+	* Position.cpp (undoMove): Keep track of score when undoing a
+	move.
+
+	* qreversigameview.h (removeMove): show game status after removing
+	a move.
+	
 2006-07-02  Inge Wallin  <inge@lysator.liu.se>
 
 	* qreversigameview.cpp (moveMade): Print color Red/Blue in
--- trunk/KDE/kdegames/kreversi/Position.cpp #557544:557545
@@ -316,11 +316,15 @@
     int  sq = *it;
 
     m_board[sq / 10][sq % 10] = other;
+    m_score.dec(color);
+    m_score.inc(other);
   }
 
   // 2. Remove the move itself.
+  m_score.dec(color);
   m_board[move.x()][move.y()] = Nobody;
 
+
   return true;
 }
 
--- trunk/KDE/kdegames/kreversi/qreversigameview.h #557544:557545
@@ -103,7 +103,10 @@
   // Proxy methods for the movelist
   // FIXME: Not all of these need to be externally reachable
   void insertMove(QString moveString) { m_movesView->insertItem(moveString); }
-  void removeMove(int moveNum) { m_movesView->removeItem(moveNum); }
+  void removeMove(int moveNum) { 
+    m_movesView->removeItem(moveNum); 
+    updateStatus();
+  }
   void setCurrentMove(int moveNum) { 
     m_movesView->setCurrentItem(moveNum); 
     m_movesView->ensureCurrentVisible();