GNOME Bugzilla – Bug 705002
Loading completed games is broken
Last modified: 2014-12-28 17:08:38 UTC
GNOME Chess shouldn't allow continuing a game if a Result is specified in the PGN. Rather, the infobar should indicate the winner. The purpose of loading a completed game would be to go through the history.
Created attachment 257180 [details] Completed game This game is completed, but no indication of this is given. The white player can continue to move and undo, but black will never play. There's an error in the pgn parser: ** (glchess:3108): CRITICAL **: chess_game_remove_hold: assertion '_tmp0_ > 0' failed
(In reply to comment #1) > This game is completed, but no indication of this is given. The white player > can continue to move and undo, but black will never play. Answering my own complaint: 1) the AI will only play if indicated in the pgn; that's a GNOME extension and it's working as intended. 2) the game is not completed; the Black Queen can move.
*** Bug 742020 has been marked as a duplicate of this bug. ***
Oops! I missed this BUG. I'll take it up!
Created attachment 293399 [details] [review] Load completed saved games properly Fixes the game_start() function to take care when loading completed games: 1. Update game.result from pgn-result. 2. If loaded a completed game - Display winner and stop timer.
Review of attachment 293399 [details] [review]: Thanks. Just a few trivial comments: ::: src/gnome-chess.vala @@ -470,3 @@ var white_seconds = int.parse (pgn_game.white_time_left); var black_seconds = int.parse (pgn_game.black_time_left); - No need to remove this line. I guess this snuck in by accident. @@ +573,3 @@ game.start (); + + if (pgn_game.result != PGNGame.RESULT_IN_PROGRESS) The outer conditional here isn't doing anything and can be removed. @@ +615,3 @@ + if (game.result != ChessResult.IN_PROGRESS) + { + game.stop (game.result, game.rule); You accidentally indented five spaces here, instead of two.
Most importantly, this means I get to delete the PGN that's been sitting at the top of my home directory for over a year, as a reminder to fix this bug. :)
Created attachment 293400 [details] [review] Load completed saved games properly Thanks for the quick review Michael! Fixed your review comments. Note: I'll address the timer problem in BUG741966, which I intend to fix soon.
I missed removing the outer conditional, adding a patch with that shortly.
Created attachment 293401 [details] [review] Load completed saved games properly Fixed all review comments. PS: Whitespace convention for indentation in this file is 4.
Attachment 293401 [details] pushed as 4a3ccef - Load completed saved games properly