[gnome-games] glchess: fix phalanx/gnuchess output interpretation. Bug 675434



commit d59d8a2502ff78a2ad4040d96f3c4dbe7c995cb0
Author: Dominique Leuenberger <dimstar opensuse org>
Date:   Fri May 18 22:15:39 2012 +0200

    glchess: fix phalanx/gnuchess output interpretation. Bug 675434

 glchess/src/chess-engine-cecp.vala |    4 ++--
 glchess/src/chess-game.vala        |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/glchess/src/chess-engine-cecp.vala b/glchess/src/chess-engine-cecp.vala
index cb40419..4a7aff5 100644
--- a/glchess/src/chess-engine-cecp.vala
+++ b/glchess/src/chess-engine-cecp.vala
@@ -40,7 +40,7 @@ public class ChessEngineCECP : ChessEngine
 
             debug ("Read from engine: '%s'", line);
 
-            string[] move_prefixes = { "My move is: ", "my move is ", "move " };
+            string[] move_prefixes = { "My move is: ", "My move is : ", "my move is ", "move " };
             foreach (string prefix in move_prefixes)
             {
                 if (line.has_prefix (prefix))
@@ -48,7 +48,7 @@ public class ChessEngineCECP : ChessEngine
                     string move = line[prefix.length:line.length];
                     debug ("Engine moves %s", move);
                     moving = true;
-                    moved (move);
+                    moved (move.strip());
                 }
             }
 
diff --git a/glchess/src/chess-game.vala b/glchess/src/chess-game.vala
index 3c5ebce..ecd8b83 100644
--- a/glchess/src/chess-game.vala
+++ b/glchess/src/chess-game.vala
@@ -1027,7 +1027,7 @@ public class ChessState
                 r1 = (int) (move[i] - '1');
                 i++;
             }
-            if (move[i] == 'x')
+            if (move[i] == 'x' || move[i] == '-')
                 i++;
             if (move[i] >= 'a' && move[i] <= 'h')
             {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]