summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2023-05-02 16:51:22 +0200
committerAdministrator <admin@themanaworld.org>2023-08-16 10:47:10 +0000
commit5009e37678598cdfcf705e892f4b60a282bbd10d (patch)
tree49244a494a4aa95dd6e59d4cc389cfe04185b579
parentc5bc7240438be03fd0181be39a635cc06557324f (diff)
downloadplus-5009e37678598cdfcf705e892f4b60a282bbd10d.tar.gz
plus-5009e37678598cdfcf705e892f4b60a282bbd10d.tar.bz2
plus-5009e37678598cdfcf705e892f4b60a282bbd10d.tar.xz
plus-5009e37678598cdfcf705e892f4b60a282bbd10d.zip
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.
-rw-r--r--src/being/localplayer.cpp5
1 files 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;
}