void\r
GUI2Engine()\r
{\r
- char line[256], command[256], *p, *q;\r
+ char line[256], command[256], *p, *q, *r;\r
\r
while(1) {\r
int i, x;\r
}\r
else if(!strcmp(command, "setboard")) {\r
if(strstr(line+9, " b ")) stm = BLACK;\r
- if(sc == 's' && (p = strchr(line+9, '['))) { char c;\r
- *p++ = ' '; q = strchr(p, ']'); c = 'w' + 'b' - q[2]; strcpy(q+2, " 1\n"); while(*--q != ' ') q[2] = *q; *p = c; p[1] = ' '; \r
- }\r
- sprintf(iniPos, "%s%sfen %s", iniPos[0]=='p' ? "position " : "", sc=='s' ? "s" : "", line+9);\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
+ else r = strchr(strchr(q+4, ' ') + 1, ' '); // skip to second space (after e.p. square)\r
+ *r = 0; sprintf(command, "%s%s %s %s", line+9, q+1, p, r+1);\r
+ } else strcpy(command, line+9);\r
+ sprintf(iniPos, "%s%sfen %s", iniPos[0]=='p' ? "position " : "", sc=='s' ? "s" : "", command);\r
iniPos[strlen(iniPos)-1] = 0;\r
}\r
else if(!strcmp(command, "variant")) {\r