mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- allow locks to check for a key's species so that newly defined keys can open previously defined locks without the need to redefine them.
This commit is contained in:
parent
b285cbebe4
commit
75cde0b221
1 changed files with 22 additions and 5 deletions
|
@ -19,12 +19,29 @@ struct OneKey
|
|||
|
||||
bool check(AActor * owner)
|
||||
{
|
||||
// P_GetMapColorForKey() checks the key directly
|
||||
if (owner->IsKindOf (RUNTIME_CLASS(AKey)))
|
||||
if (owner->IsKindOf(RUNTIME_CLASS(AKey)))
|
||||
{
|
||||
// P_GetMapColorForKey() checks the key directly
|
||||
return owner->IsA(key);
|
||||
// Other calls check an actor that may have a key in its inventory.
|
||||
else
|
||||
return !!owner->FindInventory(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Other calls check an actor that may have a key in its inventory.
|
||||
AInventory *item;
|
||||
|
||||
for (item = owner->Inventory; item != NULL; item = item->Inventory)
|
||||
{
|
||||
if (item->IsA(key))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (item->GetSpecies() == key->TypeName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue