Fix CECP error message for illegal moves
authorFabian Fichter <ianfab@users.noreply.github.com>
Wed, 28 Oct 2020 17:20:58 +0000 (18:20 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Wed, 28 Oct 2020 17:20:58 +0000 (18:20 +0100)
Closes #203.

src/xboard.cpp

index 495b91a..a62d709 100644 (file)
@@ -375,8 +375,12 @@ void StateMachine::process_command(Position& pos, std::string token, std::istrin
   else
   {
       // process move string
+      bool isMove = false;
       if (token == "usermove")
+      {
           is >> token;
+          isMove = true;
+      }
       if (Options["UCI_AnalyseMode"])
       {
           Threads.stop = true;
@@ -386,7 +390,7 @@ void StateMachine::process_command(Position& pos, std::string token, std::istrin
       if ((m = UCI::to_move(pos, token)) != MOVE_NONE)
           do_move(pos, moveList, states, m);
       else
-          sync_cout << "Error (unknown command): " << token << sync_endl;
+          sync_cout << (isMove ? "Illegal move: " : "Error (unknown command): ") << token << sync_endl;
       if (Options["UCI_AnalyseMode"])
           go(pos, analysisLimits, states);
       else if (pos.side_to_move() == playColor)