Fix extracting side-to-move from setboard command
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 27 Oct 2014 22:46:39 +0000 (23:46 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 27 Oct 2014 23:27:46 +0000 (00:27 +0100)
When white was to move, the stm was just keeping its previous value,
which could very well have been BLACK.

UCI2WB.c

index 3035c94..b92e975 100644 (file)
--- a/UCI2WB.c
+++ b/UCI2WB.c
@@ -369,7 +369,7 @@ GUI2Engine()
            Sync(PAUSE); // wait for uciok\r
        }\r
        else if(!strcmp(command, "setboard")) {\r
-               if(strstr(line+9, " b ")) stm = BLACK;\r
+               stm = (strstr(line+9, " b ") ? BLACK : WHITE);\r
                 if(p = strchr(line+9, '[')) { char c;\r
                     *p++ = 0; q = strchr(p, ']'); *q = 0; r = q + 4; \r
                    if(sc == 's') q[2] = 'w' + 'b' - q[2], strcpy(r=q+3, " 1\n"); // Shogi: reverse color\r