* ----------------------------------------------------------------------
* 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
*
* ----------------------------------------------------------------------
*/
+/* request *snprintf prototypes*/
+#define _POSIX_C_SOURCE 200112L
#include <ctype.h>
#include <signal.h>
ShowHeader(void)
{
gotoXY(TAB, 2);
- printw("GNU Shogi %s (pl %s)", version, patchlevel);
+ printw("GNU Shogi %s", PACKAGE_VERSION);
}
Curses_help(void)
{
Curses_ClearScreen();
- printw("GNU Shogi %sp%s command summary\n", version, patchlevel);
+ printw("GNU Shogi %s command summary\n", PACKAGE_VERSION);
printw("-------------------------------"
"---------------------------------\n");
printw("7g7f move from 7g to 7f quit Exit Shogi\n");
void
Curses_EditBoard(void)
{
- short a, c, sq, i;
+ short a, c, sq, i, found;
short r = 0;
char s[80];
printw("Enter piece & location: ");
a = black;
- do
+ while(1)
{
gotoXY(TAB, 6);
printw("Editing: %s", ColorStr[a]);
gotoXY(TAB + 24, 7);
ClearEoln();
FLUSH_SCANW("%s", s);
+ found = 0;
+
+ if (s[0] == '.')
+ break;
if (s[0] == '#')
{
ClearCaptured();
UpdateCatched();
+ continue;
}
- if (s[0] == 'c')
+ if (s[0] == 'c') {
a = otherside[a];
+ continue;
+ }
if (s[1] == '*')
{
for (i = NO_PIECES; i > no_piece; i--)
{
if ((s[0] == pxx[i]) || (s[0] == qxx[i]))
+ {
+ Captured[a][unpromoted[i]]++;
+ UpdateCatched();
+ found = 1;
break;
+ }
}
- Captured[a][unpromoted[i]]++;
- UpdateCatched();
- c = -1;
- }
- else
- {
- c = COL_NAME(s[1]);
- r = ROW_NAME(s[2]);
+ continue;
}
- if ((c >= 0) && (c < NO_COLS) && (r >= 0) && (r < NO_ROWS))
- {
- sq = locn(r, c);
+ c = COL_NUM(s[1]);
+ r = ROW_NUM(s[2]);
- for (i = NO_PIECES; i > no_piece; i--)
+ if ((c < 0) || (c >= NO_COLS) || (r < 0) || (r >= NO_ROWS))
+ continue;
+
+ sq = locn(r, c);
+ color[sq] = a;
+ board[sq] = no_piece;
+
+ for (i = NO_PIECES; i > no_piece; i--)
+ {
+ if ((s[0] == pxx[i]) || (s[0] == qxx[i]))
{
- if ((s[0] == pxx[i]) || (s[0] == qxx[i]))
- break;
+ if (s[3] == '+')
+ board[sq] = promoted[i];
+ else
+ board[sq] = unpromoted[i];
+
+ found = 1;
+ break;
}
+ }
- if (s[3] == '+')
- i = promoted[i];
- else
- i = unpromoted[i];
- board[sq] = i;
- color[sq] = ((board[sq] == no_piece) ? neutral : a);
- DrawPiece(sq);
- }
+ if (found == 0)
+ color[sq] = neutral;
+
+ DrawPiece(sq);
}
- while (s[0] != '.');
for (sq = 0; sq < NO_SQUARES; sq++)
Mvboard[sq] = ((board[sq] != Stboard[sq]) ? 10 : 0);
gotoXY(3, 4 + 2*NO_ROWS);
printw(" ");
+#ifndef MINISHOGI
if (flag.reverse)
printw(" 1 2 3 4 5 6 7 8 9");
else
printw(" 9 8 7 6 5 4 3 2 1");
+#else
+ if (flag.reverse)
+ printw(" 1 2 3 4 5");
+ else
+ printw(" 1 2 3 4 5");
+#endif
for (sq = 0; sq < NO_SQUARES; sq++)
DrawPiece(sq);
Curses_ClearScreen();
gotoXY(32, 2);
- printw("GNU Shogi %sp%s", version, patchlevel);
+ printw("GNU Shogi %s", PACKAGE_VERSION);
gotoXY(20, 4);
printw(" 1. 40 moves in 5 minutes");
gotoXY(20, 5);