[iagno] Fix undo in two-players mode.
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Fix undo in two-players mode.
- Date: Sat, 16 Aug 2014 21:56:06 +0000 (UTC)
commit df86d6018fbaa4c7e5941a42ef7c84e0cbc99b5d
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sat Aug 16 23:35:01 2014 +0200
Fix undo in two-players mode.
https://bugzilla.gnome.org/show_bug.cgi?id=734866
Based on code by Michael Catanzaro.
src/iagno.vala | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/iagno.vala b/src/iagno.vala
index d2ca6fd..ed228ba 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -336,15 +336,24 @@ public class Iagno : Gtk.Application
{
cancel_pending_computer_moves ();
- /* Undo once if the human player just moved, otherwise undo both moves */
- if (game.current_color != player_one && computer != null)
+ if (computer == null)
+ {
game.undo (1);
+ if (!game.can_move (game.current_color))
+ game.undo (1);
+ }
else
- game.undo (2);
+ {
+ /* Undo once if the human player just moved, otherwise undo both moves */
+ if (game.current_color != player_one)
+ game.undo (1);
+ else
+ game.undo (2);
- /* If forced to pass, undo to last chosen move */
- while (!game.can_move (game.current_color))
- game.undo (2);
+ /* If forced to pass, undo to last chosen move so the computer doesn't play next */
+ while (!game.can_move (game.current_color))
+ game.undo (2);
+ }
game_move_cb ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]