From 5009e37678598cdfcf705e892f4b60a282bbd10d Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Tue, 2 May 2023 16:51:22 +0200 Subject: Fix unable to pickup non-ignored items while standing on an ignored item. What happened: 1) The pickup code first tries to pickup first item under you without checking if it is ignored. 2) ::pickUp queries ratelimiter, which clears to send. 3) ::pickUp checks if item is ignored and bails out 4) The pickup code did not bail early, despite "success" of (1) and selects a non-ignored item to pick-up. 5) ::pickUp queries ratelimiter, which thinks that a packet has been sent in (2) and aborts. --- src/being/localplayer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 449032a40..eb590c6aa 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -513,9 +513,6 @@ bool LocalPlayer::pickUp(FloorItem *const item) if (item == nullptr) return false; - if (!PacketLimiter::limitPackets(PacketType::PACKET_PICKUP)) - return false; - const int dx = item->getTileX() - mX; const int dy = item->getTileY() - mY; int dist = 6; @@ -528,6 +525,8 @@ bool LocalPlayer::pickUp(FloorItem *const item) { if ((actorManager != nullptr) && actorManager->checkForPickup(item)) { + if (!PacketLimiter::limitPackets(PacketType::PACKET_PICKUP)) + return false; PlayerInfo::pickUpItem(item, Sfx_true); mPickUpTarget = nullptr; } -- cgit v1.2.3-60-g2f50