X-Git-Url: http://winboard.nl/cgi-bin?p=capablanca.git;a=blobdiff_plain;f=lasker-2.2.3%2Fsrc%2Fmatchproc.c;h=6c2ecf5170fe81db98b19676e40ab95e938ac7db;hp=35f19371504558866616fc06f944ac3fc53c3dd2;hb=76a192175f31fcb85ba99e354916dd78b9e5850e;hpb=76f1e81b3426b94e1d80c9daa309f78045e5335b diff --git a/lasker-2.2.3/src/matchproc.c b/lasker-2.2.3/src/matchproc.c index 35f1937..6c2ecf5 100644 --- a/lasker-2.2.3/src/matchproc.c +++ b/lasker-2.2.3/src/matchproc.c @@ -23,7 +23,7 @@ #include "includes.h" const char *colorstr[] = {"", "[black] ", "[white] "}; -static const char *adjustr[] = {"", " (adjourned)"}; +const char *adjustr[] = {"", " (adjourned)"}; static void prepare_match(int g,int wt,int bt,int winc,int binc,int wp, int bp,int rated) { @@ -156,8 +156,9 @@ static void output_match_messages(int wp,int bp,int g, char* mess) player_globals.parray[bp].name, game_globals.garray[g].black_rating, rstr[game_globals.garray[g].rated], - bstr[game_globals.garray[g].type], - game_globals.garray[g].wInitTime, + //bstr[game_globals.garray[g].type], + game_globals.garray[g].variant, + game_globals.garray[g].wInitTime/600, game_globals.garray[g].wIncrement); pprintf(wp, "%s", outStr); pprintf(bp, "%s", outStr); @@ -168,7 +169,8 @@ static void output_match_messages(int wp,int bp,int g, char* mess) player_globals.parray[bp].name, mess, rstr[game_globals.garray[g].rated], - bstr[game_globals.garray[g].type]); + //bstr[game_globals.garray[g].type]); + game_globals.garray[g].variant); pprintf(wp, "%s", outStr); pprintf(bp, "%s", outStr); @@ -265,6 +267,7 @@ int create_new_match(int g, int white_player, int black_player, decline_withdraw_offers(white_player, -1, PEND_SIMUL, DO_WITHDRAW | DO_DECLINE); } + game_globals.garray[g].FENstartPos[0] = 0; // [HGM] new shuffle if (board_init(g,&game_globals.garray[g].game_state, category, board)) { pprintf(white_player, "PROBLEM LOADING BOARD. Game Aborted.\n"); pprintf(black_player, "PROBLEM LOADING BOARD. Game Aborted.\n"); @@ -279,6 +282,15 @@ int create_new_match(int g, int white_player, int black_player, else game_globals.garray[g].type = game_isblitz(wt, winc, bt, binc, category, board); + if(category && category[0]) { // [HGM] set variant string from directory for games loaded from file + if(!strcmp(category, "wild") && board) + sprintf(game_globals.garray[g].variant, "%s/%s", category, board); + else + strcpy(game_globals.garray[g].variant, category); + } + else + strcpy(game_globals.garray[g].variant, bstr[game_globals.garray[g].type]); + prepare_match(g,wt,bt,winc,binc,white_player,black_player,rated); output_match_messages(white_player,black_player,g, "Creating"); @@ -430,7 +442,7 @@ int accept_match(struct pending *pend, int p, int p1) } /* board and category are initially empty strings */ -static int parse_match_string(int p, int* wt,int* bt,int* winc,int* binc, +int parse_match_string(int p, int* wt,int* bt,int* winc,int* binc, int* white,int* rated,char* category, char* board, char* mstring) { @@ -490,10 +502,53 @@ static int parse_match_string(int p, int* wt,int* bt,int* winc,int* binc, } else { strcpy(category,parsebuf); if (!strncmp("bughouse",category, strlen(category)) - && strlen(category) >= 3) { + && strlen(category) >= 3 || !strcmp("bh", category)) { strcpy(category, "bughouse"); bughouse = 1; } + // [HGM] allow some shortcuts for variant names + if(!strcmp("bh", category)) { + strcpy(category, "bughouse"); + } else + if(!strcmp("zh", category)) { + strcpy(category, "crazyhouse"); + } else + if(!strcmp("fr", category)) { + strcpy(category, "fischerandom"); + } else + if(!strcmp("sj", category)) { + strcpy(category, "shatranj"); + } else + if(!strcmp("gc", category)) { + strcpy(category, "gothic"); + } else + if(!strcmp("ca", category)) { + strcpy(category, "capablanca"); + } else + if(!strcmp("cr", category)) { + strcpy(category, "caparandom"); + } else + if(!strcmp("su", category)) { + strcpy(category, "super"); + } else + if(!strcmp("sc", category)) { + strcpy(category, "seirawan"); + } else + if(!strcmp("sg", category)) { + strcpy(category, "shogi"); + } else + if(!strcmp("km", category)) { + strcpy(category, "knightmate"); + } else + if(!strcmp("gr", category)) { + strcpy(category, "great"); + } else + if(!strcmp("sp", category)) { + strcpy(category, "spartan"); + } else + if(!strcmp("xq", category)) { + strcpy(category, "xiangqi"); + } } } else confused = 1; @@ -503,6 +558,8 @@ static int parse_match_string(int p, int* wt,int* bt,int* winc,int* binc, pprintf(p, "Can't interpret %s in match command.\n", parsebuf); return 0; } + if(category && (!board || !board[0])) + strcpy(board, "0"); // [HGM] variants: always provide default board return 1; } @@ -636,12 +693,17 @@ int com_match(int p, param_list param) g = game_new(); adjourned = (game_read(g, p, p1) >= 0) || (game_read(g, p1, p) >= 0); if (adjourned) { + char *q; type = game_globals.garray[g].type; wt = game_globals.garray[g].wInitTime / 600; bt = game_globals.garray[g].bInitTime / 600; winc = game_globals.garray[g].wIncrement / 10; binc = game_globals.garray[g].bIncrement / 10; rated = game_globals.garray[g].rated; + strcpy(category, game_globals.garray[g].variant); + if(q = strchr(category, '/')) { + *q = 0; strcpy(board, q+1); + } else strcpy(board, "0"); } game_remove(g);