version 1.4.39b
[polyglot.git] / xboard2uci.c
index 97c7b73..6dda5cf 100644 (file)
@@ -454,11 +454,17 @@ void xboard2uci_gui_step(char string[]) {
                 char *pg_name=Star[0];\r
                 polyglot_set_option(pg_name,value);\r
             }else{\r
-                start_protected_command();\r
-                if(!uci_send_option(Uci, name, "%s", value)){\r
+                option_t *opt=option_find(Uci->option,name);\r
+                if(opt){\r
+                    if(my_string_case_equal(opt->type,"check")){\r
+                       value=my_string_equal(value,"1")?"true":"false";\r
+                    }\r
+                    start_protected_command();\r
+                    uci_send_option(Uci, name, "%s", value);\r
+                    end_protected_command();\r
+                }else{\r
                     gui_send(GUI,"Error (unknown option): %s",name); \r
                 }\r
-                end_protected_command();\r
             }\r
         } else if (match(string,"option *")){\r
             char *name=Star[0];\r
@@ -740,6 +746,7 @@ void xboard2uci_engine_step(char string[]) {
                 gui_send(GUI,"1-0 {polyglot: resign"\r
                          " (illegal engine move black)}");\r
             }\r
+            board_disp(board);\r
             XB->result = TRUE;\r
             mess();\r
         }\r
@@ -851,6 +858,13 @@ static void send_xboard_options(){
     option_start_iter(Uci->option);\r
     while((opt=option_next(Uci->option))){\r
         if(my_string_case_equal(opt->name,"UCI_AnalyseMode")) continue;\r
+        if(my_string_case_equal(opt->name,"UCI_Opponent")) continue;\r
+        if(my_string_case_equal(opt->name,"UCI_Chess960")) continue;\r
+        if(my_string_case_equal(opt->name,"UCI_ShowCurrLine")) continue;\r
+        if(my_string_case_equal(opt->name,"UCI_ShowRefutations")) continue;\r
+        if(my_string_case_equal(opt->name,"UCI_ShredderbasesPath")) continue;\r
+        if(my_string_case_equal(opt->name,"UCI_SetPositionValue")) continue;\r
+        if(my_string_case_equal(opt->name,"UCI_DrawOffers")) continue;\r
         if(my_string_case_equal(opt->name,"Ponder")) continue;\r
         if(my_string_case_equal(opt->name,"Hash")) continue;\r
         if(my_string_case_equal(opt->name,"NalimovPath")) continue;\r
@@ -1190,11 +1204,17 @@ static void search_update() {
 \r
    if (State->state == THINK || State->state == PONDER || State->state == ANALYSE) {\r
 \r
+      // [VdB] moved up as we need the move number\r
+\r
+       game_get_board(Game,Uci->board);\r
+\r
       // opening book\r
 \r
-       if (State->state == THINK && option_get_bool(Option,"Book")) {\r
+       if (State->state == THINK &&\r
+           option_get_bool(Option,"Book") &&\r
+           Uci->board->move_nb<option_get_int(Option,"BookDepth")\r
+           ) {\r
 \r
-         game_get_board(Game,Uci->board);\r
 \r
          move = book_move(Uci->board,option_get_bool(Option,"BookRandom"));\r
 \r
@@ -1462,10 +1482,17 @@ static void send_board(int extra_move) {
 // send_info()\r
 \r
 static void send_info() {\r
-    if (XB->post) {\r
-        gui_send(GUI,"%d %+d %.0f "S64_FORMAT" %s",Uci->best_depth>0?Uci->best_depth:1,\r
+    int min_depth;\r
+    if(option_get_bool(Option,"WbWorkArounds2")){\r
+            // Silly bug in some versions of WinBoard.\r
+            // depth <=1 clears the engine output window.\r
+            // Why shouldn't an engine be allowed to send info at depth 1?\r
+        min_depth=2;\r
+    }else{\r
+        min_depth=1;\r
+    }\r
+    gui_send(GUI,"%d %+d %.0f "S64_FORMAT" %s",Uci->best_depth>min_depth?Uci->best_depth:min_depth,\r
                  0,0,0.0,0,Uci->info);  \r
-    }  \r
 }\r
 \r
 // send_pv()\r