Fix problem where reliable packets were only reliable for one client instead of all
This commit is contained in:
parent
cb3a0b3006
commit
a5c8643f3f
|
@ -256,7 +256,10 @@ void network_send_to(u8 localIndex, struct Packet* p) {
|
|||
|
||||
void network_send(struct Packet* p) {
|
||||
// prevent errors during writing from propagating
|
||||
if (p->writeError) { return; }
|
||||
if (p->writeError) {
|
||||
LOG_ERROR("packet has write error: %u", p->packetType);
|
||||
return;
|
||||
}
|
||||
|
||||
// set the flags again
|
||||
packet_set_flags(p);
|
||||
|
@ -266,6 +269,7 @@ void network_send(struct Packet* p) {
|
|||
if (gNetworkSystem != NULL && gNetworkSystem->requireServerBroadcast && gNetworkPlayerServer != NULL) {
|
||||
int i = gNetworkPlayerServer->localIndex;
|
||||
p->localIndex = i;
|
||||
p->sent = false;
|
||||
network_send_to(i, p);
|
||||
return;
|
||||
}
|
||||
|
@ -288,6 +292,7 @@ void network_send(struct Packet* p) {
|
|||
}
|
||||
|
||||
p->localIndex = i;
|
||||
p->sent = false;
|
||||
network_send_to(i, p);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ void packet_receive(struct Packet* p) {
|
|||
}
|
||||
|
||||
// check if we've already seen this packet
|
||||
if (p->localIndex != 0 && p->seqId != 0 && gNetworkPlayers[p->localIndex].connected) {
|
||||
if (p->localIndex != 0 && p->localIndex != UNKNOWN_LOCAL_INDEX && p->seqId != 0 && gNetworkPlayers[p->localIndex].connected) {
|
||||
u32 packetHash = packet_hash(p);
|
||||
struct NetworkPlayer* np = &gNetworkPlayers[p->localIndex];
|
||||
for (int i = 0; i < MAX_RX_SEQ_IDS; i++) {
|
||||
|
@ -164,7 +164,7 @@ void packet_receive(struct Packet* p) {
|
|||
packet_process(p);
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("packet initial read failed, packetType: %d", packetType);
|
||||
LOG_ERROR("packet initial read failed, packetType: %d", packetType);
|
||||
}
|
||||
|
||||
// broadcast packet
|
||||
|
|
Loading…
Reference in New Issue