Check that object is CT_AI before accessing AI-specific fields
Reactors call player_is_visible_from_object, but do not use the ai_info field. Add a check to use ai_info only when the object is actually a robot.
This commit is contained in:
parent
caeb94faef
commit
20f8deb62a
|
@ -479,7 +479,8 @@ int player_is_visible_from_object(object *objp, vms_vector *pos, fix field_of_vi
|
||||||
fvi_query fq;
|
fvi_query fq;
|
||||||
|
|
||||||
// Assume that robot's gun tip is in same segment as robot's center.
|
// Assume that robot's gun tip is in same segment as robot's center.
|
||||||
objp->ctype.ai_info.SUB_FLAGS &= ~SUB_FLAGS_GUNSEG;
|
if (objp->control_type == CT_AI)
|
||||||
|
objp->ctype.ai_info.SUB_FLAGS &= ~SUB_FLAGS_GUNSEG;
|
||||||
|
|
||||||
fq.p0 = pos;
|
fq.p0 = pos;
|
||||||
if ((pos->x != objp->pos.x) || (pos->y != objp->pos.y) || (pos->z != objp->pos.z)) {
|
if ((pos->x != objp->pos.x) || (pos->y != objp->pos.y) || (pos->z != objp->pos.z)) {
|
||||||
|
@ -490,7 +491,8 @@ int player_is_visible_from_object(object *objp, vms_vector *pos, fix field_of_vi
|
||||||
move_towards_segment_center(objp);
|
move_towards_segment_center(objp);
|
||||||
} else {
|
} else {
|
||||||
if (segnum != objp->segnum) {
|
if (segnum != objp->segnum) {
|
||||||
objp->ctype.ai_info.SUB_FLAGS |= SUB_FLAGS_GUNSEG;
|
if (objp->control_type == CT_AI)
|
||||||
|
objp->ctype.ai_info.SUB_FLAGS |= SUB_FLAGS_GUNSEG;
|
||||||
}
|
}
|
||||||
fq.startseg = segnum;
|
fq.startseg = segnum;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue