X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=uci2uci.c;h=c9341bb5dd8e149a5378b2cec57ab5f716e8ec7b;hb=60900035e6d0309705f2326ee50edc52386305e9;hp=f7cb63ee22415d38b5e679a64e659e6e5245df02;hpb=ac968003c13bde5c86ffa19f8819e436b5bc03e6;p=polyglot.git diff --git a/uci2uci.c b/uci2uci.c index f7cb63e..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(!IS_BUTTON(opt)){ - 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(IS_SPIN(opt)){ + if(IS_SPIN(opt->type)){ sprintf(option_string," min %s",opt->min); strcat(option_line,option_string); } - if(IS_SPIN(opt)){ + if(IS_SPIN(opt->type)){ sprintf(option_string," max %s",opt->max); strcat(option_line,option_string); }