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

Function tty_status_update

win/tty/wintty.c:4451–4579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4449 */
4450
4451DISABLE_WARNING_FORMAT_NONLITERAL
4452
4453void
4454tty_status_update(
4455 int fldidx,
4456 genericptr_t ptr,
4457 int chg UNUSED,
4458 int percent,
4459 int color,
4460 unsigned long *colormasks)
4461{
4462 int attrmask;
4463 long *condptr = (long *) ptr;
4464 char *text = (char *) ptr;
4465 char goldbuf[40], *lastchar, *p;
4466 const char *fmt;
4467 boolean reset_state = NO_RESET;
4468
4469 if ((fldidx < BL_RESET) || (fldidx >= MAXBLSTATS))
4470 return;
4471
4472 if ((fldidx >= 0 && fldidx < MAXBLSTATS) && !status_activefields[fldidx])
4473 return;
4474
4475 switch (fldidx) {
4476 case BL_RESET:
4477 reset_state = FORCE_RESET;
4478 FALLTHROUGH;
4479 /*FALLTHRU*/
4480 case BL_FLUSH:
4481 if (make_things_fit(reset_state) || truncation_expected) {
4482 render_status();
4483#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
4484 status_sanity_check();
4485#endif
4486 }
4487 return;
4488 case BL_CONDITION:
4489 tty_status[NOW][fldidx].idx = fldidx;
4490 tty_condition_bits = *condptr;
4491 tty_colormasks = colormasks;
4492 tty_status[NOW][fldidx].valid = TRUE;
4493 tty_status[NOW][fldidx].dirty = TRUE;
4494 tty_status[NOW][fldidx].sanitycheck = TRUE;
4495 truncation_expected = FALSE;
4496 break;
4497 case BL_GOLD:
4498 text = decode_mixed(goldbuf, text);
4499 FALLTHROUGH;
4500 /*FALLTHRU*/
4501 default:
4502 attrmask = (color >> 8) & 0x00FF;
4503 fmt = status_fieldfmt[fldidx];
4504 if (!fmt)
4505 fmt = "%s";
4506 /* should be checking for first enabled field here rather than
4507 just first field, but 'fieldorder' doesn't start any rows
4508 with fields which can be disabled so [any_row][0] suffices */

Callers

nothing calls this directly

Calls 8

make_things_fitFunction · 0.85
render_statusFunction · 0.85
status_sanity_checkFunction · 0.85
decode_mixedFunction · 0.85
critically_low_hpFunction · 0.85
eosFunction · 0.85
stat_cap_indxFunction · 0.85
term_attr_fixupFunction · 0.70

Tested by

no test coverage detected