curses horizontal status

The unresolved "first problem" mentioned earlier in commit
382286cb99 was caused by stale values
in status fields which had become disabled.  Polymorphing left an
old BL_XP value and returning to original form left an old BL_HD one.
They weren't displayed but the stale value was included in the line
length calculation, resulting in 4 or 5 columns being set aside for
a phantom value.  That implicitly reduced the available length of the
line and could result in extra spaces separating other fields being
squeezed out while unused spaces remained at the end of the line.

Experience points, time, and score didn't trigger this problem because
they were being explicitly excluded if disabled.  So stale values for
them when they had been enabled then later disabled didn't matter.
This commit is contained in:
PatR
2019-03-26 01:47:33 -07:00
parent 382286cb99
commit 76d350dd8c

View File

@@ -370,6 +370,11 @@ unsigned long *colormasks;
w = xtra = 0; /* w: width so far; xtra: number of extra spaces */
prev_fld = BL_FLUSH;
for (i = 0; (fld = (*fieldorder)[j][i]) != BL_FLUSH; ++i) {
/* when the core marks a field as disabled, it doesn't call
status_update() to tell us to throw away the old value, so
polymorph leaves stale XP and rehumanize leaves stale HD */
if (!status_activefields[fld])
*status_vals[fld] = '\0';
text = status_vals[fld];
if (i == 0 && *text == ' ')
++text;