diff options
| -rw-r--r-- | src/build/gluegen.c | 8 | ||||
| -rw-r--r-- | src/con_.c | 3 | ||||
| -rw-r--r-- | src/con_.h | 10 |
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]; @@ -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) { @@ -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, \ }; \ |
