- Allow subclasses when checking for PowerWeaponLevel2.

SVN r3314 (trunk)
This commit is contained in:
Randy Heit 2011-11-07 00:43:41 +00:00
parent 66f86add05
commit f00f5d2304
6 changed files with 7 additions and 6 deletions

View file

@ -235,7 +235,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
player->MorphStyle = 0; player->MorphStyle = 0;
player->MorphExitFlash = NULL; player->MorphExitFlash = NULL;
player->viewheight = mo->ViewHeight; player->viewheight = mo->ViewHeight;
AInventory *level2 = mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2)); AInventory *level2 = mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true);
if (level2 != NULL) if (level2 != NULL)
{ {
level2->Destroy (); level2->Destroy ();
@ -273,6 +273,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
if ((unsigned int)player->userinfo.skin >= PlayerClasses.Size () && if ((unsigned int)player->userinfo.skin >= PlayerClasses.Size () &&
(size_t)player->userinfo.skin < numskins) (size_t)player->userinfo.skin < numskins)
{ {
skinindex = player->userinfo.skin; skinindex = player->userinfo.skin;
} }
else if (PlayerClasses.Size () > 1) else if (PlayerClasses.Size () > 1)

View file

@ -126,7 +126,7 @@ bool AWeapon::Use (bool pickup)
// weapon, if one exists. // weapon, if one exists.
if (SisterWeapon != NULL && if (SisterWeapon != NULL &&
SisterWeapon->WeaponFlags & WIF_POWERED_UP && SisterWeapon->WeaponFlags & WIF_POWERED_UP &&
Owner->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2))) Owner->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true))
{ {
useweap = SisterWeapon; useweap = SisterWeapon;
} }

View file

@ -181,7 +181,7 @@ void cht_DoCheat (player_t *player, int cheat)
case CHT_POWER: case CHT_POWER:
if (player->mo != NULL && player->health >= 0) if (player->mo != NULL && player->health >= 0)
{ {
item = player->mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2)); item = player->mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true);
if (item != NULL) if (item != NULL)
{ {
item->Destroy (); item->Destroy ();

View file

@ -2656,7 +2656,7 @@ FUNC(LS_SetPlayerProperty)
{ // Take power from activator { // Take power from activator
if (power != 4) if (power != 4)
{ {
AInventory *item = it->FindInventory (powers[power]); AInventory *item = it->FindInventory (powers[power], true);
if (item != NULL) if (item != NULL)
{ {
item->Destroy (); item->Destroy ();

View file

@ -155,7 +155,7 @@ void P_BringUpWeapon (player_t *player)
if (weapon != NULL && if (weapon != NULL &&
weapon->SisterWeapon && weapon->SisterWeapon &&
weapon->SisterWeapon->WeaponFlags & WIF_POWERED_UP && weapon->SisterWeapon->WeaponFlags & WIF_POWERED_UP &&
player->mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2))) player->mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true))
{ {
weapon = weapon->SisterWeapon; weapon = weapon->SisterWeapon;
} }

View file

@ -672,7 +672,7 @@ AWeapon *APlayerPawn::BestWeapon (const PClass *ammotype)
int bestOrder = INT_MAX; int bestOrder = INT_MAX;
AInventory *item; AInventory *item;
AWeapon *weap; AWeapon *weap;
bool tomed = NULL != FindInventory (RUNTIME_CLASS(APowerWeaponLevel2)); bool tomed = NULL != FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true);
// Find the best weapon the player has. // Find the best weapon the player has.
for (item = Inventory; item != NULL; item = item->Inventory) for (item = Inventory; item != NULL; item = item->Inventory)