From 6c88febbe0cff8960bc6f2e0bcdfc89777a5f72b Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 10 Apr 2022 20:51:51 +0300 Subject: feat: support separator (+) feature --- src/board.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/board.c') diff --git a/src/board.c b/src/board.c index 92420ed..cc16e06 100644 --- a/src/board.c +++ b/src/board.c @@ -58,11 +58,10 @@ void traverse_structure(int group, int index, BoardUnit* board) { int new_unit = index + NEIGHBOR_INCREMENTS[i]; if (board[new_unit].feature == board[index].feature && board[new_unit].structure_group == 0) { traverse_structure(group, new_unit, board); - } - else if (board[new_unit].feature == '*' && board[new_unit].structure_group != board[index].structure_group) { + } else if (board[new_unit].feature == ANY && board[new_unit].structure_group != board[index].structure_group) { board[new_unit].feature = board[index].feature; traverse_structure(group, new_unit, board); - board[new_unit].feature = '*'; + board[new_unit].feature = ANY; } } } @@ -72,7 +71,12 @@ void refresh_structure_groups(BoardUnit* board) { int structure_group = 1; for (int i = 0; i < BOARD_UNITS; i++) { - if (board[i].structure_group == 0 && board[i].feature != EMPTY && board[i].feature != 'F') { + if ( + board[i].structure_group == 0 + && board[i].feature != EMPTY + && board[i].feature != SEPARATOR + && board[i].feature != 'F' + ) { traverse_structure(structure_group, i, board); structure_group += 1; } -- cgit v1.2.3