chore: Convert EchoSyncSkill to use BitStream references (#1473)

This commit is contained in:
jadebenn 2024-02-26 08:08:56 -06:00 committed by GitHub
parent 5c1ed332c4
commit ab937055e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 16 deletions

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;