diff options
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 96062867..15047f5a 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -686,6 +686,9 @@ void LocalPlayer::setInvItem(int index, int id, int amount) void LocalPlayer::pickUp(FloorItem *item) { + if (!item) + return; + int dx = item->getTileX() - (int) getPosition().x / 32; int dy = item->getTileY() - (int) getPosition().y / 32; @@ -700,16 +703,24 @@ void LocalPlayer::pickUp(FloorItem *item) { setDestination(item->getPixelX() + 16, item->getPixelY() + 16); mPickUpTarget = item; + mPickUpTarget->addActorSpriteListener(this); } else { setDestination(item->getTileX(), item->getTileY()); mPickUpTarget = item; + mPickUpTarget->addActorSpriteListener(this); stopAttack(); } } } +void LocalPlayer::actorSpriteDestroyed(const ActorSprite &actorSprite) +{ + if (mPickUpTarget == &actorSprite) + mPickUpTarget = 0; +} + Being *LocalPlayer::getTarget() const { return mTarget; |