Avoid creating the targeter layers if the inventory item isn't attached to

its owner yet
This commit is contained in:
Leonard2 2016-06-02 19:19:50 +02:00
parent e1f139ddcd
commit bc334ccc9f
2 changed files with 14 additions and 2 deletions

View file

@ -1294,6 +1294,11 @@ void APowerTargeter::Travelled ()
void APowerTargeter::InitEffect ()
{
// Why is this called when the inventory isn't even attached yet
// in APowerup::CreateCopy?
if (!Owner->FindInventory(GetClass(), true))
return;
player_t *player;
Super::InitEffect();
@ -1317,6 +1322,14 @@ void APowerTargeter::InitEffect ()
PositionAccuracy ();
}
void APowerTargeter::AttachToOwner(AActor *other)
{
Super::AttachToOwner(other);
// Let's actually properly call this for the targeters.
InitEffect();
}
bool APowerTargeter::HandlePickup(AInventory *item)
{
if (Super::HandlePickup(item))
@ -1327,8 +1340,6 @@ bool APowerTargeter::HandlePickup(AInventory *item)
return false;
}
void APowerTargeter::DoEffect ()
{
Super::DoEffect ();

View file

@ -182,6 +182,7 @@ protected:
void EndEffect ();
void PositionAccuracy ();
void Travelled ();
void AttachToOwner(AActor *other);
bool HandlePickup(AInventory *item);
};