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

Function evaluate_and_notify_windowport

src/botl.c:1620–1680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1618}
1619
1620staticfn void
1621evaluate_and_notify_windowport(
1622 boolean *valsetlist,
1623 int idx)
1624{
1625 int i, fld, updated = 0;
1626
1627 /*
1628 * Now pass the changed values to window port.
1629 */
1630 for (i = 0; i < MAXBLSTATS; i++) {
1631 fld = initblstats[i].fld;
1632 if (((fld == BL_SCORE) && !flags.showscore)
1633 || ((fld == BL_EXP) && !flags.showexp)
1634 || ((fld == BL_TIME) && !flags.time)
1635 || ((fld == BL_HD) && !Upolyd)
1636 || ((fld == BL_XP || fld == BL_EXP) && Upolyd)
1637 || ((fld == BL_VERS) && !flags.showvers)
1638 || ((fld == BL_TERRAIN) && !flags.terrainstatus)
1639 || ((fld == BL_WEAPON) && !flags.weaponstatus)
1640 || ((fld == BL_ARMOR) && !flags.armorstatus)
1641 ) {
1642 continue;
1643 }
1644 if (eval_notify_windowport_field(fld, valsetlist, idx))
1645 updated++;
1646 }
1647 /*
1648 * Notes:
1649 * 1. It is possible to get here, with nothing having been pushed
1650 * to the window port, when none of the info has changed.
1651 *
1652 * 2. Some window ports are also known to optimize by only drawing
1653 * fields that have changed since the previous update.
1654 *
1655 * In both of those situations, we need to force updates to
1656 * all of the fields when disp.botlx is set. The tty port in
1657 * particular has a problem if that isn't done, since the core sets
1658 * disp.botlx when a menu or text display obliterates the status
1659 * line.
1660 *
1661 * For those situations, to trigger the full update of every field
1662 * whether changed or not, call status_update() with BL_RESET.
1663 *
1664 * For regular processing and to notify the window port that a
1665 * bot() round has finished and it's time to trigger a flush of
1666 * all buffered changes received thus far but not reflected in
1667 * the display, call status_update() with BL_FLUSH.
1668 *
1669 */
1670 if (disp.botlx && (windowprocs.wincap2 & WC2_RESET_STATUS) != 0L)
1671 status_update(BL_RESET, (genericptr_t) 0, 0, 0,
1672 NO_COLOR, (unsigned long *) 0);
1673 else if ((updated || disp.botlx)
1674 && (windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L)
1675 status_update(BL_FLUSH, (genericptr_t) 0, 0, 0,
1676 NO_COLOR, (unsigned long *) 0);
1677

Callers 1

botl.cFile · 0.85

Calls 1

Tested by

no test coverage detected