diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2022-03-20 20:05:42 +0000 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2022-03-20 20:09:53 +0000 |
commit | c0d4714cb304394f19cac5b71d704aa6b2c27dd5 (patch) | |
tree | 252a0880c6e2fbff9a506ad049b03691eaf1094e /src/con_.h | |
parent | 254c7be6edd17a3c33e9152097264f5b159b1b45 (diff) |
Support deferring cvar registration
This allows stuff to be registered conditionally.
Unfortunately cmeta is now truly the worst thing of all time, but
cleaning it up isn't a huge priority. On the plus side, codegen actually
got simpler.
Diffstat (limited to 'src/con_.h')
-rw-r--r-- | src/con_.h | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -293,6 +293,24 @@ extern void *_con_vtab_iconvar[]; static void _cmdf_##name(const struct con_cmdargs *cmd) \ /* { body here } */ +/* + * These are exactly the same as the above macros, but they don't cause the + * commands or variables to be registered on plugin load. + */ +#define DEF_CVAR_UNREG DEF_CVAR +#define DEF_CVAR_MIN_UNREG DEF_CVAR_MIN +#define DEF_CVAR_MAX_UNREG DEF_CVAR_MAX +#define DEF_CVAR_MINMAX_UNREG DEF_CVAR_MINMAX +#define DEF_CCMD_UNREG DEF_CCMD +#define DEF_CCMD_HERE_UNREG DEF_CCMD_HERE +#define DEF_CCMD_PLUSMINUS_UNREG DEF_CCMD_PLUSMINUS + +/* + * Registers a command or variable defined with the _UNREG variants of the above + * macros. Can be used to conditionally register things. + */ +void con_reg(void *cmd_or_var); + #endif // vi: sw=4 ts=4 noet tw=80 cc=80 |