1
0
Fork 0
forked from fte/fteqw

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 #ifdef Q2SERVER
if (ge) if (ge)
{ {
SV_BeginRedirect (RD_CLIENT); SV_BeginRedirect (RD_CLIENT, host_client->language);
ge->ClientCommand(host_client->q2edict); ge->ClientCommand(host_client->q2edict);
SV_EndRedirect (); SV_EndRedirect ();
return true; //the dll will convert it to chat. 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) 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)); AngleVectors (G_VECTOR(OFS_PARM0), P_VEC(v_forward), P_VEC(v_right), P_VEC(v_up));
} }
@ -5924,7 +5924,9 @@ void PF_readcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static char output[8000]; static char output[8000];
extern char outputbuf[]; extern char outputbuf[];
extern redirect_t sv_redirected; extern redirect_t sv_redirected;
extern int sv_redirectedlang;
redirect_t old; redirect_t old;
int oldl;
s = PR_GetStringOfs(prinst, OFS_PARM0); 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); Cbuf_AddText (s, RESTRICT_LOCAL);
old = sv_redirected; old = sv_redirected;
oldl = sv_redirectedlang;
if (old != RD_NONE) if (old != RD_NONE)
SV_EndRedirect(); SV_EndRedirect();
SV_BeginRedirect(RD_OBLIVION); SV_BeginRedirect(RD_OBLIVION, LANGDEFAULT);
Cbuf_Execute(); Cbuf_Execute();
Q_strncpyz(output, outputbuf, sizeof(output)); Q_strncpyz(output, outputbuf, sizeof(output));
SV_EndRedirect(); SV_EndRedirect();
if (old != RD_NONE) if (old != RD_NONE)
SV_BeginRedirect(old); SV_BeginRedirect(old, oldl);
G_INT(OFS_RETURN) = (int)PR_SetString(prinst, output); G_INT(OFS_RETURN) = (int)PR_SetString(prinst, output);

View file

@ -900,8 +900,8 @@ void SVM_Think(int port);
// //
// svonly.c // svonly.c
// //
typedef enum {RD_NONE, RD_CLIENT, RD_PACKET, RD_OBLIVION} redirect_t; 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); void SV_BeginRedirect (redirect_t rd, int lang);
void SV_EndRedirect (void); void SV_EndRedirect (void);
// //

View file

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

View file

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

View file

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