From 518a1fda4b5b69f100cba56140aa6c28d576ab76 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sun, 13 Jun 2021 17:57:54 -0700 Subject: [PATCH] Server makes sure the client can receive the packet before sending/tunnelling --- src/pc/network/network.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/pc/network/network.c b/src/pc/network/network.c index a5b2ba4e..c2311a6b 100644 --- a/src/pc/network/network.c +++ b/src/pc/network/network.c @@ -118,6 +118,17 @@ void network_send_to(u8 localIndex, struct Packet* p) { assert(localIndex != gNetworkPlayerLocal->localIndex); } + if (gNetworkType == NT_SERVER) { + struct NetworkPlayer* np = &gNetworkPlayers[localIndex]; + // don't send a packet to a player that can't receive it + if (p->levelAreaMustMatch) { + if (p->courseNum != np->currCourseNum) { return; } + if (p->actNum != np->currActNum) { return; } + if (p->levelNum != np->currLevelNum) { return; } + if (p->areaIndex != np->currAreaIndex) { return; } + } + } + // set the flags again packet_set_flags(p);