src/game.c

changeset 35
6c64b7a073af
parent 34
c4d4b8a8f902
child 37
bcf624518909
     1.1 --- a/src/game.c	Wed Apr 09 12:07:47 2014 +0200
     1.2 +++ b/src/game.c	Wed Apr 09 18:11:51 2014 +0200
     1.3 @@ -30,6 +30,7 @@
     1.4  #include "game.h"
     1.5  #include "network.h"
     1.6  #include "input.h"
     1.7 +#include "colors.h"
     1.8  #include <ncurses.h>
     1.9  #include <string.h>
    1.10  #include <inttypes.h>
    1.11 @@ -80,8 +81,13 @@
    1.12                  piecec = ' ';
    1.13              }
    1.14              
    1.15 -            attrset((col == WHITE ? A_BOLD : A_DIM) |
    1.16 -                COLOR_PAIR((y&1)==(x&1) ? COL_WB : COL_BW));
    1.17 +            _Bool boardblack = (y&1)==(x&1);
    1.18 +            attrset((col==WHITE ? A_BOLD : A_DIM)|
    1.19 +                COLOR_PAIR(col == WHITE ?
    1.20 +                    (boardblack ? COL_WB : COL_WW) :
    1.21 +                    (boardblack ? COL_BB : COL_BW)
    1.22 +                )
    1.23 +            );
    1.24              
    1.25              int cy = gamestate->mycolor == WHITE ? boardy-y : boardy-7+y;
    1.26              int cx = gamestate->mycolor == WHITE ? boardx+x*3 : boardx+21-x*3;
    1.27 @@ -433,6 +439,8 @@
    1.28      mvaddstr(getmaxy(stdscr)-1, 0,
    1.29          "Game has ended. Press any key to leave...");
    1.30      refresh();
    1.31 +    cbreak();
    1.32 +    flushinp();
    1.33      getch();
    1.34  }
    1.35  

mercurial