diff --git a/src/g_inventory/a_pickups.cpp b/src/g_inventory/a_pickups.cpp index 20f6b9f48..da49bcab9 100644 --- a/src/g_inventory/a_pickups.cpp +++ b/src/g_inventory/a_pickups.cpp @@ -260,11 +260,11 @@ DEFINE_ACTION_FUNCTION(AInventory, DoRespawn) // //=========================================================================== -bool AInventory::CallTryPickup(AActor *toucher, AActor **toucher_return) +bool CallTryPickup(AInventory *item, AActor *toucher, AActor **toucher_return) { static VMFunction *func = nullptr; if (func == nullptr) PClass::FindFunction(&func, NAME_Inventory, NAME_CallTryPickup); - VMValue params[2] = { (DObject*)this, toucher }; + VMValue params[2] = { (DObject*)item, toucher }; VMReturn ret[2]; int res; AActor *tret; diff --git a/src/g_inventory/a_pickups.h b/src/g_inventory/a_pickups.h index 9960d7a0c..aace9f571 100644 --- a/src/g_inventory/a_pickups.h +++ b/src/g_inventory/a_pickups.h @@ -73,8 +73,6 @@ public: virtual void Serialize(FSerializer &arc) override; virtual void Tick() override; - bool CallTryPickup(AActor *toucher, AActor **toucher_return = NULL); // Wrapper for script function. - void DepleteOrDestroy (); // virtual on the script side. bool DoRespawn(); @@ -98,4 +96,6 @@ public: FSoundIDNoInit PickupSound; }; +bool CallTryPickup(AInventory *item, AActor *toucher, AActor **toucher_return = nullptr); + #endif //__A_PICKUPS_H__ diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index b43fdd33c..62db8b13b 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -4150,7 +4150,7 @@ static bool DoRadiusGive(AActor *self, AActor *thing, PClassActor *item, int amo } gift->flags |= MF_DROPPED; gift->ClearCounters(); - if (!gift->CallTryPickup(thing)) + if (!CallTryPickup(gift, thing)) { gift->Destroy(); return false; diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 1d8c48055..69e726dc3 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -972,7 +972,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply item->IntVar(NAME_AmmoGive1) = 40; } item->flags |= MF_DROPPED; - if (!item->CallTryPickup(player->mo)) + if (!CallTryPickup(item, player->mo)) { item->Destroy(); takestuff = false; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 654e1f0ae..752dccd15 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -926,7 +926,7 @@ AInventory *AActor::GiveInventoryType (PClassActor *type) if (type != NULL) { item = static_cast(Spawn (type)); - if (!item->CallTryPickup (this)) + if (!CallTryPickup (item, this)) { item->Destroy (); return NULL; diff --git a/src/p_user.cpp b/src/p_user.cpp index 179819fd7..573a05992 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -980,7 +980,7 @@ void APlayerPawn::GiveDeathmatchInventory() if (key->special1 != 0) { key = (AInventory*)Spawn(PClassActor::AllActorClasses[i]); - if (!key->CallTryPickup (this)) + if (!CallTryPickup (key, this)) { key->Destroy (); }