- world.wmeta.screen = initscr();
- set_cleanup_flag(CLEANUP_NCURSES);
- noecho();
- curs_set(0);
- 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 = NULL;
- world.wmeta.active = 0;
+ 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.wins.screen);
+ uint32_t maxx_test = getmaxx(world.wins.screen);
+ exit_err(maxy_test > UINT16_MAX || maxx_test > UINT16_MAX, err_s);
+ world.wins.padsize.y = maxy_test;
+ world.wins.padsize.x = maxx_test;
+ world.wins.pad = newpad(world.wins.padsize.y, 1);
+ exit_err(NULL == world.wins.pad, err_m);