today's Qt status update: non-standard conditions

Qt's status highlighting was treating any change to hunger or
to encumbrance as "worse" (shown in red).  That's wrong if you
go from weak to just hungry or from stressed to encumbered.

Comparing satiated with other hunger states is tricky.  I've
ranked it between hungry and weak but that's fairly arbitrary.

Also, change the highlighting when Lev, Fly, and Ride are new
conditions from red to blue.
This commit is contained in:
PatR
2020-11-24 09:45:55 -08:00
parent 229930e505
commit 018d838eb9
3 changed files with 57 additions and 29 deletions

View File

@@ -133,19 +133,16 @@ void NetHackQtLabelledIcon::setFont(const QFont& f)
if (label) label->setFont(f);
}
// [pr] this might no longer be needed; it seems to have been responsible
// for highlighting the blank space where an optional field like Score
// was just toggled off; we don't need or want that anymore...
// used to highlight status conditions going from Off (blank) to On as "Worse"
void NetHackQtLabelledIcon::show()
{
if (
#if QT_VERSION >= 300
isHidden()
#else
!isVisible()
#endif
&& comp_mode != NoCompare)
highlight(hl_worse);
// Hunger and Encumbrance are worse when going from not shown
// to anything and they're set to SmallerIsBetter, so both
// BiggerIsBetter and SmallerIsBetter warrant hl_worse here.
// Fly, Lev, and Ride are set NeitherIsBetter so that when
// they appear they won't be classified as worse.
if (isHidden() && comp_mode != NoCompare)
highlight((comp_mode != NeitherIsBetter) ? hl_worse : hl_changd);
QWidget::show();
}