@ -32,7 +32,7 @@ bool PlayerProcessor::Process(RakNet::Packet &packet) noexcept
PlayerPacket *myPacket = Networking::get().getPlayerController()->GetPacket(packet.data[0]);
myPacket->setPlayer(player);
if(!processor.second->dontRead)
if(!processor.second->avoidReading)
myPacket->Read();
processor.second->Do(*myPacket, *player);
@ -41,8 +41,10 @@ bool WorldProcessor::Process(RakNet::Packet &packet) noexcept
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s from %s", processor.second->strPacketID.c_str(),
player->npc.mName.c_str());
myPacket->setEvent(&baseEvent);
processor.second->Do(*myPacket, *player, baseEvent);
return true;
}
@ -17,7 +17,7 @@ namespace mwmp
ProcessorPlayerDeath()
{
BPP_INIT(ID_PLAYER_DEATH)
dontRead = true;
avoidReading = true;
void Do(PlayerPacket &packet, Player &player) override
@ -16,7 +16,7 @@ namespace mwmp
ProcessorPlayerResurrect()
BPP_INIT(ID_PLAYER_RESURRECT)
@ -20,7 +20,7 @@ namespace mwmp
DEBUG_PRINTF(strPacketID.c_str());
Script::Call<Script::CallbackIdentity("OnPlayerSpellbookChange")>(player.getId());
};
@ -7,7 +7,7 @@
#include <string>
#define BPP_INIT(packet_id) packetID = packet_id; strPacketID = #packet_id; className = typeid(this).name(); dontRead = false;
#define BPP_INIT(packet_id) packetID = packet_id; strPacketID = #packet_id; className = typeid(this).name(); avoidReading = false;
class BasePacketProcessor
@ -30,7 +30,7 @@ protected:
unsigned char packetID;
std::string strPacketID;
std::string className;
bool dontRead;
bool avoidReading;