mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-09 09:48:20 +00:00
chore: Change EchoStartSkill to use BitStream reference (#1472)
This commit is contained in:
parent
ab937055e7
commit
c3743877df
@ -305,7 +305,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
||||
|
||||
BitStreamUtils::WriteHeader(message, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
||||
message.Write(this->m_Parent->GetObjectID());
|
||||
start.Serialize(&message);
|
||||
start.Serialize(message);
|
||||
|
||||
Game::server->Send(&message, UNASSIGNED_SYSTEM_ADDRESS, true);
|
||||
}
|
||||
|
@ -32,85 +32,85 @@ public:
|
||||
uiSkillHandle = _uiSkillHandle;
|
||||
}
|
||||
|
||||
EchoStartSkill(RakNet::BitStream* stream) : EchoStartSkill() {
|
||||
EchoStartSkill(RakNet::BitStream& stream) : EchoStartSkill() {
|
||||
Deserialize(stream);
|
||||
}
|
||||
|
||||
~EchoStartSkill() {
|
||||
}
|
||||
|
||||
void Serialize(RakNet::BitStream* stream) {
|
||||
stream->Write(eGameMessageType::ECHO_START_SKILL);
|
||||
void Serialize(RakNet::BitStream& stream) {
|
||||
stream.Write(eGameMessageType::ECHO_START_SKILL);
|
||||
|
||||
stream->Write(bUsedMouse);
|
||||
stream.Write(bUsedMouse);
|
||||
|
||||
stream->Write(fCasterLatency != 0.0f);
|
||||
if (fCasterLatency != 0.0f) stream->Write(fCasterLatency);
|
||||
stream.Write(fCasterLatency != 0.0f);
|
||||
if (fCasterLatency != 0.0f) stream.Write(fCasterLatency);
|
||||
|
||||
stream->Write(iCastType != 0);
|
||||
if (iCastType != 0) stream->Write(iCastType);
|
||||
stream.Write(iCastType != 0);
|
||||
if (iCastType != 0) stream.Write(iCastType);
|
||||
|
||||
stream->Write(lastClickedPosit != NiPoint3Constant::ZERO);
|
||||
if (lastClickedPosit != NiPoint3Constant::ZERO) stream->Write(lastClickedPosit);
|
||||
stream.Write(lastClickedPosit != NiPoint3Constant::ZERO);
|
||||
if (lastClickedPosit != NiPoint3Constant::ZERO) stream.Write(lastClickedPosit);
|
||||
|
||||
stream->Write(optionalOriginatorID);
|
||||
stream.Write(optionalOriginatorID);
|
||||
|
||||
stream->Write(optionalTargetID != LWOOBJID_EMPTY);
|
||||
if (optionalTargetID != LWOOBJID_EMPTY) stream->Write(optionalTargetID);
|
||||
stream.Write(optionalTargetID != LWOOBJID_EMPTY);
|
||||
if (optionalTargetID != LWOOBJID_EMPTY) stream.Write(optionalTargetID);
|
||||
|
||||
stream->Write(originatorRot != NiQuaternionConstant::IDENTITY);
|
||||
if (originatorRot != NiQuaternionConstant::IDENTITY) stream->Write(originatorRot);
|
||||
stream.Write(originatorRot != NiQuaternionConstant::IDENTITY);
|
||||
if (originatorRot != NiQuaternionConstant::IDENTITY) stream.Write(originatorRot);
|
||||
|
||||
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(skillID);
|
||||
stream.Write(skillID);
|
||||
|
||||
stream->Write(uiSkillHandle != 0);
|
||||
if (uiSkillHandle != 0) stream->Write(uiSkillHandle);
|
||||
stream.Write(uiSkillHandle != 0);
|
||||
if (uiSkillHandle != 0) stream.Write(uiSkillHandle);
|
||||
}
|
||||
|
||||
bool Deserialize(RakNet::BitStream* stream) {
|
||||
stream->Read(bUsedMouse);
|
||||
bool Deserialize(RakNet::BitStream& stream) {
|
||||
stream.Read(bUsedMouse);
|
||||
|
||||
bool fCasterLatencyIsDefault{};
|
||||
stream->Read(fCasterLatencyIsDefault);
|
||||
if (fCasterLatencyIsDefault != 0) stream->Read(fCasterLatency);
|
||||
stream.Read(fCasterLatencyIsDefault);
|
||||
if (fCasterLatencyIsDefault != 0) stream.Read(fCasterLatency);
|
||||
|
||||
bool iCastTypeIsDefault{};
|
||||
stream->Read(iCastTypeIsDefault);
|
||||
if (iCastTypeIsDefault != 0) stream->Read(iCastType);
|
||||
stream.Read(iCastTypeIsDefault);
|
||||
if (iCastTypeIsDefault != 0) stream.Read(iCastType);
|
||||
|
||||
bool lastClickedPositIsDefault{};
|
||||
stream->Read(lastClickedPositIsDefault);
|
||||
if (lastClickedPositIsDefault != 0) stream->Read(lastClickedPosit);
|
||||
stream.Read(lastClickedPositIsDefault);
|
||||
if (lastClickedPositIsDefault != 0) stream.Read(lastClickedPosit);
|
||||
|
||||
stream->Read(optionalOriginatorID);
|
||||
stream.Read(optionalOriginatorID);
|
||||
|
||||
bool optionalTargetIDIsDefault{};
|
||||
stream->Read(optionalTargetIDIsDefault);
|
||||
if (optionalTargetIDIsDefault != 0) stream->Read(optionalTargetID);
|
||||
stream.Read(optionalTargetIDIsDefault);
|
||||
if (optionalTargetIDIsDefault != 0) stream.Read(optionalTargetID);
|
||||
|
||||
bool originatorRotIsDefault{};
|
||||
stream->Read(originatorRotIsDefault);
|
||||
if (originatorRotIsDefault != 0) stream->Read(originatorRot);
|
||||
stream.Read(originatorRotIsDefault);
|
||||
if (originatorRotIsDefault != 0) stream.Read(originatorRot);
|
||||
|
||||
uint32_t sBitStreamLength{};
|
||||
stream->Read(sBitStreamLength);
|
||||
stream.Read(sBitStreamLength);
|
||||
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
||||
unsigned char character;
|
||||
stream->Read(character);
|
||||
stream.Read(character);
|
||||
sBitStream.push_back(character);
|
||||
}
|
||||
|
||||
stream->Read(skillID);
|
||||
stream.Read(skillID);
|
||||
|
||||
bool uiSkillHandleIsDefault{};
|
||||
stream->Read(uiSkillHandleIsDefault);
|
||||
if (uiSkillHandleIsDefault != 0) stream->Read(uiSkillHandle);
|
||||
stream.Read(uiSkillHandleIsDefault);
|
||||
if (uiSkillHandleIsDefault != 0) stream.Read(uiSkillHandle);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
echoStartSkill.sBitStream = startSkill.sBitStream;
|
||||
echoStartSkill.skillID = startSkill.skillID;
|
||||
echoStartSkill.uiSkillHandle = startSkill.uiSkillHandle;
|
||||
echoStartSkill.Serialize(&bitStreamLocal);
|
||||
echoStartSkill.Serialize(bitStreamLocal);
|
||||
|
||||
Game::server->Send(&bitStreamLocal, entity->GetSystemAddress(), true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user