diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2026-08-24 11:16:07 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2026-08-24 11:16:07 +0200 |
| commit | c068f22329d5cc722622a2183bbb22eef2093df7 (patch) | |
| tree | 12d56c1aede67988a55e241364606bfbb4dba933 /src/parsec_server/include/con_com_sv.h | |
| download | openparsec-main.tar.xz openparsec-main.zip | |
Diffstat (limited to 'src/parsec_server/include/con_com_sv.h')
| -rw-r--r-- | src/parsec_server/include/con_com_sv.h | 71 |
1 files changed, 71 insertions, 0 deletions
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_ + + |
