void curses_del_wid(winid wid) { nethack_wid *tmpwid; nethack_wid *widptr = nhwids; if (curses_is_menu(wid) || curses_is_text(wid)) { curses_del_menu(wid); } while (widptr != NULL) { if (widptr->nhwid == wid) { if (widptr->prev_wid != NULL) { tmpwid = widptr->prev_wid; tmpwid->next_wid = widptr->next_wid; } else { nhwids = widptr->next_wid; /* New head mode, or NULL */ } if (widptr->next_wid != NULL) { tmpwid = widptr->next_wid; tmpwid->prev_wid = widptr->prev_wid; } free(widptr); break; } widptr = widptr->next_wid; } }
void curses_del_nhwin(winid wid) { nethack_window *tmpwin; nethack_window *winptr = nhwins; if (curses_is_menu(wid) || curses_is_text(wid)) { curses_del_menu(wid); } while (winptr != NULL) { if (winptr->nhwin == wid) { if (winptr->prev_window != NULL) { tmpwin = winptr->prev_window; tmpwin->next_window = winptr->next_window; } else { nhwins = winptr->next_window; /* New head mode, or NULL */ } if (winptr->next_window != NULL) { tmpwin = winptr->next_window; tmpwin->prev_window = winptr->prev_window; } free(winptr); break; } winptr = winptr->next_window; } }
void curses_del_nhwin(winid wid) { if (curses_is_menu(wid) || curses_is_text(wid)) { curses_del_menu(wid); return; } if (!is_main_window(wid)) { panic("curses_del_nhwin: wid out of range. Not a main window."); } nhwins[wid].nhwin = -1; }