Core/PacketIO: Updated auction packets to newer build

This commit is contained in:
Shauren
2020-03-17 18:38:01 +01:00
parent 569f1c9f2a
commit 06cc0754b8
4 changed files with 17 additions and 14 deletions

View File

@@ -427,23 +427,24 @@ class TC_SHARED_API ByteBuffer
_rpos += skip;
}
template <typename T>
template <typename T, typename Underlying = T>
T read()
{
ResetBitPos();
T r = read<T>(_rpos);
_rpos += sizeof(T);
T r = read<T, Underlying>(_rpos);
_rpos += sizeof(Underlying);
return r;
}
template <typename T>
template <typename T, typename Underlying = T>
T read(size_t pos) const
{
if (pos + sizeof(T) > size())
throw ByteBufferPositionException(pos, sizeof(T), size());
T val = *((T const*)&_storage[pos]);
if (pos + sizeof(Underlying) > size())
throw ByteBufferPositionException(pos, sizeof(Underlying), size());
Underlying val;
std::memcpy(&val, &_storage[pos], sizeof(Underlying));
EndianConvert(val);
return val;
return static_cast<T>(val);
}
template<class T>