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

List:       kde-commits
Subject:    KDE/kdegames/kpat/libkcardgame
From:       Parker Coates <parker.coates () kdemail ! net>
Date:       2011-05-01 3:54:48
Message-ID: 20110501035448.BD050AC85D () svn ! kde ! org
[Download RAW message or body]

SVN commit 1229903 by coates:

Correct card ordering in KCardScene::flipCardsToPile().

When flipping multiple cards from one pile to another, we have to
reverse the stacking order of the cards. The topmost card on the source
pile becomes the bottommost card on the destination pile. This fixes
the waste to stock recycling in both Klondike and Forty & Eight.

The previous behaviour wasn't necessarily wrong, but it did represent a
maneuver that can't really be done with real cards in a single move,
hence it wasn't the correct behaviour for the games in question.

 M  +4 -1      kcardscene.cpp  


--- trunk/KDE/kdegames/kpat/libkcardgame/kcardscene.cpp #1229902:1229903
@@ -166,8 +166,11 @@
 
     const QList<KCard*> oldCards = pile->cards();
 
-    foreach ( KCard * c, newCards )
+    for ( int i = 0; i < newCards.size(); ++i )
     {
+        // If we're flipping the cards, we have to add them to the pile in
+        // reverse order.
+        KCard * c = newCards[ flip ? newCards.size() - 1 - i : i ];
         pile->add( c );
         if ( flip )
             c->setFaceUp( !c->isFaceUp() );
[prev in list] [next in list] [prev in thread] [next in thread] 

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