1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 20:16:10 +08:00

More ConCommand tweaks

This commit is contained in:
Nick Hastings
2023-05-20 23:32:39 -04:00
committed by Nicholas Hastings
parent 2541d89f62
commit bff074c159

View File

@ -392,7 +392,7 @@ public:
const char *pHelpString = 0, int64 flags = 0, FnCommandCompletionCallback completionFunc = 0 ); const char *pHelpString = 0, int64 flags = 0, FnCommandCompletionCallback completionFunc = 0 );
ConCommand( ConCommandRefAbstract *pReferenceOut, const char *pName, FnCommandCallbackVoid_t callback, ConCommand( ConCommandRefAbstract *pReferenceOut, const char *pName, FnCommandCallbackVoid_t callback,
const char *pHelpString = 0, int64 flags = 0, FnCommandCompletionCallback completionFunc = 0 ); const char *pHelpString = 0, int64 flags = 0, FnCommandCompletionCallback completionFunc = 0 );
ConCommand( ConCommandRefAbstract* pReferenceOut, const char* pName, FnCommandCallbackNoContext_t pCallback, ConCommand( ConCommandRefAbstract* pReferenceOut, const char* pName, FnCommandCallbackNoContext_t callback,
const char* pHelpString = 0, int64 flags = 0, FnCommandCompletionCallback completionFunc = 0 ); const char* pHelpString = 0, int64 flags = 0, FnCommandCompletionCallback completionFunc = 0 );
ConCommand( ConCommandRefAbstract *pReferenceOut, const char *pName, ICommandCallback *pCallback, ConCommand( ConCommandRefAbstract *pReferenceOut, const char *pName, ICommandCallback *pCallback,
const char *pHelpString = 0, int64 flags = 0, ICommandCompletionCallback *pCommandCompletionCallback = 0 ); const char *pHelpString = 0, int64 flags = 0, ICommandCompletionCallback *pCommandCompletionCallback = 0 );
@ -425,10 +425,12 @@ private:
class CallbackInfo_t class CallbackInfo_t
{ {
public: public:
union {
FnCommandCallback_t m_fnCommandCallback; FnCommandCallback_t m_fnCommandCallback;
FnCommandCallbackVoid_t m_fnVoidCommandCallback; FnCommandCallbackVoid_t m_fnVoidCommandCallback;
FnCommandCallbackNoContext_t m_fnContextlessCommandCallback; FnCommandCallbackNoContext_t m_fnContextlessCommandCallback;
ICommandCallback* m_pCommandCallback; ICommandCallback* m_pCommandCallback;
};
bool m_bUsingCommandCallbackInterface : 1; bool m_bUsingCommandCallbackInterface : 1;
bool m_bHasVoidCommandCallback : 1; bool m_bHasVoidCommandCallback : 1;
@ -1106,13 +1108,13 @@ private:
#define CON_COMMAND_SHARED( name, description ) \ #define CON_COMMAND_SHARED( name, description ) \
static ConCommandRefAbstract name##_ref; \ static ConCommandRefAbstract name##_ref; \
static void name##_callback( const CCommandContext &context, const CCommand &args ); \ static void name##_callback( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command_client( &name##_ref, #name "_client", name##_callback, name, description ); \ static ConCommand name##_command_client( &name##_ref, #name "_client", name##_callback, description ); \
static void name##_callback( const CCommandContext &context, const CCommand &args ) static void name##_callback( const CCommandContext &context, const CCommand &args )
#else #else
#define CON_COMMAND_SHARED( name, description ) \ #define CON_COMMAND_SHARED( name, description ) \
static ConCommandRefAbstract name##_ref; \ static ConCommandRefAbstract name##_ref; \
static void name##_callback( const CCommandContext &context, const CCommand &args ); \ static void name##_callback( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command( &name##_ref, #name, name##_callback, name, description ); \ static ConCommand name##_command( &name##_ref, #name, name##_callback, description ); \
static void name##_callback( const CCommandContext &context, const CCommand &args ) static void name##_callback( const CCommandContext &context, const CCommand &args )
#endif #endif