From 653b135919a511184c8d000ad46b24a56f208996 Mon Sep 17 00:00:00 2001 From: Maikel de Vries Date: Tue, 22 Apr 2014 20:15:26 +0200 Subject: [PATCH] Move contents ejection on death after Death Call This allows the scripter to access the contents in OnClonkDeath and similar callbacks preventing solutions using effects or static variables. --- src/object/C4Object.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/object/C4Object.cpp b/src/object/C4Object.cpp index 7401b8872..b1cc8a20d 100644 --- a/src/object/C4Object.cpp +++ b/src/object/C4Object.cpp @@ -1121,8 +1121,6 @@ void C4Object::AssignDeath(bool fForced) ++Info->DeathCount; Info->Retire(); } - // Lose contents - while ((thing=Contents.GetObject())) thing->Exit(thing->GetX(),thing->GetY()); // Remove from crew/cursor/view C4Player *pPlr = ::Players.Get(Owner); if (pPlr) pPlr->ClearPointers(this, true); @@ -1132,11 +1130,12 @@ void C4Object::AssignDeath(bool fForced) // Engine script call C4AulParSet pars(C4VInt(iDeathCausingPlayer)); Call(PSF_Death, &pars); + // Lose contents + while ((thing=Contents.GetObject())) thing->Exit(thing->GetX(),thing->GetY()); // Update OCF. Done here because previously it would have been done in the next frame // Whats worse: Having the OCF change because of some unrelated script-call like // SetCategory, or slightly breaking compatibility? SetOCF(); - // Engine broadcast: relaunch player (in CR, this was called from clonk script. // Now, it is done for every crew member) if(pPlr)