raw();
init_keybindings(&world);
set_cleanup_flag(CLEANUP_KEYBINDINGS);
- struct WinMeta win_meta;
char * err_winmem = "Trouble with init_win_meta() or draw_all_wins() in "
"main().";
- exit_err(init_win_meta(screen, &win_meta), &world, err_winmem);
- world.wins.meta = &win_meta;
+ exit_err(init_win_meta(screen, &world.wins.meta), &world, err_winmem);
+ set_cleanup_flag(CLEANUP_WIN_META);
world.wins.keys = init_win_from_file(&world, "Keys", draw_keys_win);
set_cleanup_flag(CLEANUP_WIN_KEYS);
world.wins.info = init_win_from_file(&world, "Info", draw_info_win);
}
while (1)
{
- draw_all_wins(&win_meta);
+ draw_all_wins(world.wins.meta);
key = getch();
if ( EOF != action
&& key == get_action_key(world.keybindings, "wait"))
while (1)
{
save_game(&world);
- draw_all_wins(&win_meta);
+ draw_all_wins(world.wins.meta);
key = getch();
if (0 != player.hitpoints && 0 == player_control(key, &world))
{
{
free_win(world->wins.keys);
}
+ if (cleanup_flags & CLEANUP_WIN_META)
+ {
+ delwin(world->wins.meta->padframe.curses_win);
+ free(world->wins.meta);
+ }
if (cleanup_flags & CLEANUP_MAP_OBJECT_DEFS)
{
free_item_defs(world->item_def);
CLEANUP_WIN_INFO = 0x0080,
CLEANUP_WIN_LOG = 0x0100,
CLEANUP_WIN_MAP = 0x0200,
- CLEANUP_WIN_KEYS = 0x0400
+ CLEANUP_WIN_KEYS = 0x0400,
+ CLEANUP_WIN_META = 0x0800
};
extern void set_cleanup_flag(enum cleanup_flag flag);
-extern uint8_t init_win_meta(WINDOW * screen, struct WinMeta * wmeta)
+extern uint8_t init_win_meta(WINDOW * screen, struct WinMeta ** wmp)
{
+ struct WinMeta * wmeta = malloc(sizeof(struct WinMeta));
wmeta->_screen = screen;
uint32_t maxy_test = getmaxy(screen);
uint32_t maxx_test = getmaxx(screen);
}
wmeta->padframe.curses_win = pad_test;
wmeta->active = 0;
+ *wmp = wmeta;
return 0;
}
extern void free_win(struct Win * win)
{
+ if (0 != win->frame.curses_win)
+ {
+ delwin(win->frame.curses_win);
+ }
free(win->_title);
free(win);
}
* initialized 0, except for the virtual screen (height = that of the terminal
* screen; width = 1) amd its frame sized to the size of the terminal screen.
*/
-extern uint8_t init_win_meta(WINDOW * screen, struct WinMeta * wmeta);
+extern uint8_t init_win_meta(WINDOW * screen, struct WinMeta ** wmeta);