[gnome-chess] Fix promotion code
- From: Sahil Sareen <ssareen src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess] Fix promotion code
- Date: Sat, 21 Feb 2015 06:54:23 +0000 (UTC)
commit 17a7b87f8143df16973e99e2ba066742456eee73
Author: Sahil Sareen <sahil sareen hotmail com>
Date: Sat Feb 21 12:23:59 2015 +0530
Fix promotion code
Add a check for 'file' before trying to move.
https://bugzilla.gnome.org/show_bug.cgi?id=738947
src/chess-scene.vala | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/chess-scene.vala b/src/chess-scene.vala
index 47b7312..0e0a96d 100644
--- a/src/chess-scene.vala
+++ b/src/chess-scene.vala
@@ -239,7 +239,9 @@ public class ChessScene : Object
selected_file, rank, file, true, promotion_selection);
selected_rank = selected_file = -1;
}
- if (game.current_player.move_with_coords (selected_rank, selected_file, rank, file))
+ // Need to check selected_file here again for promotion case
+ if (selected_file != -1 &&
+ game.current_player.move_with_coords (selected_rank, selected_file, rank, file))
selected_rank = selected_file = -1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]