- replaced some dyn_casts with calls to FindActor.

- fixed type checks in A_Morph.
This commit is contained in:
Christoph Oelckers 2017-04-12 01:29:51 +02:00
parent e4d2380775
commit 0e0eca0e0f
2 changed files with 6 additions and 6 deletions

View file

@ -1269,7 +1269,7 @@ CCMD (setslot)
Net_WriteByte(argv.argc()-2);
for (int i = 2; i < argv.argc(); i++)
{
Net_WriteWeapon(dyn_cast<PClassActor>(PClass::FindClass(argv[i])));
Net_WriteWeapon(PClass::FindActor(argv[i]));
}
}
}
@ -1298,7 +1298,7 @@ CCMD (addslot)
return;
}
PClassActor *type= dyn_cast<PClassActor>(PClass::FindClass(argv[2]));
PClassActor *type= PClass::FindActor(argv[2]);
if (type == nullptr)
{
Printf("%s is not a weapon\n", argv[2]);
@ -1374,7 +1374,7 @@ CCMD (addslotdefault)
return;
}
type = dyn_cast<PClassActor>(PClass::FindClass(argv[2]));
type = PClass::FindActor(argv[2]);
if (type == nullptr)
{
Printf ("%s is not a weapon\n", argv[2]);
@ -1523,7 +1523,7 @@ void P_ReadDemoWeaponsChunk(uint8_t **demo)
for (i = 1; i < count; ++i)
{
s = ReadStringConst(demo);
type = dyn_cast<PClassActor>(PClass::FindClass(s));
type = PClass::FindActor(s);
// If a demo was recorded with a weapon that is no longer present,
// should we report it?
Weapons_ntoh[i] = type;

View file

@ -714,14 +714,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_Morph)
bool res = false;
if (self->player)
{
if (type->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
if (type->IsDescendantOf(RUNTIME_CLASS(APlayerPawn)))
{
res = P_MorphPlayer(self->player, self->player, type, duration, flags, enter_flash, exit_flash);
}
}
else
{
if (type->IsKindOf(RUNTIME_CLASS(AMorphedMonster)))
if (type->IsDescendantOf(RUNTIME_CLASS(AMorphedMonster)))
{
res = P_MorphMonster(self, type, duration, flags, enter_flash, exit_flash);
}