gcompris r3782 - in trunk: . src/boards



Author: bcoudoin
Date: Tue Mar 17 21:17:17 2009
New Revision: 3782
URL: http://svn.gnome.org/viewvc/gcompris?rev=3782&view=rev

Log:
	- Fixed a little issue. It was possible for the user in
	  memory sound against tux to click on as many card she wants
	  if she does not wait for the end of the sound.



Modified:
   trunk/ChangeLog
   trunk/src/boards/memory.c

Modified: trunk/src/boards/memory.c
==============================================================================
--- trunk/src/boards/memory.c	(original)
+++ trunk/src/boards/memory.c	Tue Mar 17 21:17:17 2009
@@ -286,6 +286,7 @@
  */
 
 static gboolean to_tux = FALSE;
+static gboolean lock_user = FALSE;
 static GQueue *tux_memory;
 static gint tux_memory_size;
 static gint tux_memory_sizes[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
@@ -975,6 +976,8 @@
 
   create_item(boardRootItem);
 
+  lock_user = FALSE;
+
   if (currentMode == MODE_TUX){
 	tux_memory_size = tux_memory_sizes[gcomprisBoard->level];
 	g_warning("tux_memory_size %d", tux_memory_size );
@@ -1513,20 +1516,23 @@
     timeout_tux = 2000;
   }
 
+
   // Check win
   if (compare_card((gpointer) firstCard, (gpointer) secondCard) == 0) {
     gc_sound_play_ogg ("sounds/flip.wav", NULL);
     win_id = g_timeout_add (timeout,
 			    (GSourceFunc) hide_card, NULL);
+    lock_user = FALSE;
     return;
   }
 
   if (currentMode == MODE_TUX){
-		 /* time to tux to play, after a delay */
+    /* time to tux to play, after a delay */
     to_tux = TRUE;
     g_warning("Now tux will play !");
     tux_id = g_timeout_add (timeout_tux,
 			    (GSourceFunc) tux_play, NULL);
+    lock_user = FALSE;
     return;
   }
 
@@ -1547,7 +1553,7 @@
          case 1:
 
 	   if (currentMode == MODE_TUX){
-	     if (to_tux){
+	     if (to_tux || lock_user){
 	       g_warning("He ! it's tux turn !");
 	       return FALSE;
 	     }
@@ -1590,10 +1596,12 @@
 	       if (currentMode == MODE_TUX)
 		 add_card_in_tux_memory(memoryItem);
 	       display_card(memoryItem, ON_FRONT);
-	       if (currentUiMode == UIMODE_SOUND)
+	       if (currentUiMode == UIMODE_SOUND) {
 		 // Check win is called from callback return
+		 // The user lost, make sure she won't play again before tux
+		 lock_user = TRUE;
 		 return TRUE;
-	       else {
+	       } else {
 		 check_win();
 		 return TRUE;
 	       }



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