From d7ac8dcb88a5cd93f505f1f00b1daec8ac6cceaf Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Mon, 6 Jun 2022 11:49:25 +0800 Subject: Flatten map to array of size H*W --- ui.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui.c') diff --git a/ui.c b/ui.c index 1c1eea3..70bfe5c 100644 --- a/ui.c +++ b/ui.c @@ -25,10 +25,10 @@ void printrect(int y, int x, int h, int w) { refresh(); } -void printmap(char** map, int y, int x, int mapH, int mapW) { +void printmap(char* map, int y, int x, int mapH, int mapW) { for (int r = 0; r < mapH; r++) { for (int c = 0; c < mapW; c++) { - if (map[r][c] == '+') { + if (map[r * mapW + c] == '+') { mvaddch(y + r, x + 2 * c, (' ' | A_REVERSE)); addch(' ' | A_REVERSE); } else { -- cgit v1.2.3