From c068f22329d5cc722622a2183bbb22eef2093df7 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 24 Aug 2026 11:16:07 +0200 Subject: initial import --- src/parsec_server/include/con_com_sv.h | 71 ++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/parsec_server/include/con_com_sv.h (limited to 'src/parsec_server/include/con_com_sv.h') diff --git a/src/parsec_server/include/con_com_sv.h b/src/parsec_server/include/con_com_sv.h new file mode 100644 index 0000000..9d75eb7 --- /dev/null +++ b/src/parsec_server/include/con_com_sv.h @@ -0,0 +1,71 @@ +/* + * PARSEC HEADER: con_com_sv.h + */ + +#ifndef _CON_COM_SV_H_ +#define _CON_COM_SV_H_ + + +// user commands table entry + +struct user_command_s { + + const char* command; // command string + short commlen; // length of string + short numparams; // num of parameters (used by tab-completion) + int (*execute)(char*); // command function + char* (*statedump)(); // returns statedump string; (NULL==volatile) +}; + + +// handle user commands not taking any parameters + +#define USERCOMMAND_NOPARAM(x) \ +{ \ + char *whsp = (x); \ + for ( ; *whsp; whsp++ ) \ + if ( *whsp != ' ' ) \ + break; \ + if ( *whsp != 0 ) { \ + if ( *(x) == ' ' ) { \ + CON_AddLine( dont_use_params ); \ + return TRUE; \ + } else { \ + return FALSE; \ + } \ + } \ +} \ + + +// macro to retrieve user command strings +#define USRSTR(x) (user_commands[x].command) + +// macro to retrieve string length of user commmands +#define USRLEN(x) (user_commands[x].commlen) + +// macro to determine number of arguments of user commmands +#define USRARG(x) (user_commands[x].numparams) + + +// external variables + +extern user_command_s* user_commands; +extern int num_user_commands; +extern char dont_use_params[]; + + +// external functions + +void CheckPlayerName( const char *name ); + +int CheckCmdsNoParam( char *command ); +int CheckCmdsCustomString( char *command ); +int CheckCmdsUserDefined( char *command ); + +int CON_RegisterUserCommand( user_command_s *regcom ); +int CON_ReplaceUserCommand( user_command_s* repcom ); + + +#endif // _CON_COM_SV_H_ + + -- cgit v1.2.3