diff --git a/src/NPCManager.cpp b/src/NPCManager.cpp index 7685d3e..6da4809 100644 --- a/src/NPCManager.cpp +++ b/src/NPCManager.cpp @@ -113,6 +113,7 @@ void NPCManager::npcWarpHandler(CNSocket* sock, CNPacketData* data) { return; // malformed packet sP_CL2FE_REQ_PC_WARP_USE_NPC* warpNpc = (sP_CL2FE_REQ_PC_WARP_USE_NPC*)data->buf; + PlayerView& plrv = PlayerManager::players[sock]; // sanity check if (Warps.find(warpNpc->iWarpID) == Warps.end()) @@ -123,6 +124,10 @@ void NPCManager::npcWarpHandler(CNSocket* sock, CNPacketData* data) { resp.iX = Warps[warpNpc->iWarpID].x; resp.iY = Warps[warpNpc->iWarpID].y; resp.iZ = Warps[warpNpc->iWarpID].z; + + // force player & NPC reload + plrv.viewable.clear(); + plrv.viewableNPCs.clear(); sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_WARP_USE_NPC_SUCC, sizeof(sP_FE2CL_REP_PC_WARP_USE_NPC_SUCC)); diff --git a/src/Player.hpp b/src/Player.hpp index ef6d5d5..2570c99 100644 --- a/src/Player.hpp +++ b/src/Player.hpp @@ -1,9 +1,8 @@ +#pragma once + #include #include -#ifndef _PLR_HPP -#define _PLR_HPP - #include "CNProtocol.hpp" #include "CNStructs.hpp" @@ -27,5 +26,3 @@ struct Player { sItemBase Inven[AINVEN_COUNT]; bool IsGM; }; - -#endif diff --git a/src/PlayerManager.cpp b/src/PlayerManager.cpp index c17952f..f49d0d7 100644 --- a/src/PlayerManager.cpp +++ b/src/PlayerManager.cpp @@ -256,6 +256,7 @@ void PlayerManager::loadPlayer(CNSocket* sock, CNPacketData* data) { sP_CL2FE_REQ_PC_LOADING_COMPLETE* complete = (sP_CL2FE_REQ_PC_LOADING_COMPLETE*)data->buf; INITSTRUCT(sP_FE2CL_REP_PC_LOADING_COMPLETE_SUCC, response); + Player *plr = getPlayer(sock); DEBUGLOG( std::cout << "P_CL2FE_REQ_PC_LOADING_COMPLETE:" << std::endl; @@ -264,6 +265,9 @@ void PlayerManager::loadPlayer(CNSocket* sock, CNPacketData* data) { response.iPC_ID = complete->iPC_ID; + // reload players & NPCs + updatePlayerPosition(sock, plr->x, plr->y, plr->z); + sock->sendPacket((void*)&response, P_FE2CL_REP_PC_LOADING_COMPLETE_SUCC, sizeof(sP_FE2CL_REP_PC_LOADING_COMPLETE_SUCC)); }