mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 07:41:22 +00:00
Fix A_CheckProximity setting pointer to dead things when it shouldn't.
When using A_CheckProximity with CPXF_SETTARGET, the target pointer could be set to a dead monster even without the CPXF_COUNTDEAD and CPXF_DEADONLY flags. This is becuase the check for death would occur after setting the pointer. Fix simply moves death check to occur before setting pointers.
This commit is contained in:
parent
bbea0ee4a1
commit
3b20c26275
1 changed files with 10 additions and 10 deletions
|
@ -756,6 +756,16 @@ int P_Thing_CheckProximity(AActor *self, PClass *classname, double distance, int
|
||||||
if ((flags & CPXF_CHECKSIGHT) && !(P_CheckSight(mo, ref, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY)))
|
if ((flags & CPXF_CHECKSIGHT) && !(P_CheckSight(mo, ref, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (mo->flags6 & MF6_KILLED)
|
||||||
|
{
|
||||||
|
if (!(flags & (CPXF_COUNTDEAD | CPXF_DEADONLY)))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (flags & CPXF_DEADONLY)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (ptrWillChange)
|
if (ptrWillChange)
|
||||||
{
|
{
|
||||||
current = ref->Distance2D(mo);
|
current = ref->Distance2D(mo);
|
||||||
|
@ -773,16 +783,6 @@ int P_Thing_CheckProximity(AActor *self, PClass *classname, double distance, int
|
||||||
else if (!dist)
|
else if (!dist)
|
||||||
dist = mo; // Just get the first one and call it quits if there's nothing selected.
|
dist = mo; // Just get the first one and call it quits if there's nothing selected.
|
||||||
}
|
}
|
||||||
if (mo->flags6 & MF6_KILLED)
|
|
||||||
{
|
|
||||||
if (!(flags & (CPXF_COUNTDEAD | CPXF_DEADONLY)))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (flags & CPXF_DEADONLY)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
// Abort if the number of matching classes nearby is greater, we have obviously succeeded in our goal.
|
// Abort if the number of matching classes nearby is greater, we have obviously succeeded in our goal.
|
||||||
|
|
Loading…
Reference in a new issue