structures forward declarations

This commit is contained in:
2021-11-04 13:06:24 +01:00
parent ad155b5a60
commit c7faa88bfa
6 changed files with 22 additions and 13 deletions

View File

@@ -1,10 +1,10 @@
./obj/debug.o:: src/debug.c src/debug.h
./obj/fen.o:: src/fen.c src/debug.h src/chessdefs.h src/position.h src/board.h \
src/list.h src/fen.h src/piece.h src/pool.h
./obj/move.o:: src/move.c src/chessdefs.h src/piece.h src/board.h src/list.h \
src/position.h src/pool.h src/move.h
./obj/piece.o:: src/piece.c src/chessdefs.h src/piece.h src/board.h src/list.h \
src/position.h src/pool.h src/debug.h
src/piece.h src/list.h src/pool.h src/fen.h
./obj/move.o:: src/move.c src/chessdefs.h src/piece.h src/board.h src/position.h \
src/list.h src/pool.h src/move.h
./obj/piece.o:: src/piece.c src/chessdefs.h src/piece.h src/board.h \
src/position.h src/list.h src/pool.h src/debug.h
./obj/pool.o:: src/pool.c src/list.h src/pool.h src/debug.h
./obj/position.o:: src/position.c src/chessdefs.h src/position.h src/board.h \
src/list.h src/fen.h src/piece.h src/pool.h
src/piece.h src/list.h src/pool.h src/fen.h

View File

@@ -16,10 +16,12 @@
#include <stdint.h>
#include "chessdefs.h"
#include "piece.h"
#include "position.h"
typedef struct {
typedef struct board_s {
piece_t piece;
//piece_t *s_piece;
piece_list_t *s_piece;
} board_t; /* 0x88 board */
#define BOARDSIZE (8*8*2)
@@ -51,4 +53,4 @@ typedef struct {
#define FILE2C(f) ((f) + 'a')
#define RANK2C(r) ((r) + '1')
#endif
#endif /* BOARD_H */

View File

@@ -73,4 +73,10 @@ typedef unsigned char castle_t;
*/
typedef int64_t eval_t;
/* forward typedefs
*/
typedef struct piece_list_s piece_list_t;
typedef struct board_s board_t;
typedef struct pos_s pos_t;
#endif

View File

@@ -84,7 +84,7 @@ pos_t *fen2pos(pos_t *pos, char *fen)
# endif
piece |= color;
board[SQ88(file, rank)].piece = piece;
piece_add(pos, piece, SQUARE(file, rank));
board[SQ88(file, rank)].s_piece = piece_add(pos, piece, SQUARE(file, rank));
file++;
break;
case '/':

View File

@@ -14,12 +14,13 @@
#ifndef PIECE_H
#define PIECE_H
#include <ctype.h>
#include "chessdefs.h"
#include "board.h"
#include "list.h"
#include "position.h"
#include "pool.h"
#include "ctype.h"
#define PIECE_DEFAULT_VALUE 0
@@ -31,7 +32,7 @@
#define QUEEN_VALUE 900
#define KING_VALUE 20000
typedef struct {
typedef struct piece_list_s {
piece_t piece;
square_t square;
short castle;

View File

@@ -19,7 +19,7 @@
#include "board.h"
#include "list.h"
typedef struct position {
typedef struct pos_s {
piece_t turn; /* we use only color bit */
castle_t castle;
square_t en_passant;