Core/PacketIO: Added util to skip packet fields
This commit is contained in:
@@ -175,10 +175,7 @@ ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo)
|
|||||||
data >> movementInfo.gravityModifier;
|
data >> movementInfo.gravityModifier;
|
||||||
|
|
||||||
for (uint32 i = 0; i < removeMovementForcesCount; ++i)
|
for (uint32 i = 0; i < removeMovementForcesCount; ++i)
|
||||||
{
|
data >> WorldPackets::Ignored<ObjectGuid>;
|
||||||
ObjectGuid guid;
|
|
||||||
data >> guid;
|
|
||||||
}
|
|
||||||
|
|
||||||
data >> WorldPackets::OptionalInit(movementInfo.standingOnGameObjectGUID);
|
data >> WorldPackets::OptionalInit(movementInfo.standingOnGameObjectGUID);
|
||||||
bool hasTransport = data.ReadBit();
|
bool hasTransport = data.ReadBit();
|
||||||
|
|||||||
@@ -495,6 +495,33 @@ namespace WorldPackets
|
|||||||
|
|
||||||
inline DataReaderWriter Data(std::span<uint8>& value) { return { value }; }
|
inline DataReaderWriter Data(std::span<uint8>& value) { return { value }; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct IgnoredReaderWriter
|
||||||
|
{
|
||||||
|
friend inline ByteBuffer& operator<<(ByteBuffer& data, IgnoredReaderWriter const& /*unused*/)
|
||||||
|
{
|
||||||
|
data << T();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend inline ByteBuffer& operator>>(ByteBuffer& data, IgnoredReaderWriter const& /*unused*/)
|
||||||
|
{
|
||||||
|
if constexpr (ByteBufferNumeric<T>)
|
||||||
|
{
|
||||||
|
data.read_skip<T>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
T dummy;
|
||||||
|
data >> dummy;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
inline constexpr IgnoredReaderWriter<T> Ignored;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TRINITYCORE_PACKET_OPERATORS_H
|
#endif // TRINITYCORE_PACKET_OPERATORS_H
|
||||||
|
|||||||
Reference in New Issue
Block a user