Merge branch 'master' into scripting

Conflicts:
	src/m_cheat.cpp
	src/p_acs.cpp
	src/thingdef/thingdef_codeptr.cpp
	src/thingdef/thingdef_properties.cpp
This commit is contained in:
Christoph Oelckers 2015-04-28 23:04:10 +02:00
commit 646c135eff
12 changed files with 106 additions and 126 deletions

View file

@ -137,14 +137,9 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
hxarmor->Slots[3] = 0;
hxarmor->Slots[4] = spawntype->HexenArmor[0];
}
else if (item->ItemFlags & IF_KEEPDEPLETED)
{
// Set depletable armor to 0 (this includes BasicArmor).
item->Amount = 0;
}
else
{
item->Destroy ();
item->DepleteOrDestroy();
}
}
item = next;

View file

@ -1177,6 +1177,32 @@ void AInventory::Destroy ()
if (SendItemDrop == this) SendItemDrop = NULL;
}
//===========================================================================
//
// AInventory :: DepleteOrDestroy
//
// If the item is depleted, just change its amount to 0, otherwise it's destroyed.
//
//===========================================================================
void AInventory::DepleteOrDestroy ()
{
// If it's not ammo or an internal armor, destroy it.
// Ammo needs to stick around, even when it's zero for the benefit
// of the weapons that use it and to maintain the maximum ammo
// amounts a backpack might have given.
// Armor shouldn't be removed because they only work properly when
// they are the last items in the inventory.
if (ItemFlags & IF_KEEPDEPLETED)
{
Amount = 0;
}
else
{
Destroy();
}
}
//===========================================================================
//
// AInventory :: GetBlend

View file

@ -155,6 +155,7 @@ public:
virtual void MarkPrecacheSounds() const;
virtual void BeginPlay ();
virtual void Destroy ();
virtual void DepleteOrDestroy ();
virtual void Tick ();
virtual bool ShouldRespawn ();
virtual bool ShouldStay ();