Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/boards
diff options
context:
space:
mode:
authorBruno Coudoin <bcoudoin@src.gnome.org>2009-03-17 21:17:17 (GMT)
committer Bruno Coudoin <bcoudoin@src.gnome.org>2009-03-17 21:17:17 (GMT)
commit211d9d1bb36de59b5569507587a47227ec45a80f (patch)
tree1b36b85c5acaed9de83d7877d2cc36b3d0bc2dc1 /src/boards
parent2ad248eaa96c7bd2a1f09ac8086ffc2860eaa9d5 (diff)
- 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. svn path=/trunk/; revision=3782
Diffstat (limited to 'src/boards')
-rw-r--r--src/boards/memory.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/boards/memory.c b/src/boards/memory.c
index 2b88d87..1c3cb2b 100644
--- a/src/boards/memory.c
+++ b/src/boards/memory.c
@@ -286,6 +286,7 @@ static BoardPlugin menu_bp =
*/
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 @@ static void memory_next_level()
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 @@ static void check_win()
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 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, MemoryItem *memoryItem)
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 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, MemoryItem *memoryItem)
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;
}