mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
chore: Convert DoClientProjectileImpact to use bitstream refs (#1471)
This commit is contained in:
parent
30b9ef8ab2
commit
4b0079c817
@ -436,7 +436,7 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
|
|||||||
|
|
||||||
BitStreamUtils::WriteHeader(message, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
BitStreamUtils::WriteHeader(message, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
||||||
message.Write(this->m_Parent->GetObjectID());
|
message.Write(this->m_Parent->GetObjectID());
|
||||||
projectileImpact.Serialize(&message);
|
projectileImpact.Serialize(message);
|
||||||
|
|
||||||
Game::server->Send(&message, UNASSIGNED_SYSTEM_ADDRESS, true);
|
Game::server->Send(&message, UNASSIGNED_SYSTEM_ADDRESS, true);
|
||||||
|
|
||||||
|
@ -19,51 +19,51 @@ public:
|
|||||||
sBitStream = _sBitStream;
|
sBitStream = _sBitStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoClientProjectileImpact(RakNet::BitStream* stream) : DoClientProjectileImpact() {
|
DoClientProjectileImpact(RakNet::BitStream& stream) : DoClientProjectileImpact() {
|
||||||
Deserialize(stream);
|
Deserialize(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
~DoClientProjectileImpact() {
|
~DoClientProjectileImpact() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream* stream) {
|
void Serialize(RakNet::BitStream& stream) {
|
||||||
stream->Write(eGameMessageType::DO_CLIENT_PROJECTILE_IMPACT);
|
stream.Write(eGameMessageType::DO_CLIENT_PROJECTILE_IMPACT);
|
||||||
|
|
||||||
stream->Write(i64OrgID != LWOOBJID_EMPTY);
|
stream.Write(i64OrgID != LWOOBJID_EMPTY);
|
||||||
if (i64OrgID != LWOOBJID_EMPTY) stream->Write(i64OrgID);
|
if (i64OrgID != LWOOBJID_EMPTY) stream.Write(i64OrgID);
|
||||||
|
|
||||||
stream->Write(i64OwnerID != LWOOBJID_EMPTY);
|
stream.Write(i64OwnerID != LWOOBJID_EMPTY);
|
||||||
if (i64OwnerID != LWOOBJID_EMPTY) stream->Write(i64OwnerID);
|
if (i64OwnerID != LWOOBJID_EMPTY) stream.Write(i64OwnerID);
|
||||||
|
|
||||||
stream->Write(i64TargetID != LWOOBJID_EMPTY);
|
stream.Write(i64TargetID != LWOOBJID_EMPTY);
|
||||||
if (i64TargetID != LWOOBJID_EMPTY) stream->Write(i64TargetID);
|
if (i64TargetID != LWOOBJID_EMPTY) stream.Write(i64TargetID);
|
||||||
|
|
||||||
uint32_t sBitStreamLength = sBitStream.length();
|
uint32_t sBitStreamLength = sBitStream.length();
|
||||||
stream->Write(sBitStreamLength);
|
stream.Write(sBitStreamLength);
|
||||||
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
||||||
stream->Write(sBitStream[k]);
|
stream.Write(sBitStream[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Deserialize(RakNet::BitStream* stream) {
|
bool Deserialize(RakNet::BitStream& stream) {
|
||||||
bool i64OrgIDIsDefault{};
|
bool i64OrgIDIsDefault{};
|
||||||
stream->Read(i64OrgIDIsDefault);
|
stream.Read(i64OrgIDIsDefault);
|
||||||
if (i64OrgIDIsDefault != 0) stream->Read(i64OrgID);
|
if (i64OrgIDIsDefault != 0) stream.Read(i64OrgID);
|
||||||
|
|
||||||
bool i64OwnerIDIsDefault{};
|
bool i64OwnerIDIsDefault{};
|
||||||
stream->Read(i64OwnerIDIsDefault);
|
stream.Read(i64OwnerIDIsDefault);
|
||||||
if (i64OwnerIDIsDefault != 0) stream->Read(i64OwnerID);
|
if (i64OwnerIDIsDefault != 0) stream.Read(i64OwnerID);
|
||||||
|
|
||||||
bool i64TargetIDIsDefault{};
|
bool i64TargetIDIsDefault{};
|
||||||
stream->Read(i64TargetIDIsDefault);
|
stream.Read(i64TargetIDIsDefault);
|
||||||
if (i64TargetIDIsDefault != 0) stream->Read(i64TargetID);
|
if (i64TargetIDIsDefault != 0) stream.Read(i64TargetID);
|
||||||
|
|
||||||
uint32_t sBitStreamLength{};
|
uint32_t sBitStreamLength{};
|
||||||
stream->Read(sBitStreamLength);
|
stream.Read(sBitStreamLength);
|
||||||
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
||||||
unsigned char character;
|
unsigned char character;
|
||||||
stream->Read(character);
|
stream.Read(character);
|
||||||
sBitStream.push_back(character);
|
sBitStream.push_back(character);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user