Fixed rcon crash, fixed extreemly slow download speed (drate was bad).

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@786 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-01-16 00:59:48 +00:00
parent 61a0b39953
commit 4341984aa6
5 changed files with 41 additions and 22 deletions

View File

@ -1228,7 +1228,7 @@ qboolean PR_UserCmd(char *s)
#ifdef Q2SERVER
if (ge)
{
SV_BeginRedirect (RD_CLIENT);
SV_BeginRedirect (RD_CLIENT, host_client->language);
ge->ClientCommand(host_client->q2edict);
SV_EndRedirect ();
return true; //the dll will convert it to chat.
@ -1656,7 +1656,7 @@ Writes new values for v_forward, v_up, and v_right based on angles
makevectors(vector)
==============
*/
void PF_makevectors (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void PF_makevectors (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
AngleVectors (G_VECTOR(OFS_PARM0), P_VEC(v_forward), P_VEC(v_right), P_VEC(v_up));
}
@ -1759,7 +1759,7 @@ void PF_setmodel (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
}
}
e->v.model = PR_SetString(prinst, sv.model_precache[i]);
e->v.modelindex = i;
@ -5924,7 +5924,9 @@ void PF_readcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static char output[8000];
extern char outputbuf[];
extern redirect_t sv_redirected;
extern int sv_redirectedlang;
redirect_t old;
int oldl;
s = PR_GetStringOfs(prinst, OFS_PARM0);
@ -5932,16 +5934,17 @@ void PF_readcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
Cbuf_AddText (s, RESTRICT_LOCAL);
old = sv_redirected;
oldl = sv_redirectedlang;
if (old != RD_NONE)
SV_EndRedirect();
SV_BeginRedirect(RD_OBLIVION);
SV_BeginRedirect(RD_OBLIVION, LANGDEFAULT);
Cbuf_Execute();
Q_strncpyz(output, outputbuf, sizeof(output));
SV_EndRedirect();
if (old != RD_NONE)
SV_BeginRedirect(old);
SV_BeginRedirect(old, oldl);
G_INT(OFS_RETURN) = (int)PR_SetString(prinst, output);

View File

@ -900,8 +900,8 @@ void SVM_Think(int port);
//
// svonly.c
//
typedef enum {RD_NONE, RD_CLIENT, RD_PACKET, RD_OBLIVION} redirect_t;
void SV_BeginRedirect (redirect_t rd);
typedef enum {RD_NONE, RD_CLIENT, RD_PACKET, RD_OBLIVION} redirect_t; //oblivion is provided so people can read the output before the buffer is wiped.
void SV_BeginRedirect (redirect_t rd, int lang);
void SV_EndRedirect (void);
//

View File

@ -650,7 +650,7 @@ void SVC_Status (void)
int slots=0;
Cmd_TokenizeString ("status", false, false);
SV_BeginRedirect (RD_PACKET);
SV_BeginRedirect (RD_PACKET, LANGDEFAULT);
Con_Printf ("%s\n", svs.info);
for (i=0 ; i<MAX_CLIENTS ; i++)
{
@ -1882,7 +1882,7 @@ void SVC_RemoteCommand (void)
Con_Printf ("Rcon from %s:\n%s\n"
, NET_AdrToString (net_from), net_message.data+4);
SV_BeginRedirect (RD_PACKET);
SV_BeginRedirect (RD_PACKET, LANGDEFAULT);
remaining[0] = 0;
@ -1910,7 +1910,7 @@ void SVC_RemoteCommand (void)
Con_Printf ("Bad rcon from %s:\n%s\n"
, NET_AdrToString (net_from), net_message.data+4);
SV_BeginRedirect (RD_PACKET);
SV_BeginRedirect (RD_PACKET, LANGDEFAULT);
Con_Printf ("Bad rcon_password.\n");
@ -1921,7 +1921,7 @@ void SVC_RemoteCommand (void)
Con_Printf ("Rcon from %s:\n%s\n"
, NET_AdrToString (net_from), net_message.data+4);
SV_BeginRedirect (RD_PACKET);
SV_BeginRedirect (RD_PACKET, LANGDEFAULT);
remaining[0] = 0;
@ -3043,6 +3043,10 @@ void SV_InitLocal (void)
svs.fteprotocolextensions |= PEXT_SHOWPIC;
svs.fteprotocolextensions |= PEXT_SETATTACHMENT;
#ifdef PEXT_CHUNKEDDOWNLOADS
svs.fteprotocolextensions |= PEXT_CHUNKEDDOWNLOADS;
#endif
// if (svs.protocolextensions)
// Info_SetValueForStarKey (svs.info, "*"DISTRIBUTION"_ext", va("%x", svs.protocolextensions), MAX_SERVERINFO_STRING);
@ -3349,7 +3353,7 @@ void SV_ExtractFromUserinfo (client_t *cl)
if (strlen(val))
cl->drate = atoi(val);
else
cl->drate = 2500;
cl->drate = cl->rate;
// msg command
val = Info_ValueForKey (cl->userinfo, "msg");

View File

@ -40,6 +40,7 @@ Con_Printf redirection
char outputbuf[8000];
redirect_t sv_redirected;
int sv_redirectedlang;
extern func_t getplayerstat[MAX_CL_STATS];
extern func_t getplayerstati[MAX_CL_STATS];
@ -108,15 +109,17 @@ SV_BeginRedirect
instead of the console
==================
*/
void SV_BeginRedirect (redirect_t rd)
void SV_BeginRedirect (redirect_t rd, int lang)
{
sv_redirected = rd;
sv_redirectedlang = lang;
outputbuf[0] = 0;
}
void SV_EndRedirect (void)
{
SV_FlushRedirect ();
sv_redirectedlang = 0; //clenliness rather than functionality. Shouldn't be needed.
sv_redirected = RD_NONE;
}
@ -165,7 +168,7 @@ void Con_TPrintf (translation_t stringnum, ...)
// add to redirected message
if (sv_redirected)
{
fmt = languagetext[stringnum][host_client->language];
fmt = languagetext[stringnum][sv_redirectedlang];
va_start (argptr,stringnum);
_vsnprintf (msg,sizeof(msg)-1, fmt,argptr);
va_end (argptr);
@ -701,13 +704,22 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
qboolean reliable = false;
if (volume < 0 || volume > 255)
SV_Error ("SV_StartSound: volume = %i", volume);
{
Con_Printf ("SV_StartSound: volume = %i", volume);
return;
}
if (attenuation < 0 || attenuation > 4)
SV_Error ("SV_StartSound: attenuation = %f", attenuation);
{
Con_Printf ("SV_StartSound: attenuation = %f", attenuation);
return;
}
if (channel < 0 || channel > 15)
SV_Error ("SV_StartSound: channel = %i", channel);
{
Con_Printf ("SV_StartSound: channel = %i", channel);
return;
}
// find precache number for sound
for (sound_num=1 ; sound_num<MAX_SOUNDS

View File

@ -2836,7 +2836,7 @@ void SV_ExecuteUserCommand (char *s, qboolean fromQC)
host_client = oldhost;
return;
}
SV_BeginRedirect (RD_CLIENT);
SV_BeginRedirect (RD_CLIENT, host_client->language);
u->func ();
host_client = oldhost;
SV_EndRedirect ();
@ -2867,7 +2867,7 @@ void SV_ExecuteUserCommand (char *s, qboolean fromQC)
Con_Printf ("cmd from %s:\n%s\n"
, host_client->name, net_message.data+4);
SV_BeginRedirect (RD_CLIENT);
SV_BeginRedirect (RD_CLIENT, host_client->language);
remaining[0] = 0;
@ -3278,13 +3278,13 @@ void SVNQ_ExecuteUserCommand (char *s)
if (!u->func)
{
SV_BeginRedirect (RD_CLIENT);
SV_BeginRedirect (RD_CLIENT, host_client->language);
Con_Printf("Command was disabled\n");
SV_EndRedirect ();
}
else
{
SV_BeginRedirect (RD_CLIENT);
SV_BeginRedirect (RD_CLIENT, host_client->language);
u->func ();
SV_EndRedirect ();
}
@ -3810,7 +3810,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
movevars.ktjump = pm_ktjump.value;
movevars.slidefix = (pm_slidefix.value != 0);
movevars.airstep = (pm_airstep.value != 0);
movevars.walljump = (pm_walljump.value != 0);
movevars.walljump = (pm_walljump.value);
if (sv_player->v.hasted)
movevars.maxspeed*=sv_player->v.hasted;