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

Method updateStats

win/Qt/qt_stat.cpp:717–1072  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715}
716
717RESTORE_WARNING_FORMAT_NONLITERAL
718
719/*
720 * Update the displayed status. The current code in botl.c updates
721 * two lines of information. Both lines are always updated one after
722 * the other. So only do our update when we update the second line.
723 *
724 * Information on the first line:
725 * name, Str/Dex/&c characteristics, alignment, score
726 *
727 * Information on the second line:
728 * dlvl, gold, hp, power, ac, {level & exp or HD **}
729 * status (hunger, encumbrance, sick, stun, conf, halu, blind), time
730 *
731 * [**] HD is shown instead of level and exp when hero is polymorphed.
732 */
733void NetHackQtStatusWindow::updateStats()
734{
735 if (!parentWidget()) return;
736 if (cursy != 0) return; /* do a complete update when line 0 is done */
737
738 QString buf;
739
740 if (first_set) {
741 // set toggle-detection flags for optional fields
742 was_polyd = Upolyd ? true : false;
743 had_exp = ::flags.showexp ? true : false;
744 // not conditionalized upon '#ifdef SCORE_ON_BOTL' here
745 had_score = ::flags.showscore ? true : false; // false when disabled
746 score.setLabel(""); // init if enabled, one-time set if disabled
747 }
748 // display hitpoint bar if it is active; it isn't subject to field
749 // highlighting so we don't track whether it has just been toggled On|Off
750 HitpointBar();
751
752 int st = ACURR(A_STR);
753 if (st > STR18(100)) {
754 buf = nh_qsprintf("Str:%d", st - 100); // 19..25
755 } else if (st == STR18(100)) {
756 buf = nh_qsprintf("Str:18/**"); // 18/100
757 } else if (st > 18) {
758 buf = nh_qsprintf("Str:18/%02d", st - 18); // 18/01..18/99
759 } else {
760 buf = nh_qsprintf("Str:%d", st); // 3..18
761 }
762 str.setLabel(buf, NetHackQtLabelledIcon::NoNum, (long) st);
763 dex.setLabel("Dex:", (long) ACURR(A_DEX));
764 con.setLabel("Con:", (long) ACURR(A_CON));
765 intel.setLabel("Int:", (long) ACURR(A_INT));
766 wis.setLabel("Wis:", (long) ACURR(A_WIS));
767 cha.setLabel("Cha:", (long) ACURR(A_CHA));
768
769 boolean spreadout = (::iflags.wc2_statuslines != 2);
770 int k = 0; // number of conditions shown
771
772 long qt_uhs = 0L;
773 const char *hung = hu_stat[u.uhs];
774 QString qhung = QString(hung).trimmed();

Callers

nothing calls this directly

Calls 15

nh_qsprintfFunction · 0.85
near_capacityFunction · 0.85
status_versionFunction · 0.85
nh_capitalize_wordsFunction · 0.85
pmnameFunction · 0.85
rank_ofFunction · 0.85
upstartFunction · 0.85
describe_levelFunction · 0.85
depthFunction · 0.85
money_cntFunction · 0.85
botl_scoreFunction · 0.85
ForceResizeMethod · 0.80

Tested by

no test coverage detected