From 5fdb5f76f40a33a913cf2c02fdd67386e4c3552f Mon Sep 17 00:00:00 2001 From: eug-vs Date: Mon, 11 Apr 2022 14:03:51 +0300 Subject: feat: highlight available tile placements --- src/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 4f60ba1..170ffea 100644 --- a/src/main.c +++ b/src/main.c @@ -49,8 +49,15 @@ int main() { board_preview[i].feature = board[i].feature; board_preview[i].structure_group = board[i].structure_group; } - place_tile(tile, translate_coordinate(position), board_preview, 1); + /* highlight available placements */ + for (int k = 0; k < BOARD_WIDTH * BOARD_WIDTH; k++) { + if (is_allowed_placement(tile, translate_coordinate(k), board)) { + board_preview[translate_coordinate(k)].feature = PREVIEW_AVAILABLE; + } + } + + place_tile(tile, translate_coordinate(position), board_preview, 1); int is_allowed = is_allowed_placement(tile, translate_coordinate(position), board); if (is_allowed) wattron(board_win, COLOR_PAIR(2)); -- cgit v1.2.3