blob: 9d75eb7bb87a7ee2c7cb5933eb35ae08477343aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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_
|