Add "IsFinal" parameter for CheckReplacement.

If set to true it guarantees that the replacement is final and will not go through the rest of the replacement chain.
This commit is contained in:
Mari the Deer 2018-08-16 20:46:40 +02:00 committed by Christoph Oelckers
commit 02926a5567
4 changed files with 17 additions and 7 deletions

View file

@ -427,7 +427,11 @@ PClassActor *PClassActor::GetReplacement(bool lookskill)
}
// [MK] ZScript replacement through Event Handlers, has priority over others
PClassActor *Replacement = ActorInfo()->Replacement;
E_CheckReplacement(this,&Replacement);
if ( E_CheckReplacement(this,&Replacement) )
{
// [MK] the replacement is final, so don't continue with the chain
return Replacement ? Replacement : this;
}
if (Replacement == nullptr && (!lookskill || skillrepname == NAME_None))
{
return this;