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

List:       kde-commits
Subject:    kdegames/kpat
From:       Frerich Raabe <raabe () kde ! org>
Date:       2004-03-30 18:11:58
Message-ID: 20040330181158.A3B4E999B () office ! kde ! org
[Download RAW message or body]

CVS commit by raabe: 

- Made the isGameLost function work better for the draw3 modus (in which not
  every card in the source pile is immediately accessible but only every
  third one). This is incomplete though, since it currently only covers the
  hidden cards which lie upside down, in reverse order.


  M +15 -3     klondike.cpp   1.46


--- kdegames/kpat/klondike.cpp  #1.45:1.46
@@ -373,8 +373,20 @@ bool Klondike::isGameLost() const
     }
 
-    // ### Fix this so that it works with draw3, too
     CardList srcPileCards;
+    if ( EasyRules ) {
     srcPileCards = pile->cards();
     srcPileCards += deck->cards();
+    } else {
+        /* In the draw3 mode, not every card in the source pile is accessible,
+         * but only third one. For the cards in the deck, start from the back
+         * since the cards are in reverse order.
+         */
+        for ( int i = deck->cards().count() - 3; i > 2; i -= 3 ) {
+            srcPileCards += deck->cards()[ i ];
+        }
+        if ( !deck->cards().isEmpty() && deck->cards().count() % 3 != 0 ) {
+            srcPileCards += deck->cards()[ 0 ];
+        }
+    }
 
     //  Check all seven stores


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

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