- fixed parameter mixup with P_CanResurrect.

This commit is contained in:
Christoph Oelckers 2018-11-17 16:21:08 +01:00 committed by drfrag666
parent 17a33b609a
commit 40bd248da2
2 changed files with 6 additions and 6 deletions

View file

@ -2777,9 +2777,9 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
//========================================================================== //==========================================================================
// [MC] Code is almost a duplicate of CanCollideWith but with changes to // [MC] Code is almost a duplicate of CanCollideWith but with changes to
// accommodate checking of just one actor. // accommodate checking of just one actor.
bool P_CanResurrect(AActor *tmthing, AActor *thing) bool P_CanResurrect(AActor *raiser, AActor *thing)
{ {
if (tmthing == nullptr) if (raiser == nullptr)
return false; return false;
static unsigned VIndex = ~0u; static unsigned VIndex = ~0u;
@ -2789,12 +2789,12 @@ bool P_CanResurrect(AActor *tmthing, AActor *thing)
assert(VIndex != ~0u); assert(VIndex != ~0u);
} }
VMValue params[3] = { tmthing, thing, false }; VMValue params[3] = { raiser, thing, false };
VMReturn ret; VMReturn ret;
int retval; int retval;
ret.IntAt(&retval); ret.IntAt(&retval);
auto clss = tmthing->GetClass(); auto clss = raiser->GetClass();
VMFunction *func = clss->Virtuals.Size() > VIndex ? clss->Virtuals[VIndex] : nullptr; VMFunction *func = clss->Virtuals.Size() > VIndex ? clss->Virtuals[VIndex] : nullptr;
if (func != nullptr) if (func != nullptr)
{ {
@ -2803,7 +2803,7 @@ bool P_CanResurrect(AActor *tmthing, AActor *thing)
} }
// Pointless to be running it again if it's just self. // Pointless to be running it again if it's just self.
if (thing == nullptr || thing == tmthing) if (thing == nullptr || thing == raiser)
return true; return true;
std::swap(params[0].a, params[1].a); std::swap(params[0].a, params[1].a);

View file

@ -471,7 +471,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser, int nocheck)
return false; return false;
} }
if (!P_CanResurrect(thing, raiser)) if (!P_CanResurrect(raiser, thing))
return false; return false;
S_Sound (thing, CHAN_BODY, "vile/raise", 1, ATTN_IDLE); S_Sound (thing, CHAN_BODY, "vile/raise", 1, ATTN_IDLE);