src/game.h

changeset 18
6008840b859e
parent 16
a298c6637c30
child 19
6a26114297a1
     1.1 --- a/src/game.h	Sat Mar 29 14:46:33 2014 +0100
     1.2 +++ b/src/game.h	Sat Mar 29 16:53:58 2014 +0100
     1.3 @@ -72,11 +72,25 @@
     1.4      uint8_t fromrow;
     1.5      uint8_t tofile;
     1.6      uint8_t torow;
     1.7 +    uint8_t promotion;
     1.8      _Bool check;
     1.9      _Bool checkmate;
    1.10      _Bool capture;
    1.11  } Move;
    1.12  
    1.13 +typedef struct MoveList MoveList;
    1.14 +typedef struct MoveListRoot MoveListRoot;
    1.15 +
    1.16 +struct MoveListRoot {
    1.17 +    MoveList* first;
    1.18 +    MoveList* last;
    1.19 +};
    1.20 +
    1.21 +struct MoveList {
    1.22 +    Move move;
    1.23 +    MoveList* next;
    1.24 +};
    1.25 +
    1.26  #define POS_UNSPECIFIED UINT8_MAX
    1.27  #define mdst(b,m) b[(m)->torow][(m)->tofile]
    1.28  #define msrc(b,m) b[(m)->fromrow][(m)->fromfile]
    1.29 @@ -89,6 +103,9 @@
    1.30  #define rowidx(row) (row-'1')
    1.31  #define fileidx(file) (file-'a')
    1.32  
    1.33 +#define rowchr(row) (row+'1')
    1.34 +#define filechr(file) (file+'a')
    1.35 +
    1.36  #define chkidx(move) (isidx((move)->fromfile) && isidx((move)->fromrow) && \
    1.37          isidx((move)->tofile) && isidx((move)->torow))
    1.38  
    1.39 @@ -98,6 +115,9 @@
    1.40  
    1.41  void game_start(Settings *settings, int opponent);
    1.42  
    1.43 +void freemovelist(MoveListRoot* list);
    1.44 +void addmove(MoveListRoot *movelist, Move *move);
    1.45 +
    1.46  #ifdef	__cplusplus
    1.47  }
    1.48  #endif

mercurial