MCPcopy Create free account
hub / github.com/NetHack/NetHack / ttyinv_end_menu

Function ttyinv_end_menu

win/tty/wintty.c:3236–3260  ·  view source on GitHub ↗

split out of tty_end_menu(); persistent inventory is ready to display */

Source from the content-addressed store, hash-verified

3234
3235/* split out of tty_end_menu(); persistent inventory is ready to display */
3236static void
3237ttyinv_end_menu(int window, struct WinDesc *cw)
3238{
3239 if (iflags.perm_invent
3240 || gp.perm_invent_toggling_direction == toggling_on) {
3241 if (program_state.in_moveloop) {
3242 boolean inuse_only = ((ttyinvmode & InvInUse) != 0);
3243 int rows_per_side = inuse_only ? cw->maxrow - 2 : 0;
3244 int old_slots_used = ttyinv_slots_used; /* value before render */
3245
3246 ttyinv_render(window, cw);
3247
3248 /* if inuse_only was using two sides and has just shrunk to one,
3249 it will switch to full rows instead of side-by-side panels
3250 but current data only holds the left-hand panel's portion;
3251 rerun the whole thing to regenerate previously clipped data;
3252 fortunately this should be a fairly rare occurrence */
3253 if (inuse_only && old_slots_used > rows_per_side
3254 /* 'ttyinv_slots_used' was just updated by ttyinv_render()
3255 to the number of entries currently shown */
3256 && ttyinv_slots_used <= rows_per_side)
3257 tty_update_inventory(0); /* will call back to core for data */
3258 }
3259 }
3260}
3261
3262/* display persistent inventory from data collected by add_menu() */
3263static void

Callers 1

tty_end_menuFunction · 0.85

Calls 2

ttyinv_renderFunction · 0.85
tty_update_inventoryFunction · 0.85

Tested by

no test coverage detected