From c1b6ae8466a182c4cd96b63696ffc64808d09b79 Mon Sep 17 00:00:00 2001 From: dongresource Date: Tue, 25 Aug 2020 01:08:02 +0200 Subject: [PATCH] No need to unpack zero-length packet structs. Also fixed formatting and added subheading to README.md. --- README.md | 1 + src/PlayerManager.cpp | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index e93b288..69000c3 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ It's what's called a landwalker; enough of the server has been implemented to al To make your landwalking experience more pleasant, you can make use of a few admin commands to get around easier: +### Movement commands * A `/speed` of around 2400 or 3000 is nice. * A `/jump` of about 50 will send you soaring * [This map](res/dong_number_map.png) (credit to Danny O) is useful for `/warp` coordinates. diff --git a/src/PlayerManager.cpp b/src/PlayerManager.cpp index 8b0c7e9..293b3b4 100644 --- a/src/PlayerManager.cpp +++ b/src/PlayerManager.cpp @@ -185,13 +185,13 @@ void PlayerManager::enterPlayer(CNSocket* sock, CNPacketData* data) { DEBUGLOG( std::cout << "P_CL2FE_REQ_PC_ENTER:" << std::endl; - std::cout << "\tID: " << U16toU8(enter->szID) << std::endl; - std::cout << "\tSerial: " << enter->iEnterSerialKey << std::endl; - std::cout << "\tTemp: " << enter->iTempValue << std::endl; - std::cout << "\tPC_UID: " << plr.PCStyle.iPC_UID << std::endl; + std::cout << "\tID: " << U16toU8(enter->szID) << std::endl; + std::cout << "\tSerial: " << enter->iEnterSerialKey << std::endl; + std::cout << "\tTemp: " << enter->iTempValue << std::endl; + std::cout << "\tPC_UID: " << plr.PCStyle.iPC_UID << std::endl; ) - response.iID = rand(); + response.iID = rand(); response.uiSvrTime = getTime(); response.PCLoadData2CL.iUserLevel = 1; response.PCLoadData2CL.iHP = 3625; //TODO: Check player levelupdata and get this right @@ -255,10 +255,10 @@ void PlayerManager::loadPlayer(CNSocket* sock, CNPacketData* data) { DEBUGLOG( std::cout << "P_CL2FE_REQ_PC_LOADING_COMPLETE:" << std::endl; - std::cout << "\tPC_ID: " << complete->iPC_ID << std::endl; + std::cout << "\tPC_ID: " << complete->iPC_ID << std::endl; ) - response.iPC_ID = complete->iPC_ID; + response.iPC_ID = complete->iPC_ID; sock->sendPacket((void*)&response, P_FE2CL_REP_PC_LOADING_COMPLETE_SUCC, sizeof(sP_FE2CL_REP_PC_LOADING_COMPLETE_SUCC)); } @@ -520,12 +520,12 @@ void PlayerManager::gotoPlayer(CNSocket* sock, CNPacketData* data) { DEBUGLOG( std::cout << "P_CL2FE_REQ_PC_GOTO:" << std::endl; - std::cout << "\tX: " << gotoData->iToX << std::endl; - std::cout << "\tY: " << gotoData->iToY << std::endl; - std::cout << "\tZ: " << gotoData->iToZ << std::endl; + std::cout << "\tX: " << gotoData->iToX << std::endl; + std::cout << "\tY: " << gotoData->iToY << std::endl; + std::cout << "\tZ: " << gotoData->iToZ << std::endl; ) - response.iX = gotoData->iToX; + response.iX = gotoData->iToX; response.iY = gotoData->iToY; response.iZ = gotoData->iToZ; @@ -541,12 +541,12 @@ void PlayerManager::setSpecialPlayer(CNSocket* sock, CNPacketData* data) { DEBUGLOG( std::cout << "P_CL2FE_GM_REQ_PC_SET_VALUE:" << std::endl; - std::cout << "\tPC_ID: " << setData->iPC_ID << std::endl; - std::cout << "\tSetValueType: " << setData->iSetValueType << std::endl; - std::cout << "\tSetValue: " << setData->iSetValue << std::endl; + std::cout << "\tPC_ID: " << setData->iPC_ID << std::endl; + std::cout << "\tSetValueType: " << setData->iSetValueType << std::endl; + std::cout << "\tSetValue: " << setData->iSetValue << std::endl; ) - response.iPC_ID = setData->iPC_ID; + response.iPC_ID = setData->iPC_ID; response.iSetValue = setData->iSetValue; response.iSetValueType = setData->iSetValueType; @@ -590,7 +590,6 @@ void PlayerManager::revivePlayer(CNSocket* sock, CNPacketData* data) { } void PlayerManager::enterPlayerVehicle(CNSocket* sock, CNPacketData* data) { - sP_CL2FE_REQ_PC_VEHICLE_ON* vehicleData = (sP_CL2FE_REQ_PC_VEHICLE_ON*)data->buf; INITSTRUCT(sP_FE2CL_PC_VEHICLE_ON_SUCC, response); PlayerView plrv = PlayerManager::players[sock]; @@ -608,7 +607,6 @@ void PlayerManager::enterPlayerVehicle(CNSocket* sock, CNPacketData* data) { } void PlayerManager::exitPlayerVehicle(CNSocket* sock, CNPacketData* data) { - sP_CL2FE_REQ_PC_VEHICLE_OFF* vehicleData = (sP_CL2FE_REQ_PC_VEHICLE_OFF*)data->buf; INITSTRUCT(sP_FE2CL_PC_VEHICLE_OFF_SUCC, response); PlayerView plrv = PlayerManager::players[sock];