[gnome-chess] Saving a completed game due to timeup saves the timer as infinity
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess] Saving a completed game due to timeup saves the timer as infinity
- Date: Tue, 30 Dec 2014 17:14:32 +0000 (UTC)
commit 3c99d3de82857d065bf79deab3357af5574d6164
Author: Sahil Sareen <sahil sareen hotmail com>
Date: Tue Dec 30 22:19:28 2014 +0530
Saving a completed game due to timeup saves the timer as infinity
When loading the completed games-
1. show the pgn file name in header-subtitle.
2. due to timeout - Show timer time correctly.
https://bugzilla.gnome.org/show_bug.cgi?id=741966
lib/chess-game.vala | 1 +
src/gnome-chess.vala | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/lib/chess-game.vala b/lib/chess-game.vala
index d88b8b7..e579e17 100644
--- a/lib/chess-game.vala
+++ b/lib/chess-game.vala
@@ -20,6 +20,7 @@ public enum ChessResult
public enum ChessRule
{
+ UNKNOWN,
CHECKMATE,
STALEMATE,
FIFTY_MOVES,
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 5cadd3a..06f5fc6 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -470,7 +470,7 @@ public class ChessApplication : Gtk.Application
var white_seconds = int.parse (pgn_game.white_time_left);
var black_seconds = int.parse (pgn_game.black_time_left);
- if (white_seconds > 0 && black_seconds > 0)
+ if (white_seconds >= 0 && black_seconds >= 0)
game.clock = new ChessClock (white_seconds, black_seconds);
}
}
@@ -613,7 +613,7 @@ public class ChessApplication : Gtk.Application
// If loading a completed saved game
if (game.result != ChessResult.IN_PROGRESS)
- game.stop (game.result, game.rule);
+ game.stop (game.result, ChessRule.UNKNOWN);
}
private ChessEngine? get_engine (string name, string difficulty)
@@ -1297,6 +1297,12 @@ public class ChessApplication : Gtk.Application
reason = _("The computer player is confused. The game cannot continue.");
/* Don't set pgn_game termination; these are standards*/
break;
+ case ChessRule.UNKNOWN:
+ /* Window subtitle when we don't know the reason
+ * Set it to the pgn_file_name
+ * We are using this when loading completed saved games */
+ reason = game_file.get_basename ();
+ break;
}
headerbar.set_title (title);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]