From c5418464d57de2b71a91ddfbb4c42df25a743da9 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 31 Mar 2022 21:16:42 +0300 Subject: fix: cap max amount of input characters --- src/board.h | 1 + src/main.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/board.h b/src/board.h index f369743..117d5b2 100644 --- a/src/board.h +++ b/src/board.h @@ -17,6 +17,7 @@ int neighbor_increments[] = { typedef struct { char edges[4]; char center; + int shield; } Tile; /* board */ diff --git a/src/main.c b/src/main.c index fff4b78..99feef0 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,5 @@ #include +#include #include #include "board.h" @@ -47,7 +48,7 @@ int main() { initialize_board(board); - Tile tile = { "FRCR", 'R' }; + Tile tile = { "FRCR", 'R', 0 }; place_tile(tile, translate_coordinate(24), board, 1); /* main loop */ @@ -69,7 +70,7 @@ int main() { box(input_box, 0, 0); mvwaddstr(input_box, 0, 0, "Enter tile:"); wrefresh(input_box); - wgetstr(input_win, tile.edges); + wgetnstr(input_win, tile.edges, 5); wclear(input_win); if (tile.edges[0] == 'q') break; -- cgit v1.2.3