From 23a4daac23ed864961b769d5d6fb0fe139beb802 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 11 Jul 2018 17:26:09 +0300 Subject: [PATCH] - skipped owned items in proximity test https://forum.zdoom.org/viewtopic.php?t=61224 --- src/p_things.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/p_things.cpp b/src/p_things.cpp index 2f5bd5555..4012a5872 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -737,6 +737,15 @@ int P_Thing_CheckProximity(AActor *self, PClass *classname, double distance, int else if (classname != mo->GetClass()) continue; + if (mo->IsKindOf(RUNTIME_CLASS(AInventory))) + { + // Skip owned item because its position could remain unchanged since attachment to owner + // Most likely it is the last location of this item in the world before pick up + AInventory *const inventory = static_cast(mo); + if (inventory != nullptr && inventory->Owner != nullptr) + continue; + } + // [MC]Make sure it's in range and respect the desire for Z or not. The function forces it to use // Z later for ensuring CLOSEST and FARTHEST flags are respected perfectly. // Ripped from sphere checking in A_RadiusGive (along with a number of things).