From 1a52152852ff29c727673fc80e8bf8eca5ed6365 Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Thu, 16 Jul 2026 14:08:24 +0530 Subject: starting pos, move count, test pass --- src/engine/moves/vec.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/engine/moves/vec.c') diff --git a/src/engine/moves/vec.c b/src/engine/moves/vec.c index b5cbb6f..6da3eb9 100644 --- a/src/engine/moves/vec.c +++ b/src/engine/moves/vec.c @@ -3,17 +3,18 @@ #include #include -moves_t moves_init() { - return moves_init_wcapacity(16); +void moves_init(moves_t *moves) { + return moves_init_wcapacity(moves, 16); } -moves_t moves_init_wcapacity(u32 capacity) { - move_t* moves = malloc(capacity * sizeof(*moves)); - return (moves_t) { - .moves = moves, - .capacity = capacity, - .length = 0, - }; +void moves_deinit(moves_t moves) { + free(moves.moves); +} + +void moves_init_wcapacity(moves_t *moves, u32 capacity) { + moves->moves = malloc(capacity * sizeof(*moves)); + moves->length = 0; + moves->capacity = capacity; } moves_t moves_empty() { -- cgit v1.2.3