diff --git a/Source/msg.cpp b/Source/msg.cpp index 4c298116c..b2c14e0ac 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1534,17 +1534,21 @@ DWORD OnBreakObject(const TCmd *pCmd, int pnum) DWORD OnChangePlayerItems(const TCmd *pCmd, int pnum) { const auto &message = *reinterpret_cast(pCmd); + auto &player = Players[pnum]; + + if (message.bLoc >= NUM_INVLOC) + return sizeof(message); + + auto bodyLocation = static_cast(message.bLoc); if (gbBufferMsgs == 1) { SendPacket(pnum, &message, sizeof(message)); - } else if (pnum != MyPlayerId && message.bLoc < NUM_INVLOC && message.wIndx <= IDI_LAST) { - auto &player = Players[pnum]; - auto bodyLocation = static_cast(message.bLoc); - + } else if (pnum != MyPlayerId && message.wIndx <= IDI_LAST) { CheckInvSwap(player, bodyLocation, message.wIndx, message.wCI, message.dwSeed, message.bId != 0, message.dwBuff); - player.ReadySpellFromEquipment(bodyLocation); } + player.ReadySpellFromEquipment(bodyLocation); + return sizeof(message); }