[iagno] Correct some end-of-game bugs.
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Correct some end-of-game bugs.
- Date: Wed, 1 Oct 2014 17:04:29 +0000 (UTC)
commit 3f74d0929461179498c4807567e55e1c414e03e6
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Oct 1 00:20:00 2014 +0200
Correct some end-of-game bugs.
https://bugzilla.gnome.org/show_bug.cgi?id=737410
src/iagno.vala | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/iagno.vala b/src/iagno.vala
index aa14d30..46acb14 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -276,8 +276,10 @@ public class Iagno : Gtk.Application
show_game_board ();
back_action.set_enabled (false);
- if (game.current_color != player_one && computer != null)
+ if (game.current_color != player_one && computer != null && !game.is_complete)
computer.move_async.begin (SLOW_MOVE_DELAY);
+ else if (game.is_complete)
+ game_complete (false);
}
private void show_game_board ()
@@ -477,7 +479,7 @@ public class Iagno : Gtk.Application
}
}
- private void game_complete ()
+ private void game_complete (bool play_gameover_sound = true)
{
if (game.n_light_tiles > game.n_dark_tiles)
{
@@ -495,7 +497,8 @@ public class Iagno : Gtk.Application
headerbar.set_subtitle (_("The game is draw."));
}
- play_sound ("gameover");
+ if (play_gameover_sound)
+ play_sound ("gameover");
}
private void play_sound (string name)
@@ -510,8 +513,8 @@ public class Iagno : Gtk.Application
private void player_move_cb (int x, int y)
{
- /* Ignore if we are waiting for the AI to move */
- if (game.current_color != player_one && computer != null)
+ /* Ignore if we are waiting for the AI to move or if game is finished */
+ if ((game.current_color != player_one && computer != null) || !game.current_player_can_move)
return;
if (game.place_tile (x, y) == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]