aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-11-15 20:33:33 +0000
committerGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-11-15 20:42:55 +0000
commit13ddf47d80893eb4d09ca31f5469b835f24170c7 (patch)
tree57d03f2c377f2fb68e93cbb25b3ed5111c1f6fe0
parentc15101df02685a5d26f4b130f7b559eb7ed7f74f (diff)
downloadsst-13ddf47d80893eb4d09ca31f5469b835f24170c7.tar.gz
sst-13ddf47d80893eb4d09ca31f5469b835f24170c7.zip
Mark hidden stuff as unsupported in help textHEADmaster
-rw-r--r--src/build/gluegen.c8
-rw-r--r--src/con_.c3
-rw-r--r--src/con_.h10
3 files changed, 18 insertions, 3 deletions
diff --git a/src/build/gluegen.c b/src/build/gluegen.c
index 6a859d3..574aa92 100644
--- a/src/build/gluegen.c
+++ b/src/build/gluegen.c
@@ -749,7 +749,13 @@ F( " feats.preinit_%.*s = _feat_preinit_%.*s();",
_( "}")
_( "")
_( "static inline void initfeatures() {")
-_( " int _hiddenflag = GAMETYPE_MATCHES(OE) ? 0 : _CON_NE_HIDDEN;")
+ // note: hidden flag could be 0 on OE but it's useful to know which things
+ // *would* be hidden. in particular, GetHelpText currently checks for both
+ // CON_INIT_HIDDEN and _CON_NE_HIDDEN when deciding whether to prepend
+ // the unsupported marker to the help text. the value of CON_INIT_HIDDEN
+ // is otherwise unused in OE so won't do any harm being set all the time.
+_( " int _hiddenflag = GAMETYPE_MATCHES(OE) ?")
+_( " CON_INIT_HIDDEN : _CON_NE_HIDDEN;")
for (int i = 0; i < nfeatures; ++i) { // N.B.: this *should* be 0-indexed!
const char *else_ = "";
s16 mod = feat_initorder[i];
diff --git a/src/con_.c b/src/con_.c
index 7552816..8359482 100644
--- a/src/con_.c
+++ b/src/con_.c
@@ -154,6 +154,9 @@ static const char *VCALLCONV GetName(struct con_cmdbase *this) {
return this->name;
}
static const char *VCALLCONV GetHelpText(struct con_cmdbase *this) {
+ if_cold (this->flags & (CON_INIT_HIDDEN | _CON_NE_HIDDEN)) {
+ return this->help - 18; // see _DEF_* macros in con_.h
+ }
return this->help;
}
static bool VCALLCONV IsRegistered(struct con_cmdbase *this) {
diff --git a/src/con_.h b/src/con_.h
index d75c2af..a10488b 100644
--- a/src/con_.h
+++ b/src/con_.h
@@ -276,7 +276,10 @@ extern struct _con_vtab_iconvar_wrap {
static struct con_var _cvar_##name_ = { \
.base = { \
.vtable = _con_vtab_var, \
- .name = "" #name_, .help = "" desc, .flags = (flags_) \
+ .name = "" #name_, \
+ /* n.b. redundant cast to avoid warnings */ \
+ .help = (const char *)("** unsupported ** " desc) + 18, \
+ .flags = (flags_) \
}, \
.vtable_iconvar = _con_vtab_iconvar, \
.v2 = { \
@@ -312,7 +315,10 @@ extern struct _con_vtab_iconvar_wrap {
static struct con_cmd _ccmd_##varname = { \
.base = { \
.vtable = _con_vtab_cmd, \
- .name = "" #name_, .help = "" desc, .flags = (flags_) \
+ .name = "" #name_, \
+ /* n.b. redundant cast to avoid warnings */ \
+ .help = (const char *)("** unsupported ** " desc) + 18, \
+ .flags = (flags_) \
}, \
.cb = &func, \
}; \