- consolidated the check for "is actor an owned inventory item" into a subfunction.
This check occured 9 times in the source, better have it only once.
This commit is contained in:
parent
ee08412e49
commit
319f8743db
8 changed files with 20 additions and 32 deletions
|
|
@ -3134,16 +3134,7 @@ void FParser::SF_MapThingNumExist()
|
|||
}
|
||||
else
|
||||
{
|
||||
// Inventory items in the player's inventory have to be considered non-present.
|
||||
if (SpawnedThings[intval]->IsKindOf(RUNTIME_CLASS(AInventory)) &&
|
||||
barrier_cast<AInventory*>(SpawnedThings[intval])->Owner != NULL)
|
||||
{
|
||||
t_return.value.i = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
t_return.value.i = 1;
|
||||
}
|
||||
t_return.value.i = SpawnedThings[intval]->IsMapActor();
|
||||
t_return.type = svt_int;
|
||||
}
|
||||
}
|
||||
|
|
@ -3673,8 +3664,7 @@ again:
|
|||
{
|
||||
if (mo->IsA(pClass))
|
||||
{
|
||||
if (!mo->IsKindOf (RUNTIME_CLASS(AInventory)) ||
|
||||
static_cast<AInventory *>(mo)->Owner == NULL)
|
||||
if (mo->IsMapActor())
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,9 +129,7 @@ AActor* actorvalue(const svalue_t &svalue)
|
|||
if(svalue.type == svt_mobj)
|
||||
{
|
||||
// Inventory items in the player's inventory have to be considered non-present.
|
||||
if (svalue.value.mobj != NULL &&
|
||||
svalue.value.mobj->IsKindOf(RUNTIME_CLASS(AInventory)) &&
|
||||
static_cast<AInventory*>(svalue.value.mobj)->Owner != NULL)
|
||||
if (svalue.value.mobj == NULL || !svalue.value.mobj->IsMapActor())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -150,9 +148,7 @@ AActor* actorvalue(const svalue_t &svalue)
|
|||
return NULL;
|
||||
}
|
||||
// Inventory items in the player's inventory have to be considered non-present.
|
||||
if (SpawnedThings[intval] != NULL &&
|
||||
SpawnedThings[intval]->IsKindOf(RUNTIME_CLASS(AInventory)) &&
|
||||
barrier_cast<AInventory*>(SpawnedThings[intval])->Owner != NULL)
|
||||
if (svalue.value.mobj == NULL || !svalue.value.mobj->IsMapActor())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue