MCPcopy Index your code
hub / github.com/NetHack/NetHack / sync_perminvent

Function sync_perminvent

src/invent.c:5564–5658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5562}
5563
5564void
5565sync_perminvent(void)
5566{
5567 static win_request_info *wri = 0;
5568 const char *wport_id;
5569
5570 if (WIN_INVEN == WIN_ERR) {
5571 if ((gc.core_invent_state
5572 || (wri_info.tocore.tocore_flags & prohibited))
5573 && !(in_perm_invent_toggled
5574 && gp.perm_invent_toggling_direction == toggling_on))
5575 return;
5576 }
5577 prepare_perminvent(WIN_INVEN);
5578
5579 if ((!iflags.perm_invent && gc.core_invent_state)) {
5580 /* Odd - but this could be end-of-game disclosure
5581 * which just sets boolean iflags.perm_invent to
5582 * FALSE without actually doing anything else.
5583 */
5584#ifdef TTY_PERM_INVENT
5585 if (WINDOWPORT(tty))
5586 perm_invent_toggled(TRUE); /* TRUE means negated */
5587#endif
5588 docrt();
5589 return;
5590 }
5591
5592 /*
5593 * The following conditions can bring us to here:
5594 * 1. iflags.perm_invent is on
5595 * AND
5596 * gc.core_invent_state is still zero.
5597 * OR
5598 * 2. iflags.perm_invent is off, but we're in the
5599 * midst of toggling it on.
5600 * OR
5601 * 3. iflags.perminv_mode has been changed via 'm O'.
5602 */
5603
5604 if ((iflags.perm_invent && !gc.core_invent_state)
5605 || (!iflags.perm_invent
5606 && (in_perm_invent_toggled
5607 && gp.perm_invent_toggling_direction == toggling_on))) {
5608 /* Send windowport a request to return the related settings to us */
5609 if ((iflags.perm_invent && !gc.core_invent_state)
5610 || in_perm_invent_toggled) {
5611 wri = ctrl_nhwindow(WIN_INVEN, request_settings, &wri_info);
5612 if (wri != 0) {
5613 if ((wri->tocore.tocore_flags & (too_early)) != 0) {
5614 /* don't be too noisy about this as it's really
5615 * a startup timing issue. Just set a marker. */
5616 iflags.perm_invent_pending = TRUE;
5617 return;
5618 }
5619 if ((wri->tocore.tocore_flags & (too_small | prohibited))
5620 != 0) {
5621 /* sizes aren't good enough */

Callers 2

tty_update_inventoryFunction · 0.85
perm_invent_toggledFunction · 0.85

Calls 7

prepare_perminventFunction · 0.85
perm_invent_toggledFunction · 0.85
docrtFunction · 0.85
set_option_mod_statusFunction · 0.85
wait_synchFunction · 0.85
display_inventoryFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected