summaryrefslogtreecommitdiffstats
path: root/src/network/packet.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/packet.h')
-rw-r--r--src/network/packet.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/network/packet.h b/src/network/packet.h
index 026271701..94b351ab1 100644
--- a/src/network/packet.h
+++ b/src/network/packet.h
@@ -115,6 +115,12 @@ private:
template <typename T>
Packet& Packet::operator>>(std::vector<T>& out_data) {
+ // First extract the size
+ u32 size = 0;
+ *this >> size;
+ out_data.resize(size);
+
+ // Then extract the data
for (std::size_t i = 0; i < out_data.size(); ++i) {
T character = 0;
*this >> character;
@@ -135,6 +141,10 @@ Packet& Packet::operator>>(std::array<T, S>& out_data) {
template <typename T>
Packet& Packet::operator<<(const std::vector<T>& in_data) {
+ // First insert the size
+ *this << static_cast<u32>(in_data.size());
+
+ // Then insert the data
for (std::size_t i = 0; i < in_data.size(); ++i) {
*this << in_data[i];
}