mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
Fix github issue #38
This commit is contained in:
parent
41898bb6b7
commit
3b3ddf08ef
@ -113,6 +113,7 @@ void NPCManager::npcWarpHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
return; // malformed packet
|
return; // malformed packet
|
||||||
|
|
||||||
sP_CL2FE_REQ_PC_WARP_USE_NPC* warpNpc = (sP_CL2FE_REQ_PC_WARP_USE_NPC*)data->buf;
|
sP_CL2FE_REQ_PC_WARP_USE_NPC* warpNpc = (sP_CL2FE_REQ_PC_WARP_USE_NPC*)data->buf;
|
||||||
|
PlayerView& plrv = PlayerManager::players[sock];
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if (Warps.find(warpNpc->iWarpID) == Warps.end())
|
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.iX = Warps[warpNpc->iWarpID].x;
|
||||||
resp.iY = Warps[warpNpc->iWarpID].y;
|
resp.iY = Warps[warpNpc->iWarpID].y;
|
||||||
resp.iZ = Warps[warpNpc->iWarpID].z;
|
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));
|
sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_WARP_USE_NPC_SUCC, sizeof(sP_FE2CL_REP_PC_WARP_USE_NPC_SUCC));
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#ifndef _PLR_HPP
|
|
||||||
#define _PLR_HPP
|
|
||||||
|
|
||||||
#include "CNProtocol.hpp"
|
#include "CNProtocol.hpp"
|
||||||
#include "CNStructs.hpp"
|
#include "CNStructs.hpp"
|
||||||
|
|
||||||
@ -27,5 +26,3 @@ struct Player {
|
|||||||
sItemBase Inven[AINVEN_COUNT];
|
sItemBase Inven[AINVEN_COUNT];
|
||||||
bool IsGM;
|
bool IsGM;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -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;
|
sP_CL2FE_REQ_PC_LOADING_COMPLETE* complete = (sP_CL2FE_REQ_PC_LOADING_COMPLETE*)data->buf;
|
||||||
INITSTRUCT(sP_FE2CL_REP_PC_LOADING_COMPLETE_SUCC, response);
|
INITSTRUCT(sP_FE2CL_REP_PC_LOADING_COMPLETE_SUCC, response);
|
||||||
|
Player *plr = getPlayer(sock);
|
||||||
|
|
||||||
DEBUGLOG(
|
DEBUGLOG(
|
||||||
std::cout << "P_CL2FE_REQ_PC_LOADING_COMPLETE:" << std::endl;
|
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;
|
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));
|
sock->sendPacket((void*)&response, P_FE2CL_REP_PC_LOADING_COMPLETE_SUCC, sizeof(sP_FE2CL_REP_PC_LOADING_COMPLETE_SUCC));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user