From b2cef54d7291cf92c3f153a39f70507d3fe63bf8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 13 Jun 2010 10:11:50 +0000 Subject: [PATCH] - fixed: Classes inherited from PowerScanner didn't work anymore. SVN r2368 (trunk) --- src/actor.h | 2 +- src/am_map.cpp | 2 +- src/p_mobj.cpp | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/actor.h b/src/actor.h index 9621ab733..db4d07dbb 100644 --- a/src/actor.h +++ b/src/actor.h @@ -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 T *FindInventory () { diff --git a/src/am_map.cpp b/src/am_map.cpp index 9987876a9..36d31a00e 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2127,7 +2127,7 @@ void AM_Drawer () return; bool allmap = (level.flags2 & LEVEL2_ALLMAP) != 0; - bool allthings = allmap && players[consoleplayer].mo->FindInventory() != NULL; + bool allthings = allmap && players[consoleplayer].mo->FindInventory(RUNTIME_CLASS(APowerScanner), true) != NULL; AM_initColors (viewactive); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index ff896a0f1..6fd05c040 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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;