X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gnushogi%2Fcommondsp.c;h=32785f5ce040bf42a8cd2ac79b6520bd73f05edc;hb=5ea6210573f345d63d7aafeb125726d3dc9b2238;hp=17a639abaacfa8e2639a01bd570b742eb318158e;hpb=829c253a7cc2d3e1a9ed643485c1b1a92967b5df;p=gnushogi.git diff --git a/gnushogi/commondsp.c b/gnushogi/commondsp.c index 17a639a..32785f5 100644 --- a/gnushogi/commondsp.c +++ b/gnushogi/commondsp.c @@ -6,6 +6,7 @@ * ---------------------------------------------------------------------- * Copyright (c) 1993, 1994, 1995 Matthias Mutz * Copyright (c) 1999 Michael Vanier and the Free Software Foundation + * Copyright (c) 2008, 2013, 2014 Yann Dirson and the Free Software Foundation * * GNU SHOGI is based on GNU CHESS * @@ -31,6 +32,10 @@ * */ +/* request *snprintf prototypes */ +#define _POSIX_C_SOURCE 200112L +#include + #if defined HAVE_GETTIMEOFDAY #include #endif @@ -372,17 +377,17 @@ parser(char *f, int side, short *fpiece) if (f[1] == '*' || f[1] == '\'') { - c2 = COL_NAME(f[2]); - r2 = ROW_NAME(f[3]); + c2 = COL_NUM(f[2]); + r2 = ROW_NUM(f[3]); return ((NO_SQUARES + *fpiece) << 8) | locn(r2, c2); } else { - c1 = COL_NAME(f[1]); - r1 = ROW_NAME(f[2]); - c2 = COL_NAME(f[3]); - r2 = ROW_NAME(f[4]); + c1 = COL_NUM(f[1]); + r1 = ROW_NUM(f[2]); + c2 = COL_NUM(f[3]); + r2 = ROW_NUM(f[4]); p = (f[5] == '+') ? 0x80 : 0; return (locn(r1, c1) << 8) | locn(r2, c2) | p; @@ -542,10 +547,12 @@ GetGame(void) skipb(); Captured[side][pawn] = atoi(InPtr); skip(); +#ifndef MINISHOGI Captured[side][lance] = atoi(InPtr); skip(); Captured[side][knight] = atoi(InPtr); skip(); +#endif Captured[side][silver] = atoi(InPtr); skip(); Captured[side][gold] = atoi(InPtr); @@ -710,16 +717,24 @@ SaveGame(void) } fputs(empty, fd); - fprintf(fd, " 9 8 7 6 5 4 3 2 1\n"); /* FIXME */ +#ifndef MINISHOGI + fprintf(fd, " 9 8 7 6 5 4 3 2 1\n"); fputs(empty, fd); fprintf(fd, " p l n s g b r k\n"); +#else + fprintf(fd, " 5 4 3 2 1\n"); + fputs(empty, fd); + fprintf(fd, " p s g b r k\n"); +#endif for (side = 0; side <= 1; side++) { fprintf(fd, "%c", (side == black) ? 'B' : 'W'); fprintf(fd, " %2d", Captured[side][pawn]); +#ifndef MINISHOGI fprintf(fd, " %2d", Captured[side][lance]); fprintf(fd, " %2d", Captured[side][knight]); +#endif fprintf(fd, " %2d", Captured[side][silver]); fprintf(fd, " %2d", Captured[side][gold]); fprintf(fd, " %2d", Captured[side][bishop]); @@ -871,10 +886,12 @@ GetXGame(void) InPtr = fname; Captured[side][pawn] = atoi(InPtr); skip(); +#ifndef MINISHOGI Captured[side][lance] = atoi(InPtr); skip(); Captured[side][knight] = atoi(InPtr); skip(); +#endif Captured[side][silver] = atoi(InPtr); skip(); Captured[side][gold] = atoi(InPtr); @@ -955,10 +972,17 @@ SaveXGame(void) for (side = 0; side <= 1; side++) { - sprintf(fname, "%d %d %d %d %d %d %d %d\n", + sprintf(fname, +#ifndef MINISHOGI + "%d %d %d %d %d %d %d %d\n", +#else + "%d %d %d %d %d %d\n", +#endif Captured[side][pawn], +#ifndef MINISHOGI Captured[side][lance], Captured[side][knight], +#endif Captured[side][silver], Captured[side][gold], Captured[side][bishop],