From 427f8e42d85efad3a08e91a5d43df3048a08c3a5 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 1 Aug 2020 19:17:56 -0700 Subject: [PATCH] ^X vs hunger, encumbrance When hunger state is "not hungry" (so omitted from the status line), say so in the status section of ^X output. Mainly so that wizard mode can append the internal nutrition value without inserting an entire line that [previously] wouldn't be present in regular play. Show an internal value for encumbrance too, although that would be better if it also included some indication of the amount where the encumbrance state changes. Encumbrance is confusing and I didn't pursue that. --- include/you.h | 4 ++-- src/insight.c | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/you.h b/include/you.h index da85c9c21..76aae6a7f 100644 --- a/include/you.h +++ b/include/you.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 you.h $NHDT-Date: 1593768079 2020/07/03 09:21:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.46 $ */ +/* NetHack 3.6 you.h $NHDT-Date: 1596334647 2020/08/02 02:17:27 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.47 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -359,7 +359,7 @@ struct you { char ushops_entered[5]; /* ditto, shops entered this turn */ char ushops_left[5]; /* ditto, shops exited this turn */ - int uhunger; /* refd only in eat.c and shk.c */ + int uhunger; /* refd only in eat.c and shk.c (also insight.c) */ unsigned uhs; /* hunger state - see eat.c */ struct prop uprops[LAST_PROP + 1]; diff --git a/src/insight.c b/src/insight.c index 16d30d96f..519a64be4 100644 --- a/src/insight.c +++ b/src/insight.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 insight.c $NHDT-Date: 1595637572 2020/07/25 00:39:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.21 $ */ +/* NetHack 3.7 insight.c $NHDT-Date: 1596334662 2020/08/02 02:17:42 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.22 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -976,12 +976,18 @@ int final; } Strcpy(buf, hu_stat[u.uhs]); /* hunger status; omitted if "normal" */ mungspaces(buf); /* strip trailing spaces */ - if (*buf) { + /* status line doesn't show hunger when state is "not hungry", we do; + needed for wizard mode's reveal of u.uhunger but add it for everyone */ + if (!*buf) + Strcpy(buf, "not hungry"); + if (*buf) { /* (since "not hungry" was added, this will always be True) */ *buf = lowc(*buf); /* override capitalization */ if (!strcmp(buf, "weak")) Strcat(buf, " from severe hunger"); else if (!strncmp(buf, "faint", 5)) /* fainting, fainted */ Strcat(buf, " due to starvation"); + if (wizard) + Sprintf(eos(buf), " <%d>", u.uhunger); you_are(buf, ""); } /* encumbrance */ @@ -1007,6 +1013,8 @@ int final; adj = "not possible"; break; } + if (wizard) + Sprintf(eos(buf), " <%d>", inv_weight()); Sprintf(eos(buf), "; movement %s %s%s", !final ? "is" : "was", adj, (cap < OVERLOADED) ? " slowed" : ""); you_are(buf, ""); @@ -1014,7 +1022,10 @@ int final; /* last resort entry, guarantees Status section is non-empty (no longer needed for that purpose since weapon status added; still useful though) */ - you_are("unencumbered", ""); + Strcpy(buf, "unencumbered"); + if (wizard) + Sprintf(eos(buf), " <%d>", inv_weight()); + you_are(buf, ""); } /* current weapon(s) and corresponding skill level(s) */ weapon_insight(final);