CSQC_Parse_StuffCmd was not being passed the newline chars properly (resulting in localcmd-based corruption).

This commit is contained in:
Shpoike 2023-07-20 15:01:18 +01:00
parent 3fb6be5d16
commit 4c5b960d45

View file

@ -2316,6 +2316,7 @@ static void CL_ParseStuffText(const char *msg)
PR_SwitchQCVM(&cl.qcvm); PR_SwitchQCVM(&cl.qcvm);
tmp = PR_GetTempString(); tmp = PR_GetTempString();
memcpy(tmp, cl.stuffcmdbuf, str-cl.stuffcmdbuf); memcpy(tmp, cl.stuffcmdbuf, str-cl.stuffcmdbuf);
tmp[str-cl.stuffcmdbuf-1] = '\n'; //put the terminator back, for lazy localcmds.
tmp[str-cl.stuffcmdbuf] = 0; //null terminate it. tmp[str-cl.stuffcmdbuf] = 0; //null terminate it.
G_INT(OFS_PARM0) = PR_SetEngineString(tmp); G_INT(OFS_PARM0) = PR_SetEngineString(tmp);
PR_ExecuteProgram(cl.qcvm.extfuncs.CSQC_Parse_StuffCmd); PR_ExecuteProgram(cl.qcvm.extfuncs.CSQC_Parse_StuffCmd);