Skip to content

Commit

Permalink
Restore custom enet modification by adding enet_host_broadcast_except
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmanek94 committed Apr 28, 2024
1 parent ce26181 commit 0593d22
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Source/Vendor/Enet/Source/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,30 @@ enet_host_broadcast (ENetHost * host, enet_uint8 channelID, ENetPacket * packet)
enet_packet_destroy (packet);
}

/** Queues a packet to be sent to all peers associated with the host.
@param host host on which to broadcast the packet
@param channelID channel on which to broadcast
@param packet packet to broadcast
*/
void
enet_host_broadcast_except(ENetHost* host, enet_uint8 channelID, ENetPacket* packet, ENetPeer* except)
{
ENetPeer* currentPeer;

for (currentPeer = host->peers;
currentPeer < &host->peers[host->peerCount];
++currentPeer)
{
if (currentPeer->state != ENET_PEER_STATE_CONNECTED || currentPeer == except)
continue;

enet_peer_send(currentPeer, channelID, packet);
}

if (packet->referenceCount == 0)
enet_packet_destroy(packet);
}

/** Sets the packet compressor the host should use to compress and decompress packets.
@param host host to enable or disable compression for
@param compressor callbacks for for the packet compressor; if NULL, then compression is disabled
Expand Down

0 comments on commit 0593d22

Please sign in to comment.