[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/kreversi_rewrite
From:       Dmitry Suzdalev <dimsuz () gmail ! com>
Date:       2006-09-04 12:18:52
Message-ID: 1157372332.959364.17227.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 580764 by dimsuz:

few fixes


 M  +16 -8     kreversiscene.cpp  


--- branches/work/kreversi_rewrite/kreversiscene.cpp #580763:580764
@@ -105,10 +105,14 @@
             else
             {
                 // this if-branch happens on undos
-                delete itemAt( cellCenter(row, col) );
+
+                // deleting only KReversiChips
+                KReversiChip *chip = dynamic_cast<KReversiChip*>(itemAt( cellCenter(row, col) ));
+                delete chip;
             }
         }
     m_lastMoveChip = 0;
+    displayLastAndPossibleMoves();
 }
 
 void KReversiScene::toggleDemoMode( bool toggle )
@@ -122,6 +126,13 @@
 
 void KReversiScene::slotGameMoveFinished()
 {
+    // hide shown legal moves
+    if( m_showPossibleMoves )
+    {
+        foreach( QGraphicsRectItem* rect, m_possibleMovesItems )
+            rect->hide();
+    }
+
     m_changedChips = m_game->changedChips();
     // create an item that was placed by player
     // by convention it will be the first in the list of changed items
@@ -231,6 +242,10 @@
     // ==== Show Possible Moves ====
     if( m_showPossibleMoves && !m_game->isComputersTurn() )
     {
+        //hide currently displayed if any
+        foreach( QGraphicsRectItem* rect, m_possibleMovesItems )
+            rect->hide();
+
         MoveList l = m_game->possibleMoves();
         kDebug() << "number of rects: " << m_possibleMovesItems.count() << endl;
         // if m_possibleMovesItems contains less rects then there are items in l
@@ -349,13 +364,6 @@
     
     //kDebug() << "Cell (" << row << "," << col << ") clicked." << endl;
 
-    // hide shown legal moves
-    if( m_showPossibleMoves )
-    {
-        foreach( QGraphicsRectItem* rect, m_possibleMovesItems )
-            rect->hide();
-    }
-
     m_game->makePlayerMove( row, col, false );
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic