diff options
author | Fedja Beader <fedja@protonmail.ch> | 2023-05-02 16:51:22 +0200 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2023-08-10 18:06:13 +0200 |
commit | 4991dbeaad702f307c9b108fc6c1c91d70c1ce91 (patch) | |
tree | 92439aa05d55a1fe49078f23a1e5fc3fcd61f147 | |
parent | 4936c4353089b4c2542741a153ed6106606b12d3 (diff) | |
download | manaplus-4991dbeaad702f307c9b108fc6c1c91d70c1ce91.tar.gz manaplus-4991dbeaad702f307c9b108fc6c1c91d70c1ce91.tar.bz2 manaplus-4991dbeaad702f307c9b108fc6c1c91d70c1ce91.tar.xz manaplus-4991dbeaad702f307c9b108fc6c1c91d70c1ce91.zip |
Fix unable to pickup non-ignored items while standing on an ignoredpickupignoredfix
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.cpp | 5 |
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; } |