Code:
if (Board[fromRow][fromCol]->Move(fromRow,fromCol,toRow,toCol)==TRUE){
Board[toRow][toCol]=CreatePiece(Board[fromRow][fromCol]->color,Board[fromRow][fromCol]->tool,Board[fromRow][fromCol]->Move,Board[fromRow][fromCol]->Print);
pi=Board[fromRow][fromCol];
free(pi);
this release the cell that the piece move from
the definition of the board is
the definition of piece is :
Code:
struct PieceType{
enum Color color;
enum Tool tool;
MovePiece Move;
PrintPiece Print;
};
typedef struct PieceType *Piece;
The first initialization of the board
Code:
void InitBoard(){
int i,j;
for (i=0;i<N;i++)
for (j=0;j<N;j++)
Board[i][j]=NULL;
}
You see any problem?