From f4210542f0e4e8cb8bfd0561f1c3904cd244d4f5 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 10 Sep 2022 19:30:36 -0700 Subject: [PATCH] enc_stat[], hu_stat[] The definition of enc_stat[] got changed by a pull request nearly a year ago ('const char *enc_stat[]' -> 'const char *const enc_stat[]') but the separate declarations for it weren't changed to match. Make the same change for hu_stat[]. Not sure why the pull request didn't include it since the old declaration and the usage are same. The curses one is in code that isn't used. --- src/botl.c | 8 +++++--- src/eat.c | 6 ++++-- src/insight.c | 4 ++-- win/Qt/qt_stat.cpp | 6 +++--- win/X11/winstat.c | 4 ++-- win/curses/cursstat.c | 4 ++-- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/botl.c b/src/botl.c index 04cd183ff..917ed86eb 100644 --- a/src/botl.c +++ b/src/botl.c @@ -8,10 +8,12 @@ #include #endif -extern const char *hu_stat[]; /* defined in eat.c */ +extern const char *const hu_stat[]; /* defined in eat.c */ -const char *const enc_stat[] = { "", "Burdened", "Stressed", - "Strained", "Overtaxed", "Overloaded" }; +const char *const enc_stat[] = { + "", "Burdened", "Stressed", + "Strained", "Overtaxed", "Overloaded" +}; static const char *rank(void); static void bot_via_windowport(void); diff --git a/src/eat.c b/src/eat.c index 25232fcfe..8b1c53536 100644 --- a/src/eat.c +++ b/src/eat.c @@ -66,8 +66,10 @@ static int tin_ok(struct obj *); ((otyp) == LEMBAS_WAFER || (otyp) == CRAM_RATION) /* see hunger states in hack.h - texts used on bottom line */ -const char *hu_stat[] = { "Satiated", " ", "Hungry ", "Weak ", - "Fainting", "Fainted ", "Starved " }; +const char *const hu_stat[] = { + "Satiated", " ", "Hungry ", "Weak ", + "Fainting", "Fainted ", "Starved " +}; /* used by getobj() callback routines eat_ok()/offer_ok()/tin_ok() to indicate whether player was given an opportunity to eat or offer or diff --git a/src/insight.c b/src/insight.c index bce4ae428..4a96fb961 100644 --- a/src/insight.c +++ b/src/insight.c @@ -35,8 +35,8 @@ static int QSORTCALLBACK vanqsort_cmp(const genericptr, const genericptr); static int set_vanq_order(void); static int num_extinct(void); -extern const char *hu_stat[]; /* hunger status from eat.c */ -extern const char *enc_stat[]; /* encumbrance status from botl.c */ +extern const char *const hu_stat[]; /* hunger status from eat.c */ +extern const char *const enc_stat[]; /* encumbrance status from botl.c */ static const char You_[] = "You ", are[] = "are ", were[] = "were ", have[] = "have ", had[] = "had ", can[] = "can ", diff --git a/win/Qt/qt_stat.cpp b/win/Qt/qt_stat.cpp index ad56429c1..522e9ef37 100644 --- a/win/Qt/qt_stat.cpp +++ b/win/Qt/qt_stat.cpp @@ -76,6 +76,9 @@ extern "C" { #include "hack.h" + +extern const char *const enc_stat[]; /* from botl.c */ +extern const char *const hu_stat[]; /* from eat.c */ } #include "qt_pre.h" @@ -90,9 +93,6 @@ extern "C" { #include "qt_str.h" #include "qt_xpms.h" -extern const char *enc_stat[]; /* from botl.c */ -extern const char *hu_stat[]; /* from eat.c */ - extern int qt_compact_mode; namespace nethack_qt_ { diff --git a/win/X11/winstat.c b/win/X11/winstat.c index 778471b52..ca6d6e391 100644 --- a/win/X11/winstat.c +++ b/win/X11/winstat.c @@ -1225,8 +1225,8 @@ adjust_status_fancy(struct xwindow *wp, const char *str) } /* Fancy ================================================================== */ -extern const char *hu_stat[]; /* from eat.c */ -extern const char *enc_stat[]; /* from botl.c */ +extern const char *const hu_stat[]; /* from eat.c */ +extern const char *const enc_stat[]; /* from botl.c */ struct X_status_value { /* we have to cast away 'const' when assigning new names */ diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index 0d9aaabc6..790738cc3 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -1398,8 +1398,8 @@ static nhstat prevtime; static nhstat prevscore; #endif -extern const char *hu_stat[]; /* from eat.c */ -extern const char *enc_stat[]; /* from botl.c */ +extern const char *const hu_stat[]; /* from eat.c */ +extern const char *const enc_stat[]; /* from botl.c */ /* If the statuscolors patch isn't enabled, have some default colors for status problems anyway */