A few fixes from q2dos

This commit is contained in:
Daniel Gibson 2016-02-20 18:20:20 +01:00
parent 3fabd3c09c
commit 2bcbd86a61
3 changed files with 26 additions and 5 deletions

View file

@ -684,8 +684,10 @@ void SV_Physics_Pusher (edict_t *ent)
break; // move was blocked
}
}
if (pushed_p > &pushed[MAX_EDICTS])
gi.error (ERR_FATAL, "pushed_p > &pushed[MAX_EDICTS], memory corrupted");
if (pushed_p > &pushed[MAX_EDICTS-1])
{
gi.error (ERR_FATAL, "pushed_p > &pushed[MAX_EDICTS-1], memory corrupted");
}
if (part)
{

View file

@ -310,10 +310,10 @@ vec3_t corners[2];
int
BoxOnPlaneSide2(vec3_t emins, vec3_t emaxs, struct cplane_s *p)
{
int i;
//int i; // DG: I think it's supposed to write to the global!
float dist1, dist2;
int sides;
vec3_t corners[2];
//vec3_t corners[2]; // DG: ditto
for (i = 0; i < 3; i++)
{
@ -680,6 +680,12 @@ COM_FileBase(char *in, char *out)
{
char *s, *s2;
if(!in[0])
{
out[0] = '\0';
return;
}
s = in + strlen(in) - 1;
while (s != in && *s != '.')
@ -711,6 +717,12 @@ COM_FilePath(const char *in, char *out)
{
const char *s;
if(!in[0])
{
out[0] = '\0';
return;
}
s = in + strlen(in) - 1;
while (s != in && *s != '/')
@ -727,6 +739,11 @@ COM_DefaultExtension(char *path, const char *extension)
{
char *src;
if(!path[0])
{
return;
}
/* */
/* if path doesn't have a .EXT, append extension */
/* (extension should include the .) */

View file

@ -171,6 +171,7 @@ void tripbomb_laser_think (edict_t *self)
// randomly phase out or EMPNuke is in effect
if (EMPNukeCheck(self, self->s.origin) || random() < 0.1)
{
self->svflags |= SVF_NOCLIENT;
return;
}
@ -1045,9 +1046,10 @@ void fire_sniper_bullet (edict_t *self, vec3_t start, vec3_t aimdir, int damage,
vec3_t end;
vec3_t s;
edict_t *ignore = self;
int i = 0;
VectorMA (start, 8192, aimdir, end);
VectorCopy(start, s);
while(1)
for(i=0;i<256;++i) // DG: prevent infinite loop (adapted from q2dos)
{
tr = gi.trace (s, NULL, NULL, end, ignore, MASK_SHOT_NO_WINDOW);
if (tr.fraction >= 1.0)