From: Christian Heller Date: Sat, 24 Aug 2013 04:04:18 +0000 (+0200) Subject: Added handling of windows errors in main(). X-Git-Tag: tce~1063 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/static/%7B%7Bprefix%7D%7D/templates?a=commitdiff_plain;h=f24abb49cab88fe55d0da6db152634f7e1a4faf0;p=plomrogue Added handling of windows errors in main(). --- diff --git a/src/keybindings.c b/src/keybindings.c index 3809416..f33b559 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -169,7 +169,7 @@ extern char * get_keyname(uint16_t keycode) extern void keyswin_mod_key(struct World * world, struct WinMeta * win_meta) { world->keyswindata->edit = 1; - draw_all_wins (win_meta); + draw_all_wins(win_meta); int key = getch(); if (key < 1000) { diff --git a/src/main.c b/src/main.c index 5cc1ecb..229b9d3 100644 --- a/src/main.c +++ b/src/main.c @@ -171,7 +171,8 @@ int main(int argc, char *argv[]) init_keybindings(&world); set_cleanup_flag(CLEANUP_KEYBINDINGS); struct WinMeta win_meta; - init_win_meta(screen, &win_meta); + char * err_winmem = "Error: Window drawing memory allocation failed."; + exit_err(init_win_meta(screen, &win_meta), &world, err_winmem); struct Win win_keys = init_win(&win_meta, "Keys", 0, 29, &world, draw_keys_win); struct Win win_info = init_win(&win_meta, "Info", @@ -204,8 +205,8 @@ int main(int argc, char *argv[]) } if (0 == start_turn) { - draw_all_wins (&win_meta); - key = getch(); + exit_err(draw_all_wins(&win_meta), &world, err_winmem); + key = getch(); } if (1 == await_actions && (world.turn < start_turn