version 1.4.36b
[polyglot.git] / xboard2uci.c
index 97c7b73..d026096 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
@@ -1462,10 +1469,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