From f0e21b50516f8e6f08b39f5ab79d16ae944f5f5b Mon Sep 17 00:00:00 2001 From: CakeLancelot Date: Sat, 24 Apr 2021 23:55:13 -0500 Subject: [PATCH] Fix #198 - dismount packet is now sent if unequipping a vehicle --- src/Items.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Items.cpp b/src/Items.cpp index 9e7a9d6..2fad0ea 100644 --- a/src/Items.cpp +++ b/src/Items.cpp @@ -301,8 +301,18 @@ static void itemMoveHandler(CNSocket* sock, CNPacketData* data) { } // unequip vehicle if equip slot 8 is 0 - if (plr->Equip[8].iID == 0) - plr->iPCState = 0; + if (plr->Equip[8].iID == 0 && plr->iPCState & 8) { + INITSTRUCT(sP_FE2CL_PC_VEHICLE_OFF_SUCC, response); + sock->sendPacket(response, P_FE2CL_PC_VEHICLE_OFF_SUCC); + + // send to other players + plr->iPCState &= ~8; + INITSTRUCT(sP_FE2CL_PC_STATE_CHANGE, response2); + response2.iPC_ID = plr->iID; + response2.iState = plr->iPCState; + + PlayerManager::sendToViewable(sock, response2, P_FE2CL_PC_STATE_CHANGE); + } // send equip event to other players PlayerManager::sendToViewable(sock, equipChange, P_FE2CL_PC_EQUIP_CHANGE);