exit_err(init_win_meta(screen, &win_meta), &world, err_winmem);
world.wins.meta = &win_meta;
struct Win win_keys = init_win_from_file(&world, "Keys", draw_keys_win);
+ world.wins.keys = &win_keys;
+ set_cleanup_flag(CLEANUP_WIN_KEYS);
struct Win win_info = init_win_from_file(&world, "Info", draw_info_win);
+ world.wins.info = &win_info;
+ set_cleanup_flag(CLEANUP_WIN_INFO);
struct Win win_log = init_win_from_file(&world, "Log", draw_log_win);
- struct Win win_map = init_win_from_file(&world, "Map", draw_map_win);
- world.wins.keys = &win_keys;
world.wins.log = &win_log;
- world.wins.info = &win_info;
+ set_cleanup_flag(CLEANUP_WIN_LOG);
+ struct Win win_map = init_win_from_file(&world, "Map", draw_map_win);
world.wins.map = &win_map;
+ set_cleanup_flag(CLEANUP_WIN_MAP);
+
sorted_wintoggle(&world);
/* Replay mode. */
#include "map.h" /* for Map struct */
#include "keybindings.h" /* for KeysWinData, KeyBinding structs */
#include "command_db.h" /* for free_command_db() */
+#include "windows.h" /* for Win struct */
/* The clean-up routine and the flag resource by which it decides what to do. */
-static uint8_t cleanup_flags = 0x00;
+static uint32_t cleanup_flags = 0x0000;
static void cleanup(struct World * world);
{
free_command_db(world);
}
+ if (cleanup_flags & CLEANUP_WIN_INFO)
+ {
+ free(world->wins.info->_title);
+ }
+ if (cleanup_flags & CLEANUP_WIN_MAP)
+ {
+ free(world->wins.map->_title);
+ }
+ if (cleanup_flags & CLEANUP_WIN_LOG)
+ {
+ free(world->wins.log->_title);
+ }
+ if (cleanup_flags & CLEANUP_WIN_KEYS)
+ {
+ free(world->wins.keys->_title);
+ }
}
*/
enum cleanup_flag
{
- CLEANUP_NCURSES = 0x01,
- CLEANUP_MAP = 0x02,
- CLEANUP_KEYBINDINGS = 0x04,
- CLEANUP_LOG = 0x08,
- CLEANUP_COMMAND_DB = 0x10
+ CLEANUP_NCURSES = 0x0001,
+ CLEANUP_MAP = 0x0002,
+ CLEANUP_KEYBINDINGS = 0x0004,
+ CLEANUP_LOG = 0x0008,
+ CLEANUP_COMMAND_DB = 0x0010,
+ CLEANUP_WIN_INFO = 0x0020,
+ CLEANUP_WIN_LOG = 0x0040,
+ CLEANUP_WIN_MAP = 0x0080,
+ CLEANUP_WIN_KEYS = 0x0100
};
extern void set_cleanup_flag(enum cleanup_flag flag);