if (m)\r
/* doesn't have move syntax */\r
printf("Error (unknown command): %s\n", command);\r
- else if(D(Side,-I,I,Q,O,LL|S,3)!=I) {\r
+ else { int i=K;\r
+ if(b[L] && (b[L]&16) == Side && w[b[L]&15] < 0) // capture own King: castling\r
+ { K = L; L = i>L ? i-1 : i+2; }\r
+ if(D(Side,-I,I,Q,O,LL|S,3)!=I) {\r
/* did have move syntax, but illegal move */\r
printf("Illegal move:%s\n", line);\r
- } else { /* legal move, perform it */\r
+ } else { /* legal move, perform it */\r
GameHistory[GamePtr++] = PACK_MOVE;\r
Side ^= BLACK^WHITE;\r
CopyBoard(HistPtr=HistPtr+1&1023);\r
if(PrintResult(Side)) Computer = EMPTY;\r
+ }\r
}\r
}\r
}\r