| 715 | } |
| 716 | |
| 717 | RESTORE_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 | */ |
| 733 | void 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(); |
nothing calls this directly
no test coverage detected