- fixed: Classes inherited from PowerScanner didn't work anymore.

SVN r2368 (trunk)
This commit is contained in:
Christoph Oelckers 2010-06-13 10:11:50 +00:00
parent ec44397881
commit b2cef54d72
3 changed files with 15 additions and 5 deletions

View File

@ -646,7 +646,7 @@ public:
bool CheckLocalView (int playernum) const;
// Finds the first item of a particular type.
AInventory *FindInventory (const PClass *type);
AInventory *FindInventory (const PClass *type, bool subclass = false);
AInventory *FindInventory (FName type);
template<class T> T *FindInventory ()
{

View File

@ -2127,7 +2127,7 @@ void AM_Drawer ()
return;
bool allmap = (level.flags2 & LEVEL2_ALLMAP) != 0;
bool allthings = allmap && players[consoleplayer].mo->FindInventory<APowerScanner>() != NULL;
bool allthings = allmap && players[consoleplayer].mo->FindInventory(RUNTIME_CLASS(APowerScanner), true) != NULL;
AM_initColors (viewactive);

View File

@ -772,7 +772,7 @@ AInventory *AActor::DropInventory (AInventory *item)
//
//============================================================================
AInventory *AActor::FindInventory (const PClass *type)
AInventory *AActor::FindInventory (const PClass *type, bool subclass)
{
AInventory *item;
@ -781,9 +781,19 @@ AInventory *AActor::FindInventory (const PClass *type)
assert (type->ActorInfo != NULL);
for (item = Inventory; item != NULL; item = item->Inventory)
{
if (item->GetClass() == type)
if (!subclass)
{
break;
if (item->GetClass() == type)
{
break;
}
}
else
{
if (item->IsKindOf(type))
{
break;
}
}
}
return item;