Fix github issue #38

This commit is contained in:
dongresource 2020-08-25 20:42:52 +02:00
parent 41898bb6b7
commit 3b3ddf08ef
3 changed files with 11 additions and 5 deletions

View File

@ -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));

View File

@ -1,9 +1,8 @@
#pragma once
#include <string>
#include <cstring>
#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

View File

@ -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));
}