aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index 70aaec7..fff4b78 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,12 +46,14 @@ int main() {
char structures[BOARD_BYTES];
initialize_board(board);
- place_tile("RFRCR", translate_coordinate(24), board, 1);
+
+ Tile tile = { "FRCR", 'R' };
+ place_tile(tile, translate_coordinate(24), board, 1);
/* main loop */
- char tile[5];
char position[3];
while (1) {
+
/* prepare */
initialize_board(structures);
create_structure_mask(board, structures);
@@ -67,9 +69,9 @@ int main() {
box(input_box, 0, 0);
mvwaddstr(input_box, 0, 0, "Enter tile:");
wrefresh(input_box);
- wgetstr(input_win, tile);
+ wgetstr(input_win, tile.edges);
wclear(input_win);
- if (tile[0] == 'q') break;
+ if (tile.edges[0] == 'q') break;
box(input_box, 0, 0);
mvwaddstr(input_box, 0, 0, "Enter position:");
@@ -77,8 +79,8 @@ int main() {
wgetstr(input_win, position);
int result = place_tile(tile, translate_coordinate(atoi(position)), board, 0);
- if (result) wprintw(messages_win, "Placed tile %s at position %i\n", tile, atoi(position));
- else wprintw(messages_win, "Could not place tile %s at position %i\n", tile, atoi(position));
+ if (result) wprintw(messages_win, "Placed tile %s (%c) at position %i\n", tile.edges, tile.center, atoi(position));
+ else wprintw(messages_win, "Could not place tile %s (%c) at position %i\n", tile.edges, tile.center, atoi(position));
wrefresh(messages_win);
}