mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
chore: Convert EchoSyncSkill to use BitStream references (#1473)
This commit is contained in:
parent
5c1ed332c4
commit
ab937055e7
@ -256,7 +256,7 @@ bool BehaviorContext::CalculateUpdate(const float deltaTime) {
|
||||
|
||||
BitStreamUtils::WriteHeader(message, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
||||
message.Write(this->originator);
|
||||
echo.Serialize(&message);
|
||||
echo.Serialize(message);
|
||||
|
||||
Game::server->Send(&message, UNASSIGNED_SYSTEM_ADDRESS, true);
|
||||
}
|
||||
|
@ -21,40 +21,40 @@ public:
|
||||
uiSkillHandle = _uiSkillHandle;
|
||||
}
|
||||
|
||||
EchoSyncSkill(RakNet::BitStream* stream) : EchoSyncSkill() {
|
||||
EchoSyncSkill(RakNet::BitStream& stream) : EchoSyncSkill() {
|
||||
Deserialize(stream);
|
||||
}
|
||||
|
||||
~EchoSyncSkill() {
|
||||
}
|
||||
|
||||
void Serialize(RakNet::BitStream* stream) {
|
||||
stream->Write(eGameMessageType::ECHO_SYNC_SKILL);
|
||||
void Serialize(RakNet::BitStream& stream) {
|
||||
stream.Write(eGameMessageType::ECHO_SYNC_SKILL);
|
||||
|
||||
stream->Write(bDone);
|
||||
stream.Write(bDone);
|
||||
uint32_t sBitStreamLength = sBitStream.length();
|
||||
stream->Write(sBitStreamLength);
|
||||
stream.Write(sBitStreamLength);
|
||||
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
||||
stream->Write(sBitStream[k]);
|
||||
stream.Write(sBitStream[k]);
|
||||
}
|
||||
|
||||
stream->Write(uiBehaviorHandle);
|
||||
stream->Write(uiSkillHandle);
|
||||
stream.Write(uiBehaviorHandle);
|
||||
stream.Write(uiSkillHandle);
|
||||
}
|
||||
|
||||
bool Deserialize(RakNet::BitStream* stream) {
|
||||
stream->Read(bDone);
|
||||
bool Deserialize(RakNet::BitStream& stream) {
|
||||
stream.Read(bDone);
|
||||
|
||||
uint32_t sBitStreamLength{};
|
||||
stream->Read(sBitStreamLength);
|
||||
stream.Read(sBitStreamLength);
|
||||
for (unsigned int k = 0; k < sBitStreamLength; k++) {
|
||||
unsigned char character;
|
||||
stream->Read(character);
|
||||
stream.Read(character);
|
||||
sBitStream.push_back(character);
|
||||
}
|
||||
|
||||
stream->Read(uiBehaviorHandle);
|
||||
stream->Read(uiSkillHandle);
|
||||
stream.Read(uiBehaviorHandle);
|
||||
stream.Read(uiSkillHandle);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
echo.uiBehaviorHandle = sync.uiBehaviorHandle;
|
||||
echo.uiSkillHandle = sync.uiSkillHandle;
|
||||
|
||||
echo.Serialize(&bitStreamLocal);
|
||||
echo.Serialize(bitStreamLocal);
|
||||
|
||||
Game::server->Send(&bitStreamLocal, sysAddr, true);
|
||||
} break;
|
||||
|
Loading…
Reference in New Issue
Block a user