- replaced more dyn_casts and checks for RUNTIME_CLASS(PClassActor)

It is preferable to use IsDescendantOf wherever possible if we ever want to be able to separate PClass from PType.
This commit is contained in:
Christoph Oelckers 2017-04-12 10:20:58 +02:00
commit 9c9b2ccf6d
13 changed files with 28 additions and 23 deletions

View file

@ -1572,6 +1572,17 @@ template<class T> inline T *Spawn() // for inventory items we do not need coordi
return static_cast<T *>(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), DVector3(0, 0, 0), NO_REPLACE));
}
inline PClassActor *PClass::FindActor(FName name)
{
auto cls = FindClass(name);
return cls && cls->IsDescendantOf(RUNTIME_CLASS(AActor)) ? static_cast<PClassActor*>(cls) : nullptr;
}
inline PClassActor *ValidateActor(PClass *cls)
{
return cls && cls->IsDescendantOf(RUNTIME_CLASS(AActor)) ? static_cast<PClassActor*>(cls) : nullptr;
}
void PrintMiscActorInfo(AActor * query);
AActor *P_LinePickActor(AActor *t1, DAngle angle, double distance, DAngle pitch, ActorFlags actorMask, uint32_t wallMask);