mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
small cmd.c changes for plugins
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@241 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
52850efb87
commit
c3cc229964
1 changed files with 3 additions and 85 deletions
|
@ -992,7 +992,6 @@ void Cmd_ShiftArgs (int ammount)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ZQUAKETEAMPLAY
|
||||
/*
|
||||
================
|
||||
Cmd_ExpandString
|
||||
|
@ -1108,90 +1107,6 @@ char *Cmd_ExpandString (char *data, char *dest, int destlen, int maxaccesslevel)
|
|||
return dest;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_ExpandString
|
||||
|
||||
Returns a string with all expanded macros.
|
||||
============
|
||||
*/
|
||||
char *Cmd_ExpandString (char *input, int maxaccesslevel)
|
||||
{
|
||||
static unsigned char buffer[8192];
|
||||
unsigned char *s;
|
||||
int c, len;
|
||||
|
||||
Q_strncpyz(buffer, input, sizeof(buffer));
|
||||
|
||||
len = strlen(buffer);
|
||||
|
||||
//we check for macros.
|
||||
for (s = buffer, c= 0; c < len; c++, s++) //this isn't a quoted token by the way.
|
||||
{
|
||||
if (*s == '$')
|
||||
{
|
||||
cvar_t *cvar;
|
||||
char *macro;
|
||||
char name[64];
|
||||
int i;
|
||||
|
||||
for (i = 1; i < sizeof(name); i++)
|
||||
{
|
||||
if (s[i] <= ' ' || s[i] == '$' || s[i] == '\"')
|
||||
break;
|
||||
}
|
||||
|
||||
Q_strncpyz(name, s+1, i);
|
||||
i-=1;
|
||||
name[i] = '\0';
|
||||
|
||||
if (!*name)
|
||||
{
|
||||
memmove(buffer+c, buffer+c+1, len-c);
|
||||
c--;
|
||||
len--;
|
||||
}
|
||||
else
|
||||
while(*name)
|
||||
{
|
||||
cvar = Cvar_FindVar(name);
|
||||
if (cvar && (cvar->restriction?cvar->restriction:rcon_level.value) <= maxaccesslevel) //got one...
|
||||
{
|
||||
memmove(s+strlen(cvar->string), s+i+1, len-c-i);
|
||||
Q_strncpyS(s, cvar->string, strlen(cvar->string));
|
||||
s+=strlen(cvar->string);
|
||||
len+=strlen(cvar->string)-(i+1);
|
||||
break;
|
||||
}
|
||||
if (maxaccesslevel == RESTRICT_LOCAL) //don't expand without full rights. (prevents a few loopholes)
|
||||
{
|
||||
macro = TP_MacroString(name, NULL);
|
||||
if (macro)
|
||||
{
|
||||
memmove(s+strlen(macro), s+i+1, len-c-i);
|
||||
Q_strncpyS(s, macro, strlen(macro));
|
||||
s+=strlen(macro);
|
||||
len+=strlen(macro)-(i+1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
i--;
|
||||
name[i] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(buffer) >= sizeof(buffer))
|
||||
Sys_Error("Buffer was too small\n");
|
||||
|
||||
return (char *)buffer;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_TokenizeString
|
||||
|
@ -1745,6 +1660,9 @@ void Cmd_ExecuteString (char *text, int level)
|
|||
return;
|
||||
}
|
||||
|
||||
if (Plugin_ExecuteString())
|
||||
return;
|
||||
|
||||
#ifndef CLIENTONLY
|
||||
if (sv.state)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue