Fix vehicles in IZs for real this time

This commit is contained in:
dongresource 2020-12-28 17:39:08 +01:00
parent 4060bf25b0
commit 07a930fe1c

View File

@ -531,9 +531,21 @@ void NPCManager::handleWarp(CNSocket* sock, int32_t warpId) {
if (Warps.find(warpId) == Warps.end()) if (Warps.find(warpId) == Warps.end())
return; return;
if (plr->iPCState | 8) {
// remove the player's vehicle // remove the player's vehicle
plr->iPCState &= ~8; plr->iPCState &= ~8;
// send to self
INITSTRUCT(sP_FE2CL_PC_VEHICLE_OFF_SUCC, off);
sock->sendPacket((void*)&off, P_FE2CL_PC_VEHICLE_OFF_SUCC, sizeof(sP_FE2CL_PC_VEHICLE_OFF_SUCC));
// send to others
INITSTRUCT(sP_FE2CL_PC_STATE_CHANGE, chg);
chg.iPC_ID = plr->iID;
chg.iState = plr->iPCState;
PlayerManager::sendToViewable(sock, (void*)&chg, P_FE2CL_PC_STATE_CHANGE, sizeof(sP_FE2CL_PC_STATE_CHANGE));
}
// std::cerr << "Warped to Map Num:" << Warps[warpId].instanceID << " NPC ID " << Warps[warpId].npcID << std::endl; // std::cerr << "Warped to Map Num:" << Warps[warpId].instanceID << " NPC ID " << Warps[warpId].npcID << std::endl;
if (Warps[warpId].isInstance) { if (Warps[warpId].isInstance) {
uint64_t instanceID = Warps[warpId].instanceID; uint64_t instanceID = Warps[warpId].instanceID;
@ -569,8 +581,21 @@ void NPCManager::handleWarp(CNSocket* sock, int32_t warpId) {
otherPlr->recallInstance = instanceID; otherPlr->recallInstance = instanceID;
// remove their vehicle if they're on one // remove their vehicle if they're on one
if (otherPlr->iPCState | 8) {
// remove the player's vehicle
otherPlr->iPCState &= ~8; otherPlr->iPCState &= ~8;
// send to self
INITSTRUCT(sP_FE2CL_PC_VEHICLE_OFF_SUCC, off);
sockTo->sendPacket((void*)&off, P_FE2CL_PC_VEHICLE_OFF_SUCC, sizeof(sP_FE2CL_PC_VEHICLE_OFF_SUCC));
// send to others
INITSTRUCT(sP_FE2CL_PC_STATE_CHANGE, chg);
chg.iPC_ID = otherPlr->iID;
chg.iState = otherPlr->iPCState;
PlayerManager::sendToViewable(sockTo, (void*)&chg, P_FE2CL_PC_STATE_CHANGE, sizeof(sP_FE2CL_PC_STATE_CHANGE));
}
PlayerManager::sendPlayerTo(sockTo, Warps[warpId].x, Warps[warpId].y, Warps[warpId].z, instanceID); PlayerManager::sendPlayerTo(sockTo, Warps[warpId].x, Warps[warpId].y, Warps[warpId].z, instanceID);
} }
} }