summaryrefslogtreecommitdiff
path: root/lib/piece.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/piece.c')
-rw-r--r--lib/piece.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/piece.c b/lib/piece.c
index bbe0bdc..091d0a5 100644
--- a/lib/piece.c
+++ b/lib/piece.c
@@ -1,4 +1,6 @@
#include <ctype.h>
+#include <stdlib.h>
+
#include "piece.h"
#ifdef UTF8
@@ -51,3 +53,10 @@ int piece_character(Piece p) {
}
#endif
+
+Piece* new_piece(Color c, PieceType t) {
+ Piece* p = malloc(sizeof(Piece));
+ p->color = c; p->type = t;
+
+ return p;
+}
nihil fit ex nihilo