X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=uci2uci.c;h=c9341bb5dd8e149a5378b2cec57ab5f716e8ec7b;hb=60900035e6d0309705f2326ee50edc52386305e9;hp=1c13d0f6905ce2210e2569207c08557679527881;hpb=a0f731f21d6aa26dbf7246039a1c66c2ade0533f;p=polyglot.git diff --git a/uci2uci.c b/uci2uci.c index 1c13d0f..c9341bb 100644 --- a/uci2uci.c +++ b/uci2uci.c @@ -33,6 +33,26 @@ static int SavedMove=MoveNone; static void send_uci_options(); + +// normalize_type() + +static void normalize_type(char *dst, const char* src){ + if(option_get_int(Option,"UCIVersion") <=2){ + if(IS_STRING(src)){ + strcpy(dst,"string"); + return; + }else if(IS_SPIN(src)){ + strcpy(dst,"spin"); + }else if(IS_BUTTON(src)){ + strcpy(dst,"button"); + }else{ + strcpy(dst,src); + } + }else{ + strcpy(dst,src); + } +} + // parse_position() static void parse_position(const char string[]) { @@ -119,6 +139,7 @@ static void send_book_move(int move){ static void format_uci_option_line(char * option_line,option_t *opt){ char option_string[StringSize]; + char type[StringSize]; int j; strcpy(option_line,""); // buffer overflow alert @@ -128,17 +149,18 @@ static void format_uci_option_line(char * option_line,option_t *opt){ } sprintf(option_string," %s",opt->name); strcat(option_line,option_string); - sprintf(option_string," type %s",opt->type); + normalize_type(type,opt->type); + sprintf(option_string," type %s",type); strcat(option_line,option_string); - if(strcmp(opt->type,"button")){ - sprintf(option_string," default %s",opt->default_); + if(!IS_BUTTON(opt->type)){ + sprintf(option_string," default %s",opt->value); strcat(option_line,option_string); } - if(!strcmp(opt->type,"spin")){ + if(IS_SPIN(opt->type)){ sprintf(option_string," min %s",opt->min); strcat(option_line,option_string); } - if(!strcmp(opt->type,"spin")){ + if(IS_SPIN(opt->type)){ sprintf(option_string," max %s",opt->max); strcat(option_line,option_string); }