aboutsummaryrefslogtreecommitdiff
path: root/src/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/board.c')
-rw-r--r--src/board.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/board.c b/src/board.c
index 263e205..056156c 100644
--- a/src/board.c
+++ b/src/board.c
@@ -48,6 +48,17 @@ int place_tile(Tile tile, int index, BoardUnit* board, int force) {
return 1;
}
+void rotate_tile(Tile* tile, int increment) {
+ char buffer[8];
+ for (int i = 0; i < 8; i++) {
+ buffer[i] = tile->edges[i % 4];
+ }
+
+ for (int i = 0; i < 4; i++) {
+ tile->edges[i] = buffer[i + (increment % 4)];
+ }
+}
+
void traverse_structure(int group, int index, BoardUnit* board) {
board[index].structure_group = group;
for (int i = 0; i < 4; i++) {