Try to make the readcmd builtin more robust (by erroring out if some command destroyed the qcvm during execution). Stop forceinfokey from spamming when the new value is unchanged.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5739 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2020-08-01 06:33:05 +00:00
parent 1d4535f5a1
commit 48d4e97515
2 changed files with 14 additions and 2 deletions

View File

@ -7202,6 +7202,7 @@ static void QCBUILTIN PF_readcmd (pubprogfuncs_t *prinst, struct globalvars_s *p
extern int sv_redirectedlang;
redirect_t old;
int oldl;
int spawncount = svs.spawncount;
s = PR_GetStringOfs(prinst, OFS_PARM0);
@ -7219,6 +7220,9 @@ static void QCBUILTIN PF_readcmd (pubprogfuncs_t *prinst, struct globalvars_s *p
G_INT(OFS_RETURN) = (int)PR_TempString(prinst, sv_redirected_buf);
SV_EndRedirect();
if (svs.spawncount != spawncount || sv.state < ss_loading || prinst != sv.world.progs)
Host_EndGame("PF_readcmd: map changed during reading\n");
if (old != RD_NONE)
SV_BeginRedirect(old, oldl);
}
@ -9564,8 +9568,13 @@ static void QCBUILTIN PF_te_plasmaburn(pubprogfuncs_t *prinst, struct globalvars
int PF_ForceInfoKey_Internal(unsigned int entnum, const char *key, const char *value, size_t valsize)
{
const char *oldval;
size_t oldsize;
if (entnum == 0)
{ //serverinfo
oldval = InfoBuf_BlobForKey(&svs.info, key, &oldsize, NULL);
if (oldsize == valsize && !memcmp(oldval, value, valsize))
return 2; //unchanged
InfoBuf_SetStarBlobKey(&svs.info, key, value, valsize);
return 2;
}
@ -9576,6 +9585,10 @@ int PF_ForceInfoKey_Internal(unsigned int entnum, const char *key, const char *v
Con_DPrintf("PF_ForceInfoKey: inactive client\n");
return 0;
}
oldval = InfoBuf_BlobForKey(&svs.clients[entnum-1].userinfo, key, &oldsize, NULL);
if (oldsize == valsize && !memcmp(oldval, value, valsize))
return 1; //unchanged
if (InfoBuf_SetStarBlobKey(&svs.clients[entnum-1].userinfo, key, value, valsize))
{
SV_ExtractFromUserinfo (&svs.clients[entnum-1], false);

View File

@ -2544,11 +2544,10 @@ void SV_User_f (void)
"OLD vweap", "q2bsp", "q3bsp", "colormod", "splitscreen", "hexen2", "spawnstatic2", "customtempeffects",
"packents", "UNKNOWN", "showpic", "setattachment","UNKNOWN", "chunkeddls", "csqc", "dpflags"};
static const char *pext2names[32] = { "prydoncursor", "voip", "setangledelta", "rplcdeltas", "maxplayers", "predinfo", "sizeenc", "infoblobs",
"UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN",
"stunaware", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN",
"UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN",
"UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN"};
if (Cmd_Argc() != 2)
{
Con_TPrintf ("Usage: info <userid>\n");