aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-04-10 20:39:56 +0300
committereug-vs <eugene@eug-vs.xyz>2022-04-10 20:40:26 +0300
commit8c3124e919d9f8e7118fb05f4341c12e54b68c72 (patch)
tree782554380b312c6817d4a828016c2f090adae471
parent8d0a9cd5959ae5474fe0d3ed0a2e2f84731541b1 (diff)
downloadcarcassonne-engine-c-8c3124e919d9f8e7118fb05f4341c12e54b68c72.tar.gz
feat: support any-matching feature (*) in Tile
-rw-r--r--src/board.c5
-rw-r--r--src/main.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/board.c b/src/board.c
index a09b45c..92420ed 100644
--- a/src/board.c
+++ b/src/board.c
@@ -59,6 +59,11 @@ void traverse_structure(int group, int index, BoardUnit* board) {
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) {
+ board[new_unit].feature = board[index].feature;
+ traverse_structure(group, new_unit, board);
+ board[new_unit].feature = '*';
+ }
}
}
diff --git a/src/main.c b/src/main.c
index da5d3b5..a538675 100644
--- a/src/main.c
+++ b/src/main.c
@@ -50,7 +50,7 @@ int main() {
{ "RRRR", 'R', 0 },
{ "FCCC", 'C', 0 },
{ "FFFC", 'C', 0 },
- { "CCRR", 'C', 0 },
+ { "CCRR", '*', 0 },
{ "RFRF", 'R', 0 }
};