mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Avoid creating the targeter layers if the inventory item isn't attached to
its owner yet
This commit is contained in:
parent
e1f139ddcd
commit
bc334ccc9f
2 changed files with 14 additions and 2 deletions
|
@ -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 ();
|
||||
|
|
|
@ -182,6 +182,7 @@ protected:
|
|||
void EndEffect ();
|
||||
void PositionAccuracy ();
|
||||
void Travelled ();
|
||||
void AttachToOwner(AActor *other);
|
||||
bool HandlePickup(AInventory *item);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue