aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 170ffea..3454c61 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,16 +17,19 @@ int main() {
WINDOW* messages_win = create_framed_window("Log", BOARD_ROW_UNITS + 2, 80, 0, BOARD_ROW_UNITS + 3);
scrollok(messages_win, 1);
+ Tile tileset[69];
BoardUnit board[BOARD_UNITS];
int available_meeples[PLAYERS];
int meeple_map[MAX_STRUCTURES * PLAYERS];
Tile tile;
+ initialize_tileset(tileset);
initialize_board(board);
initialize_available_meeples(available_meeples);
place_tile((Tile){ "FRCR", 'R', 0 }, translate_coordinate(BOARD_WIDTH * BOARD_WIDTH / 2), board, 1);
/* main loop */
+ int tile_index;
char input_key;
for (int move = 0; ; move++) {
int player = (move % PLAYERS) + 1;
@@ -40,7 +43,11 @@ int main() {
wrefresh(messages_win);
/* tile placement */
- tile = TILESET[rand() % 19];
+ while (1) {
+ tile_index = rand() % 69;
+ tile = tileset[tile_index];
+ if (tile.center != USED) break;
+ }
int position = 0;
BoardUnit board_preview[BOARD_UNITS];
@@ -102,6 +109,7 @@ int main() {
} else wprintw(messages_win, "Could not place meeple at %c\n", board[meeple_index].feature);
}
+ tileset[tile_index].center = USED;
wrefresh(messages_win);
}