X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gnushogi%2Fcursesdsp.c;h=a93f12c85dd41314a5fb5ba196acc60f3d55c4e3;hb=7150b643882508bc73f81655afe0e4d17b6f27e2;hp=213c0083d79c43c70562b69af8c716dbecc0f39a;hpb=97a3bafdbb2b8f5c48c78b4aabfaaf2b9c329934;p=gnushogi.git diff --git a/gnushogi/cursesdsp.c b/gnushogi/cursesdsp.c index 213c008..a93f12c 100644 --- a/gnushogi/cursesdsp.c +++ b/gnushogi/cursesdsp.c @@ -64,6 +64,7 @@ int mycnt1, mycnt2; +#define MARGIN (4) #define TAB (58) #define VIR_C(s) ((flag.reverse) ? (NO_COLS - 1 - column(s)) : column(s)) @@ -480,7 +481,7 @@ Curses_EditBoard(void) { gotoXY(TAB, 6); printw("Editing: %s", ColorStr[a]); - gotoXY(TAB + 24, 7); + gotoXY(TAB + 2, 8); ClearEoln(); FLUSH_SCANW("%s", s); found = 0; @@ -499,10 +500,13 @@ Curses_EditBoard(void) ClearCaptured(); UpdateCatched(); + continue; } - if (s[0] == 'c') + if (s[0] == 'c') { a = otherside[a]; + continue; + } if (s[1] == '*') { @@ -517,40 +521,38 @@ Curses_EditBoard(void) } } - c = -1; - } - else - { - c = COL_NUM(s[1]); - r = ROW_NUM(s[2]); + continue; } - if ((c >= 0) && (c < NO_COLS) && (r >= 0) && (r < NO_ROWS)) + c = COL_NUM(s[1]); + r = ROW_NUM(s[2]); + + 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--) { - 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])) - { - if (s[3] == '+') - board[sq] = promoted[i]; - else - board[sq] = unpromoted[i]; + if (s[3] == '+') + board[sq] = promoted[i]; + else + board[sq] = unpromoted[i]; - found = 1; - break; - } + found = 1; + break; } - + } - if (found == 0) - color[sq] = neutral; - DrawPiece(sq); - } + if (found == 0) + color[sq] = neutral; + + DrawPiece(sq); } for (sq = 0; sq < NO_SQUARES; sq++) @@ -722,9 +724,9 @@ Curses_UpdateClocks(void) s = 0; if (player == black) - gotoXY(20, (flag.reverse) ? 2 : 23); + gotoXY(20, (flag.reverse) ? 2 : (5 + 2*NO_ROWS)); else - gotoXY(20, (flag.reverse) ? 23 : 2); + gotoXY(20, (flag.reverse) ? (5 + 2*NO_ROWS) : 2); /* printw("%d:%02d %ld ", m, s, dt); */ printw("%d:%02d ", m, s); @@ -769,7 +771,7 @@ DrawPiece(short sq) y = pxx[(int)piece]; } - gotoXY(8 + 5 * VIR_C(sq), 4 + 2 * ((NO_ROWS - 1) - VIR_R(sq))); + gotoXY(MARGIN + 3 + 5 * VIR_C(sq), 4 + 2 * ((NO_ROWS - 1) - VIR_R(sq))); printw("%c%c%c%c", l, p, y, r); } @@ -834,42 +836,41 @@ Curses_UpdateDisplay(short f, short t, short redraw, short isspec) ShowPlayers(); i = 2; - gotoXY(3, ++i); + gotoXY(MARGIN, ++i); - printw(" +"); + printw(" +"); for (j=0; j