Server makes sure the client can receive the packet before sending/tunnelling

This commit is contained in:
MysterD 2021-06-13 17:57:54 -07:00
parent 59d08a90b9
commit 518a1fda4b
1 changed files with 11 additions and 0 deletions

View File

@ -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);