Fix equipping weapon not updating current spell

Fixes #3074
This commit is contained in:
Anders Jenbo 2021-10-09 23:29:00 +02:00
commit 1024973093

View file

@ -1534,17 +1534,21 @@ DWORD OnBreakObject(const TCmd *pCmd, int pnum)
DWORD OnChangePlayerItems(const TCmd *pCmd, int pnum)
{
const auto &message = *reinterpret_cast<const TCmdChItem *>(pCmd);
auto &player = Players[pnum];
if (message.bLoc >= NUM_INVLOC)
return sizeof(message);
auto bodyLocation = static_cast<inv_body_loc>(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<inv_body_loc>(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);
}