[gnome-chess] Catch more potential engine hangs



commit b72e2f56274acb3303e2f659a092b93d1f718771
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Aug 25 13:01:15 2013 -0500

    Catch more potential engine hangs
    
    If the engine thinks the game is over, but we don't, report an error.

 src/chess-engine-cecp.vala |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/chess-engine-cecp.vala b/src/chess-engine-cecp.vala
index ed399a8..55162bd 100644
--- a/src/chess-engine-cecp.vala
+++ b/src/chess-engine-cecp.vala
@@ -64,17 +64,18 @@ public class ChessEngineCECP : ChessEngine
                 }
             }
 
-            if (line.has_prefix ("Illegal move: "))
-            {
-                stop ();
-                error ();
-            }
-            else if (line == "resign" || line == "tellics resign" ||
+            if (line == "resign" || line == "tellics resign" ||
                      (line.has_prefix ("1-0 {") && line.contains("resign")) ||
                      (line.has_prefix ("0-1 {") && line.contains("resign")))
             {
                 resigned ();
             }
+            else if (line.has_prefix ("Illegal move: ") ||
+                     line.has_prefix ("1-0") || line.has_prefix ("0-1"))
+            {
+                stop ();
+                error ();
+            }
             else if (line == "game is a draw" ||
                      line == "draw" ||
                      line == "Draw" ||


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