Investigated PVS report for g_turret and fixed uninitialized variable access

This commit is contained in:
BjossiAlfreds 2019-09-23 22:15:01 +00:00
parent 32419b8d3f
commit 03800dfcd5

View file

@ -597,7 +597,6 @@ SP_turret_driver(edict_t *self)
void void
turret_brain_think(edict_t *self) turret_brain_think(edict_t *self)
{ {
vec3_t target;
vec3_t dir; vec3_t dir;
vec3_t endpos; vec3_t endpos;
float reaction_time; float reaction_time;
@ -631,6 +630,9 @@ turret_brain_think(edict_t *self)
self->monsterinfo.trail_time = level.time; self->monsterinfo.trail_time = level.time;
self->monsterinfo.aiflags &= ~AI_LOST_SIGHT; self->monsterinfo.aiflags &= ~AI_LOST_SIGHT;
VectorAdd(self->enemy->absmax, self->enemy->absmin, endpos);
VectorScale(endpos, 0.5, endpos);
} }
else else
{ {
@ -656,8 +658,7 @@ turret_brain_think(edict_t *self)
} }
/* let the turret know where we want it to aim */ /* let the turret know where we want it to aim */
VectorCopy(endpos, target); VectorSubtract(endpos, self->target_ent->s.origin, dir);
VectorSubtract(target, self->target_ent->s.origin, dir);
vectoangles(dir, self->target_ent->move_angles); vectoangles(dir, self->target_ent->move_angles);
/* decide if we should shoot */ /* decide if we should shoot */