gnome-games r8078 - branches/gnome-2-24/gtali



Author: rancell
Date: Sat Oct 18 07:19:13 2008
New Revision: 8078
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8078&view=rev

Log:
Undoing 5 of a kind reduces the score by 50 as there might be multiple scores (Geoff Buchan, Bug #537673)

Modified:
   branches/gnome-2-24/gtali/yahtzee.c

Modified: branches/gnome-2-24/gtali/yahtzee.c
==============================================================================
--- branches/gnome-2-24/gtali/yahtzee.c	(original)
+++ branches/gnome-2-24/gtali/yahtzee.c	Sat Oct 18 07:19:13 2008
@@ -136,7 +136,7 @@
 NoDiceSelected (void)
 {
   int i, j = 1;
-  for (i = 0; i < 5; i++)
+  for (i = 0; i < NUMBER_OF_DICE; i++)
     if (DiceValues[i].sel)
       j = 0;
   return j;
@@ -146,7 +146,7 @@
 SelectAllDice (void)
 {
   int i;
-  for (i = 0; i < 5; i++)
+  for (i = 0; i < NUMBER_OF_DICE; i++)
     DiceValues[i].sel = 1;
 }
 
@@ -224,7 +224,7 @@
     return;
   }
 
-  for (i = 0; i < 5; i++) {
+  for (i = 0; i < NUMBER_OF_DICE; i++) {
     if (DiceValues[i].sel) {
       DiceValues[i].val = RollDie ();
       DiceValues[i].sel = 0;
@@ -235,7 +235,7 @@
 
   /* If no dice is selcted roll them all */
   if(cnt == 0){
-    for (i = 0; i < 5; i++) {
+    for (i = 0; i < NUMBER_OF_DICE; i++) {
       DiceValues[i].val = RollDie ();
       lastRoll.DiceValues[i] = DiceValues[i].val;
     }
@@ -323,7 +323,7 @@
 
   num = 0;
 
-  for (i = 0; i < 5; ++i)
+  for (i = 0; i < NUMBER_OF_DICE; ++i)
     if (DiceValues[i].val == val)
       ++num;
 
@@ -335,7 +335,7 @@
 {
   int i;
 
-  for (i = 0; i < 5; ++i) {
+  for (i = 0; i < NUMBER_OF_DICE; ++i) {
     if (DiceValues[i].val == but_not)
       continue;
 
@@ -387,7 +387,7 @@
 
   val = 0;
 
-  for (i = 0; i < 5; ++i)
+  for (i = 0; i < NUMBER_OF_DICE; ++i)
     val += DiceValues[i].val;
 
   return (val);
@@ -613,8 +613,14 @@
 UndoLastMove() {
   if (UndoList) {
     UndoScoreElement *elem = UndoList->data;
-    players[elem->player].score[elem->field] = 0;
-    players[elem->player].used [elem->field] = 0;
+    if (elem->field == H_YA && game_type == GAME_YAHTZEE) {
+      if (players[elem->player].score[elem->field] != 0)
+        players[elem->player].score[elem->field] -= 50;
+      players[elem->player].used [elem->field] = players[elem->player].score[elem->field] > 0;
+    } else {
+      players[elem->player].score[elem->field] = 0;
+      players[elem->player].used [elem->field] = 0;
+    }
 
     ResetDiceState(elem);
     UndoList = g_list_remove(UndoList, elem);



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