gnome-games r8156 - trunk/aisleriot



Author: jclinton
Date: Tue Oct 21 19:46:26 2008
New Revision: 8156
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8156&view=rev

Log:
When checking if the cards that haven't moved are the same, ignore
whether the card is flipped.

Modified:
   trunk/aisleriot/board.c

Modified: trunk/aisleriot/board.c
==============================================================================
--- trunk/aisleriot/board.c	(original)
+++ trunk/aisleriot/board.c	Tue Oct 21 19:46:26 2008
@@ -937,16 +937,25 @@
 
     g_assert (slot->cards->len == slot->card_images->len);
 
-    if (slot->old_cards->len > slot->cards->len
-        && !memcmp (slot->old_cards->data, slot->cards->data,
-                    slot->cards->len)) {
-      for (i = slot->cards->len; i < slot->old_cards->len; i++) {
-        RemovedCard removed_card;
-
-        removed_card.card = CARD (slot->old_cards->data[i]);
-        removed_card.cardx = slot->rect.x + slot->pixeldx * i;
-        removed_card.cardy = slot->rect.y + slot->pixeldy * i;
-        g_array_append_val (removed_cards, removed_card);
+    if (slot->old_cards->len > slot->cards->len) {
+      for (i = 0; i < slot->cards->len; i++) {
+        Card old_card = CARD (slot->old_cards->data[i]);
+        Card new_card = CARD (slot->cards->data[i]);
+
+        if (old_card.attr.suit != new_card.attr.suit
+            || old_card.attr.rank != new_card.attr.rank)
+          break;
+      }
+
+      if (i >= slot->cards->len) {
+        for (; i < slot->old_cards->len; i++) {
+          RemovedCard removed_card;
+
+          removed_card.card = CARD (slot->old_cards->data[i]);
+          removed_card.cardx = slot->rect.x + slot->pixeldx * i;
+          removed_card.cardy = slot->rect.y + slot->pixeldy * i;
+          g_array_append_val (removed_cards, removed_card);
+        }
       }
     }
   }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]