X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fclient%2Fwindows.c;h=1459ec2303c6c3b83946dbc4f94a8bd5252c16a5;hb=52d7524ce047cd16192bb83bea15d36a90bb2a9f;hp=0ebe56dd949dbd9a063d432fe4b2da84a450a86e;hpb=1befe1034a6330301d4af2df80aaa98430a6e8c9;p=plomrogue diff --git a/src/client/windows.c b/src/client/windows.c index 0ebe56d..1459ec2 100644 --- a/src/client/windows.c +++ b/src/client/windows.c @@ -6,10 +6,10 @@ #include /* sprintf() */ #include /* free() */ #include /* strlen(), memcpy(), strnlen() */ -#include /* pnoutrefresh(), doupdate(), werase(), wnoutrefresh(), - * erase(), getmaxx(), getmaxy(), delwin(), endwin(), - * initscr(), noecho(), curs_set(), newpad(), mvwaddch(), - * mvwaddstr(), wresize(), chtype +#include /* chtype, pnoutrefresh(), doupdate(), werase(), erase(), + * wnoutrefresh(), getmaxx(), getmaxy(), initscr(), + * noecho(), curs_set(), newpad(), mvwaddch(), mvwaddstr(), + * wresize() */ #include "../common/rexit.h" /* for exit_err() */ #include "../common/try_malloc.h" /* for try_malloc() */ @@ -423,29 +423,38 @@ static void shift_win_backward() -extern void init_win_meta() +extern void init_wmeta_and_ncurses() { - char * err_s = "init_win_meta() creates virtual screen beyond legal size."; - char * err_m = "init_win_meta() triggers memory alloc error via newpad()."; world.wmeta.screen = initscr(); set_cleanup_flag(CLEANUP_NCURSES); noecho(); curs_set(0); - uint32_t maxy_test = getmaxy(world.wmeta.screen); - uint32_t maxx_test = getmaxx(world.wmeta.screen); - exit_err(maxy_test > UINT16_MAX || maxx_test > UINT16_MAX, err_s); - world.wmeta.padsize.y = maxy_test; - world.wmeta.padsize.x = maxx_test; + world.wmeta.padsize.y = 0; + world.wmeta.padsize.x = 0; world.wmeta.chain_start = 0; world.wmeta.chain_end = 0; world.wmeta.pad_offset = 0; - world.wmeta.pad = newpad(world.wmeta.padsize.y, 1); - exit_err(NULL == world.wmeta.pad, err_m); + world.wmeta.pad = NULL; world.wmeta.active = 0; } +extern void make_pad() +{ + char * err_s = "make_pad() creates an illegaly large virtual screen."; + char * err_m = "make_pad() triggers memory allocation error via newpad()."; + uint32_t maxy_test = getmaxy(world.wmeta.screen); + uint32_t maxx_test = getmaxx(world.wmeta.screen); + exit_err(maxy_test > UINT16_MAX || maxx_test > UINT16_MAX, err_s); + world.wmeta.padsize.y = maxy_test; + world.wmeta.padsize.x = maxx_test; + world.wmeta.pad = newpad(world.wmeta.padsize.y, 1); + exit_err(NULL == world.wmeta.pad, err_m); +} + + + extern void init_win(struct Win ** wp, char * title, int16_t height, int16_t width, void * func) { @@ -484,14 +493,6 @@ extern void init_win(struct Win ** wp, char * title, int16_t height, -extern void free_winmeta_and_endwin() -{ - delwin(world.wmeta.pad); - endwin(); -} - - - extern void free_win(struct Win * win) { free(win->title);