mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-05 14:58:27 +00:00

* merge ServerType and ServiceID enums * rename eConnectionType to ServiceType in preparation for enum unification * unify ServiceID and ServiceType enums * shrink ServiceType to an 8-bit integer * fix linux compilation error and update gamemsg test * return to uint16_t * Update dNet/AuthPackets.cpp Use cast instead of padding Co-authored-by: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> * Add default case to MasterServer.cpp * move ref back to type * Another formatting fix * Fix comment to be more accurate --------- Co-authored-by: jadebenn <9892985+jadebenn@users.noreply.github.com> Co-authored-by: David Markowitz <39972741+EmosewaMC@users.noreply.github.com>
30 lines
896 B
C++
30 lines
896 B
C++
#include "BitStreamUtils.h"
|
|
#include "dServer.h"
|
|
#include "BitStream.h"
|
|
#include "PacketUtils.h"
|
|
|
|
|
|
void LUBitStream::WriteHeader(RakNet::BitStream& bitStream) const {
|
|
bitStream.Write<MessageID>(ID_USER_PACKET_ENUM);
|
|
bitStream.Write(this->connectionType);
|
|
bitStream.Write(this->internalPacketID);
|
|
bitStream.Write<uint8_t>(0); // padding
|
|
}
|
|
|
|
bool LUBitStream::ReadHeader(RakNet::BitStream& bitStream) {
|
|
MessageID messageID;
|
|
bitStream.Read(messageID);
|
|
if (messageID != ID_USER_PACKET_ENUM) return false;
|
|
VALIDATE_READ(bitStream.Read(this->connectionType));
|
|
VALIDATE_READ(bitStream.Read(this->internalPacketID));
|
|
bitStream.IgnoreBytes(1);
|
|
return true;
|
|
}
|
|
|
|
void LUBitStream::Send(const SystemAddress& sysAddr) const {
|
|
RakNet::BitStream bitStream;
|
|
this->WriteHeader(bitStream);
|
|
this->Serialize(bitStream);
|
|
Game::server->Send(bitStream, sysAddr, sysAddr == UNASSIGNED_SYSTEM_ADDRESS);
|
|
}
|