- 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; bool CheckLocalView (int playernum) const;
// Finds the first item of a particular type. // 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); AInventory *FindInventory (FName type);
template<class T> T *FindInventory () template<class T> T *FindInventory ()
{ {

View file

@ -2127,7 +2127,7 @@ void AM_Drawer ()
return; return;
bool allmap = (level.flags2 & LEVEL2_ALLMAP) != 0; 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); 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; AInventory *item;
@ -781,9 +781,19 @@ AInventory *AActor::FindInventory (const PClass *type)
assert (type->ActorInfo != NULL); assert (type->ActorInfo != NULL);
for (item = Inventory; item != NULL; item = item->Inventory) 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; return item;