From ac7e7d0f21978afc70fe3ef76db69d575742b974 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 17 Jun 2025 20:18:48 +0100 Subject: Separate our command callbacks from Source's This improves the ergonomics of a few different things, and sets us up somewhat for the fact OE had a different interface for commands too (it was v1 only and had a separate API call for getting the args). --- src/con_.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/con_.c') diff --git a/src/con_.c b/src/con_.c index ddebf78..b2d7e29 100644 --- a/src/con_.c +++ b/src/con_.c @@ -136,8 +136,7 @@ bool VCALLCONV CanAutoComplete(struct con_cmd *this) { return false; } void VCALLCONV Dispatch(struct con_cmd *this, const struct con_cmdargs *args) { - // just assuming we *always* define a (V2) callback, per the DEF_CCMD macros - this->cb(args); + this->cb(args->argc, args->argv); } static void VCALLCONV ChangeStringValue(struct con_var *this, const char *s, @@ -484,8 +483,8 @@ SETTER(float, vtidx_SetValue_f, con_setvarf) SETTER(int, vtidx_SetValue_i, con_setvari) #undef SETTER -con_cmdcb con_getcmdcb(const struct con_cmd *cmd) { - return !cmd->use_newcmdiface && cmd->use_newcb ? cmd->cb : 0; +con_cmdcbv2 con_getcmdcbv2(const struct con_cmd *cmd) { + return !cmd->use_newcmdiface && cmd->use_newcb ? cmd->cb_v2 : 0; } con_cmdcbv1 con_getcmdcbv1(const struct con_cmd *cmd) { -- cgit v1.2.3-54-g00ecf