mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-12-18 09:20:04 +00:00
Compare commits
1 Commits
a87c8aadbd
...
1c979a76b6
Author | SHA1 | Date | |
---|---|---|---|
1c979a76b6 |
@ -95,11 +95,12 @@ static void sendAroundPacket(const EntityRef recipient, std::vector<std::vector<
|
|||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
data[i] = slice[i];
|
data[i] = slice[i];
|
||||||
}
|
}
|
||||||
recipient.sock->sendPacket(pktBuf, packetId, sizeof(int32_t) + (count * sizeof(T)));
|
recipient.sock->sendPacket(pktBuf, packetId, 4 + (count * sizeof(T)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sendAroundDelPacket(const EntityRef recipient, std::vector<std::vector<int32_t>>& slices, bool isTransportation, uint32_t packetId) {
|
template<class T>
|
||||||
|
static void sendAroundDelPacket(const EntityRef recipient, std::vector<std::vector<T>>& slices, bool isTransportation, uint32_t packetId) {
|
||||||
assert(recipient.kind == EntityKind::PLAYER);
|
assert(recipient.kind == EntityKind::PLAYER);
|
||||||
|
|
||||||
size_t maxCnt = MAX_IDS_PER_AROUND_DEL;
|
size_t maxCnt = MAX_IDS_PER_AROUND_DEL;
|
||||||
@ -112,22 +113,20 @@ static void sendAroundDelPacket(const EntityRef recipient, std::vector<std::vect
|
|||||||
int count = slice.size();
|
int count = slice.size();
|
||||||
assert(count <= maxCnt);
|
assert(count <= maxCnt);
|
||||||
|
|
||||||
size_t baseSize;
|
T* data;
|
||||||
if (isTransportation) {
|
if (isTransportation) {
|
||||||
sP_FE2CL_AROUND_DEL_TRANSPORTATION* pkt = (sP_FE2CL_AROUND_DEL_TRANSPORTATION*)pktBuf;
|
*((int32_t*)pktBuf) = 3; // eTT
|
||||||
pkt->eTT = 3;
|
*((int32_t*)pktBuf + sizeof(int32_t)) = count;
|
||||||
pkt->iCnt = count;
|
data = (T*)(pktBuf + sizeof(int32_t) + sizeof(int32_t));
|
||||||
baseSize = sizeof(sP_FE2CL_AROUND_DEL_TRANSPORTATION);
|
|
||||||
} else {
|
} else {
|
||||||
*((int32_t*)pktBuf) = count;
|
*((int32_t*)pktBuf) = count;
|
||||||
baseSize = sizeof(int32_t);
|
data = (T*)(pktBuf + sizeof(int32_t));
|
||||||
}
|
}
|
||||||
int32_t* ids = (int32_t*)(pktBuf + baseSize);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
ids[i] = slice[i];
|
data[i] = slice[i];
|
||||||
}
|
}
|
||||||
recipient.sock->sendPacket(pktBuf, packetId, baseSize + (count * sizeof(int32_t)));
|
recipient.sock->sendPacket(pktBuf, packetId, isTransportation ? 8 : 4 + (count * sizeof(T)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user