- fixed: The distance check in A_RadiusGive could overflow for large distances.

This commit is contained in:
Christoph Oelckers 2015-03-15 09:51:57 +01:00
parent cf579e4c77
commit 16ad440adb

View file

@ -5068,9 +5068,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
if (flags & RGF_CUBE)
{ // check if inside a cube
if (abs(thing->x - self->x) > distance ||
abs(thing->y - self->y) > distance ||
abs((thing->z + thing->height/2) - (self->z + self->height/2)) > distance)
if (fabs((double)thing->x - self->x) > (double)distance ||
fabs((double)thing->y - self->y) > (double)distance ||
fabs((double)(thing->z + thing->height/2) - (self->z + self->height/2)) > (double)distance)
{
continue;
}
@ -5084,7 +5084,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
continue;
}
}
fixed_t dz = abs ((thing->z + thing->height/2) - (self->z + self->height/2));
if ((flags & RGF_NOSIGHT) || P_CheckSight (thing, self, SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY))
{ // OK to give; target is in direct path, or the monster doesn't care about it being in line of sight.