#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)
{
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,
- game_globals.garray[g].wIncrement);
+ //bstr[game_globals.garray[g].type],
+ game_globals.garray[g].variant,
+ game_globals.garray[g].wInitTime/600,
+ game_globals.garray[g].wIncrement/10);
pprintf(wp, "%s", outStr);
pprintf(bp, "%s", outStr);
free(outStr);
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);
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");
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");
}
/* 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)
{
} 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;
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;
}
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);