[gnome-games] chess: Decode promotion type from UCI engines
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] chess: Decode promotion type from UCI engines
- Date: Tue, 25 Jan 2011 12:10:36 +0000 (UTC)
commit 165237af651fa6265b506f79b0c7fc1d4211f108
Author: Robert Ancell <robert ancell canonical com>
Date: Tue Jan 25 21:47:50 2011 +1000
chess: Decode promotion type from UCI engines
glchess/src/chess-game.vala | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/glchess/src/chess-game.vala b/glchess/src/chess-game.vala
index 44ab141..02e2e34 100644
--- a/glchess/src/chess-game.vala
+++ b/glchess/src/chess-game.vala
@@ -1037,6 +1037,28 @@ public class ChessState
if (decode_piece_type (move[i], out promotion_type))
i++;
}
+ else if (move[i] != '\0')
+ {
+ switch (move[i])
+ {
+ case 'q':
+ promotion_type = PieceType.QUEEN;
+ i++;
+ break;
+ case 'k':
+ promotion_type = PieceType.KING;
+ i++;
+ break;
+ case 'r':
+ promotion_type = PieceType.ROOK;
+ i++;
+ break;
+ case 'b':
+ promotion_type = PieceType.BISHOP;
+ i++;
+ break;
+ }
+ }
/* Don't have a destination to move to */
if (r1 < 0 || f1 < 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]