forked from haithun/CoD4X17a_testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd.h
108 lines (86 loc) · 3.58 KB
/
cmd.h
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
===========================================================================
Copyright (C) 2010-2013 Ninja and TheKelm of the IceOps-Team
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of CoD4X17a-Server source code.
CoD4X17a-Server source code is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
CoD4X17a-Server source code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
===========================================================================
*/
#ifndef __CMD_H__
#define __CMD_H__
#include "q_shared.h"
// paramters for command buffer stuffing
typedef enum {
EXEC_NOW, // don't return until completed, a VM should NEVER use this,
// because some commands might cause the VM to be unloaded...
EXEC_INSERT, // insert at current position, but don't run yet
EXEC_APPEND // add to end of the command buffer (normal case)
} cbufExec_t;
#define MAX_CMD_BUFFER 16384
#define MAX_CMD_LINE 1024
/*
typedef struct {
byte *data;
int maxsize;
int cursize;
} cmd_t;
int cmd_wait;
cmd_t cmd_text;
byte cmd_text_buf[MAX_CMD_BUFFER];
*/
typedef void *xcommand_t;
typedef void (*completionFunc_t)( char *args, int argNum );
typedef struct cmd_function_s
{
struct cmd_function_s *next;
char *name;
int minPower;
completionFunc_t complete;
xcommand_t function;
} cmd_function_t;
//static int cmd_argc;
//static char *cmd_argv[MAX_STRING_TOKENS]; // points into cmd_tokenized
//static char cmd_tokenized[BIG_INFO_STRING + MAX_STRING_TOKENS]; // will have 0 bytes inserted
//static char cmd_cmd[BIG_INFO_STRING]; // the original command we received (no token processing)
#define MAX_POWERLIST 256
void __cdecl Cmd_Init(void);
void __cdecl Cmd_TokenizeString(const char* string);
void __cdecl SV_Cmd_TokenizeString(const char* string);
void __cdecl Cmd_EndTokenizeString();
void __cdecl SV_Cmd_EndTokenizeString();
void __cdecl Cmd_ExecuteSingleCommand(int unk, int unk2, const char *cmd );
void __cdecl Cbuf_Init(void);
void __cdecl Cbuf_Execute(int, int);
void __cdecl Cbuf_ExecuteBuffer(int, int, char* buf);
void __cdecl Cbuf_AddText(int dummy, const char* text);
qboolean Cmd_AddCommand( const char *cmd_name, xcommand_t function );
qboolean Cmd_RemoveCommand( const char *cmd_name );
qboolean Cmd_SetPower(const char *cmd_name, int power);
int Cmd_GetPower(const char *cmd_name);
void Cmd_ResetPower();
int SV_Cmd_Argc( void );
int Cmd_Argc( void );
char *SV_Cmd_Argv( int arg );
void SV_Cmd_ArgvBuffer( int arg, char *buffer, int bufferLength );
char *Cmd_Argv( int arg );
char *Cmd_Args( char* buff, int bufsize );
char *Cmd_Argsv( int arg, char* buff, int bufsize );
void Cmd_CommandCompletion( void(*callback)(const char *s) );
void Cmd_CompleteArgument( const char *command, char *args, int argNum );
void Cmd_SetCommandCompletionFunc( const char *command, completionFunc_t complete );
void Cmd_AddCommands(void);
void Cmd_WritePowerConfig(char* buffer, int size);
qboolean Cmd_InfoSetPower( const char *infostring );
void Cmd_Vstr_f(void);
void Cmd_Wait_f(void);
void Cmd_Exec_f(void);
#endif