From b988724937a518f800ad13091bd1e8b5e28dbcbd Mon Sep 17 00:00:00 2001 From: Gent Semaj Date: Sun, 27 Oct 2024 11:55:06 -0700 Subject: [PATCH] More cleanup --- src/Chunking.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Chunking.cpp b/src/Chunking.cpp index afdb298..06ba53f 100644 --- a/src/Chunking.cpp +++ b/src/Chunking.cpp @@ -95,12 +95,11 @@ static void sendAroundPacket(const EntityRef recipient, std::vectorsendPacket(pktBuf, packetId, 4 + (count * sizeof(T))); + recipient.sock->sendPacket(pktBuf, packetId, sizeof(int32_t) + (count * sizeof(T))); } } -template -static void sendAroundDelPacket(const EntityRef recipient, std::vector>& slices, bool isTransportation, uint32_t packetId) { +static void sendAroundDelPacket(const EntityRef recipient, std::vector>& slices, bool isTransportation, uint32_t packetId) { assert(recipient.kind == EntityKind::PLAYER); size_t maxCnt = MAX_IDS_PER_AROUND_DEL; @@ -113,20 +112,22 @@ static void sendAroundDelPacket(const EntityRef recipient, std::vectoreTT = 3; + pkt->iCnt = count; + baseSize = sizeof(sP_FE2CL_AROUND_DEL_TRANSPORTATION); } else { *((int32_t*)pktBuf) = count; - data = (T*)(pktBuf + sizeof(int32_t)); + baseSize = sizeof(int32_t); } + int32_t* ids = (int32_t*)(pktBuf + baseSize); for (size_t i = 0; i < count; i++) { - data[i] = slice[i]; + ids[i] = slice[i]; } - recipient.sock->sendPacket(pktBuf, packetId, isTransportation ? 8 : 4 + (count * sizeof(T))); + recipient.sock->sendPacket(pktBuf, packetId, baseSize + (count * sizeof(int32_t))); } }