diff --git a/src/game/packet_parsers_classic.cpp b/src/game/packet_parsers_classic.cpp index bfa2550c..efb06c02 100644 --- a/src/game/packet_parsers_classic.cpp +++ b/src/game/packet_parsers_classic.cpp @@ -355,10 +355,10 @@ void ClassicPacketParsers::writeMovementPayload(network::Packet& packet, const M packet.writeUInt32(info.time); // Position - packet.writeBytes(reinterpret_cast(&info.x), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.y), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.z), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.orientation), sizeof(float)); + packet.writeFloat(info.x); + packet.writeFloat(info.y); + packet.writeFloat(info.z); + packet.writeFloat(info.orientation); // Transport data (Classic ONTRANSPORT = 0x02000000, no timestamp) if (wireFlags & ClassicMoveFlags::ONTRANSPORT) { @@ -379,10 +379,10 @@ void ClassicPacketParsers::writeMovementPayload(network::Packet& packet, const M } // Transport local position - packet.writeBytes(reinterpret_cast(&info.transportX), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.transportY), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.transportZ), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.transportO), sizeof(float)); + packet.writeFloat(info.transportX); + packet.writeFloat(info.transportY); + packet.writeFloat(info.transportZ); + packet.writeFloat(info.transportO); // Classic: NO transport timestamp // Classic: NO transport seat byte @@ -390,7 +390,7 @@ void ClassicPacketParsers::writeMovementPayload(network::Packet& packet, const M // Pitch (Classic: only SWIMMING) if (wireFlags & ClassicMoveFlags::SWIMMING) { - packet.writeBytes(reinterpret_cast(&info.pitch), sizeof(float)); + packet.writeFloat(info.pitch); } // Fall time (always present) @@ -398,10 +398,10 @@ void ClassicPacketParsers::writeMovementPayload(network::Packet& packet, const M // Jump data (Classic JUMPING = 0x2000) if (wireFlags & ClassicMoveFlags::JUMPING) { - packet.writeBytes(reinterpret_cast(&info.jumpVelocity), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.jumpSinAngle), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.jumpCosAngle), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.jumpXYSpeed), sizeof(float)); + packet.writeFloat(info.jumpVelocity); + packet.writeFloat(info.jumpSinAngle); + packet.writeFloat(info.jumpCosAngle); + packet.writeFloat(info.jumpXYSpeed); } } diff --git a/src/game/packet_parsers_tbc.cpp b/src/game/packet_parsers_tbc.cpp index 5cc3d057..71e91fe0 100644 --- a/src/game/packet_parsers_tbc.cpp +++ b/src/game/packet_parsers_tbc.cpp @@ -228,10 +228,10 @@ void TbcPacketParsers::writeMovementPayload(network::Packet& packet, const Movem packet.writeUInt32(info.time); // Position - packet.writeBytes(reinterpret_cast(&info.x), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.y), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.z), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.orientation), sizeof(float)); + packet.writeFloat(info.x); + packet.writeFloat(info.y); + packet.writeFloat(info.z); + packet.writeFloat(info.orientation); // Transport data (TBC ON_TRANSPORT = 0x200, same bit as WotLK) if (info.flags & TbcMoveFlags::ON_TRANSPORT) { @@ -252,10 +252,10 @@ void TbcPacketParsers::writeMovementPayload(network::Packet& packet, const Movem } // Transport local position - packet.writeBytes(reinterpret_cast(&info.transportX), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.transportY), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.transportZ), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.transportO), sizeof(float)); + packet.writeFloat(info.transportX); + packet.writeFloat(info.transportY); + packet.writeFloat(info.transportZ); + packet.writeFloat(info.transportO); // Transport time packet.writeUInt32(info.transportTime); @@ -266,9 +266,9 @@ void TbcPacketParsers::writeMovementPayload(network::Packet& packet, const Movem // Pitch: SWIMMING or else ONTRANSPORT (TBC flag positions) if (info.flags & TbcMoveFlags::SWIMMING) { - packet.writeBytes(reinterpret_cast(&info.pitch), sizeof(float)); + packet.writeFloat(info.pitch); } else if (info.flags & TbcMoveFlags::ONTRANSPORT) { - packet.writeBytes(reinterpret_cast(&info.pitch), sizeof(float)); + packet.writeFloat(info.pitch); } // Fall time (always present) @@ -276,10 +276,10 @@ void TbcPacketParsers::writeMovementPayload(network::Packet& packet, const Movem // Jump data (TBC JUMPING = 0x2000, WotLK FALLING = 0x1000) if (info.flags & TbcMoveFlags::JUMPING) { - packet.writeBytes(reinterpret_cast(&info.jumpVelocity), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.jumpSinAngle), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.jumpCosAngle), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.jumpXYSpeed), sizeof(float)); + packet.writeFloat(info.jumpVelocity); + packet.writeFloat(info.jumpSinAngle); + packet.writeFloat(info.jumpCosAngle); + packet.writeFloat(info.jumpXYSpeed); } } diff --git a/src/game/world_packets.cpp b/src/game/world_packets.cpp index c81cea73..41cff4e5 100644 --- a/src/game/world_packets.cpp +++ b/src/game/world_packets.cpp @@ -761,12 +761,12 @@ void MovementPacket::writeMovementPayload(network::Packet& packet, const Movemen packet.writeUInt32(info.time); // Write position - packet.writeBytes(reinterpret_cast(&info.x), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.y), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.z), sizeof(float)); + packet.writeFloat(info.x); + packet.writeFloat(info.y); + packet.writeFloat(info.z); // Write orientation - packet.writeBytes(reinterpret_cast(&info.orientation), sizeof(float)); + packet.writeFloat(info.orientation); // Write transport data if on transport. // 3.3.5a ordering: transport block appears before pitch/fall/jump. @@ -788,10 +788,10 @@ void MovementPacket::writeMovementPayload(network::Packet& packet, const Movemen } // Write transport local position - packet.writeBytes(reinterpret_cast(&info.transportX), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.transportY), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.transportZ), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.transportO), sizeof(float)); + packet.writeFloat(info.transportX); + packet.writeFloat(info.transportY); + packet.writeFloat(info.transportZ); + packet.writeFloat(info.transportO); // Write transport time packet.writeUInt32(info.transportTime); @@ -807,7 +807,7 @@ void MovementPacket::writeMovementPayload(network::Packet& packet, const Movemen // Write pitch if swimming/flying if (info.hasFlag(MovementFlags::SWIMMING) || info.hasFlag(MovementFlags::FLYING)) { - packet.writeBytes(reinterpret_cast(&info.pitch), sizeof(float)); + packet.writeFloat(info.pitch); } // Fall time is ALWAYS present in the packet (server reads it unconditionally). @@ -815,10 +815,10 @@ void MovementPacket::writeMovementPayload(network::Packet& packet, const Movemen packet.writeUInt32(info.fallTime); if (info.hasFlag(MovementFlags::FALLING)) { - packet.writeBytes(reinterpret_cast(&info.jumpVelocity), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.jumpSinAngle), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.jumpCosAngle), sizeof(float)); - packet.writeBytes(reinterpret_cast(&info.jumpXYSpeed), sizeof(float)); + packet.writeFloat(info.jumpVelocity); + packet.writeFloat(info.jumpSinAngle); + packet.writeFloat(info.jumpCosAngle); + packet.writeFloat(info.jumpXYSpeed); } }