From 76d350dd8cf7e26811e3cc131f41494006f9ad44 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 26 Mar 2019 01:47:33 -0700 Subject: [PATCH] curses horizontal status The unresolved "first problem" mentioned earlier in commit 382286cb9930f95445d2b1b521dbcbc72a20f5c6 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. --- win/curses/cursstat.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index 999b1ecda..ca88f6c5e 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -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;