mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
- add some comments to libs/console/inputline.c
- rename pr_deadbeef to pr_deadbeef_ents - add pr_deadbeef_locals, which does uninited locals. (crashes from it are undeniably buggy code, unlike pr_deadeef_ents) - add a missing break to packetlog printing's switch - add sv_kickfake, which kicks people for attempting to fake messages, or replaces the ^Ms with # if disabled.
This commit is contained in:
parent
ea966952be
commit
a159e852e6
5 changed files with 32 additions and 10 deletions
|
@ -124,7 +124,7 @@ Con_ProcessInputLine (inputline_t *il, int ch)
|
|||
{
|
||||
int j = (il->history_line + il->num_lines - 1) % il->num_lines;
|
||||
if (j == il->edit_line || !il->lines[j][1])
|
||||
break;
|
||||
break; // don't let it wrap
|
||||
il->history_line = j;
|
||||
}
|
||||
strcpy (il->lines[il->edit_line], il->lines[il->history_line]);
|
||||
|
@ -132,7 +132,7 @@ Con_ProcessInputLine (inputline_t *il, int ch)
|
|||
break;
|
||||
case K_DOWN:
|
||||
if (il->history_line == il->edit_line)
|
||||
break;
|
||||
break; // don't let it wrap
|
||||
il->history_line = (il->history_line + 1) % il->num_lines;
|
||||
if (il->history_line == il->edit_line) {
|
||||
il->lines[il->edit_line][0] = ']';
|
||||
|
|
|
@ -52,7 +52,8 @@
|
|||
#include "QF/vfs.h"
|
||||
|
||||
cvar_t *pr_boundscheck;
|
||||
cvar_t *pr_deadbeef;
|
||||
cvar_t *pr_deadbeef_ents;
|
||||
cvar_t *pr_deadbeef_locals;
|
||||
|
||||
int type_size[8] = {
|
||||
1,
|
||||
|
@ -192,7 +193,7 @@ ED_Free (progs_t * pr, edict_t *ed)
|
|||
if (pr->unlink)
|
||||
pr->unlink (ed); // unlink from world bsp
|
||||
|
||||
if (pr_deadbeef->int_val) {
|
||||
if (pr_deadbeef_ents->int_val) {
|
||||
ED_ClearEdict (pr, ed, 0xdeadbeef);
|
||||
} else {
|
||||
if (pr->free_edict)
|
||||
|
@ -1371,7 +1372,7 @@ PR_InitEdicts (progs_t *pr, int num_edicts)
|
|||
pr->pr_edictareasize = pr->pr_edict_size * num_edicts;
|
||||
edicts = Hunk_AllocName (pr->pr_edictareasize, "edicts");
|
||||
(*pr->edicts) = edicts;
|
||||
if (pr_deadbeef->int_val) {
|
||||
if (pr_deadbeef_ents->int_val) {
|
||||
memset (edicts, 0, *pr->reserved_edicts * pr->pr_edict_size);
|
||||
for (j = *pr->reserved_edicts; j < num_edicts; j++) {
|
||||
e = EDICT_NUM (pr, j);
|
||||
|
@ -1390,8 +1391,11 @@ PR_Init_Cvars (void)
|
|||
pr_boundscheck =
|
||||
Cvar_Get ("pr_boundscheck", "1", CVAR_NONE, NULL,
|
||||
"Server progs bounds checking");
|
||||
pr_deadbeef = Cvar_Get ("pr_deadbeef", "0", CVAR_NONE, NULL,
|
||||
pr_deadbeef_ents = Cvar_Get ("pr_deadbeef_ents", "0", CVAR_NONE, NULL,
|
||||
"set to clear unallocated memory to 0xdeadbeef");
|
||||
pr_deadbeef_locals = Cvar_Get ("pr_deadbeef_locals", "0", CVAR_NONE, NULL,
|
||||
"set to clear uninitialized local vars to "
|
||||
"0xdeadbeef");
|
||||
PR_Debug_Init_Cvars ();
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include "compat.h"
|
||||
|
||||
extern cvar_t *pr_deadbeef;
|
||||
extern cvar_t *pr_deadbeef_locals;
|
||||
|
||||
|
||||
void
|
||||
|
@ -183,6 +183,7 @@ int
|
|||
PR_EnterFunction (progs_t * pr, dfunction_t *f)
|
||||
{
|
||||
int i, j, c, o;
|
||||
int k;
|
||||
|
||||
//printf("%s:\n", PR_GetString(pr,f->s_name));
|
||||
pr->pr_stack[pr->pr_depth].s = pr->pr_xstatement;
|
||||
|
@ -201,9 +202,9 @@ PR_EnterFunction (progs_t * pr, dfunction_t *f)
|
|||
sizeof (pr_type_t) * c);
|
||||
pr->localstack_used += c;
|
||||
|
||||
// if (pr_deadbeef->int_val)
|
||||
// for (k = f->parm_start; k < f->parm_start + c; k++)
|
||||
// pr->pr_globals[k].integer_var = 0xdeadbeef;
|
||||
if (pr_deadbeef_locals->int_val)
|
||||
for (k = f->parm_start; k < f->parm_start + c; k++)
|
||||
pr->pr_globals[k].integer_var = 0xdeadbeef;
|
||||
|
||||
// copy parameters
|
||||
o = f->parm_start;
|
||||
|
|
|
@ -456,6 +456,7 @@ Parse_Server_Packet ()
|
|||
switch (c) {
|
||||
case svc_bad:
|
||||
Net_LogPrintf (" - should not happen");
|
||||
break;
|
||||
case svc_nop:
|
||||
Net_LogPrintf (" No operation");
|
||||
break;
|
||||
|
|
|
@ -72,6 +72,8 @@ cvar_t *sv_timekick;
|
|||
cvar_t *sv_timekick_fuzz;
|
||||
cvar_t *sv_timekick_interval;
|
||||
|
||||
cvar_t *sv_kickfake;
|
||||
|
||||
extern cvar_t *sv_maxrate;
|
||||
|
||||
extern vec3_t player_mins;
|
||||
|
@ -788,6 +790,7 @@ SV_Say (qboolean team)
|
|||
char text[2048];
|
||||
char t1[32];
|
||||
const char *t2;
|
||||
char *i;
|
||||
|
||||
if (Cmd_Argc () < 2)
|
||||
return;
|
||||
|
@ -842,6 +845,17 @@ SV_Say (qboolean team)
|
|||
p[strlen (p) - 1] = 0;
|
||||
}
|
||||
|
||||
for (i = p; *i; i++)
|
||||
if (*i == 13) { // ^M
|
||||
if (sv_kickfake->int_val) {
|
||||
SV_BroadcastPrintf (PRINT_HIGH, "%s was kicked for attempting to fake messages\n", host_client->name);
|
||||
SV_ClientPrintf (host_client, PRINT_HIGH, "You were kicked for attempting to fake messages\n");
|
||||
SV_DropClient (host_client);
|
||||
return;
|
||||
} else
|
||||
*i = '#';
|
||||
}
|
||||
|
||||
strncat (text, p, sizeof (text) - strlen (text));
|
||||
strncat (text, "\n", sizeof (text) - strlen (text));
|
||||
|
||||
|
@ -1814,5 +1828,7 @@ SV_UserInit (void)
|
|||
"Toggles the ability of spectators to talk to players");
|
||||
sv_mapcheck = Cvar_Get ("sv_mapcheck", "1", CVAR_NONE, NULL,
|
||||
"Toggle the use of map checksumming to check for players who edit maps to cheat");
|
||||
sv_kickfake = Cvar_Get ("sv_kickfake", "1", CVAR_NONE, NULL,
|
||||
"Kick users sending to send fake talk messages");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue