Skip to content

Commit

Permalink
Add orderingchannel param to PR_SendPacket, PR_SendRPC
Browse files Browse the repository at this point in the history
  • Loading branch information
katursis committed Sep 11, 2021
1 parent 1d65965 commit 6cc91fa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/Pawn.RakNet.inc
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,13 @@

native PR_Init(); // internal

native PR_SendPacket(BitStream:bs, playerid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED);
native PR_SendRPC(BitStream:bs, playerid, rpcid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED);
native PR_SendPacket(BitStream:bs, playerid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED, orderingchannel = 0);
native PR_SendRPC(BitStream:bs, playerid, rpcid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED, orderingchannel = 0);

#pragma deprecated Use PR_SendPacket instead
native BS_Send(BitStream:bs, playerid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED) = PR_SendPacket;
native BS_Send(BitStream:bs, playerid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED, orderingchannel = 0) = PR_SendPacket;
#pragma deprecated Use PR_SendRPC instead
native BS_RPC(BitStream:bs, playerid, rpcid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED) = PR_SendRPC;
native BS_RPC(BitStream:bs, playerid, rpcid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED, orderingchannel = 0) = PR_SendRPC;

native PR_EmulateIncomingPacket(BitStream:bs, playerid);
native PR_EmulateIncomingRPC(BitStream:bs, playerid, rpcid);
Expand Down
15 changes: 9 additions & 6 deletions src/script.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ cell Script::PR_RegHandler(unsigned char event_id, std::string public_name,
}

// native PR_SendPacket(BitStream:bs, playerid, PR_PacketPriority:priority =
// PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED);
// PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED,
// orderingchannel = 0);
cell Script::PR_SendPacket(BitStream *bs, int player_id,
PR_PacketPriority priority,
PR_PacketReliability reliability) {
PR_PacketReliability reliability,
unsigned char ordering_channel) {
const bool broadcast = player_id == -1;

auto &rakserver = Plugin::Get().GetRakServer();

return rakserver->Send(bs, priority, reliability, '\0',
return rakserver->Send(bs, priority, reliability, ordering_channel,
broadcast ? UNASSIGNED_PLAYER_ID
: rakserver->GetPlayerIDFromIndex(player_id),
broadcast)
Expand All @@ -58,15 +60,16 @@ cell Script::PR_SendPacket(BitStream *bs, int player_id,

// native PR_SendRPC(BitStream:bs, playerid, rpcid, PR_PacketPriority:priority
// = PR_HIGH_PRIORITY, PR_PacketReliability:reliability =
// PR_RELIABLE_ORDERED);
// PR_RELIABLE_ORDERED, orderingchannel = 0);
cell Script::PR_SendRPC(BitStream *bs, int player_id, RPCIndex rpc_id,
PR_PacketPriority priority,
PR_PacketReliability reliability) {
PR_PacketReliability reliability,
unsigned char ordering_channel) {
const bool broadcast = player_id == -1;

auto &rakserver = Plugin::Get().GetRakServer();

return rakserver->RPC(&rpc_id, bs, priority, reliability, '\0',
return rakserver->RPC(&rpc_id, bs, priority, reliability, ordering_channel,
broadcast ? UNASSIGNED_PLAYER_ID
: rakserver->GetPlayerIDFromIndex(player_id),
broadcast, false)
Expand Down
11 changes: 7 additions & 4 deletions src/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,18 @@ class Script : public ptl::AbstractScript<Script> {
PR_EventType type);

// native PR_SendPacket(BitStream:bs, playerid, PR_PacketPriority:priority =
// PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED);
// PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED,
// orderingchannel = 0);
cell PR_SendPacket(BitStream *bs, int player_id, PR_PacketPriority priority,
PR_PacketReliability reliability);
PR_PacketReliability reliability,
unsigned char ordering_channel);

// native PR_SendRPC(BitStream:bs, playerid, rpcid, PR_PacketPriority:priority
// = PR_HIGH_PRIORITY, PR_PacketReliability:reliability =
// PR_RELIABLE_ORDERED);
// PR_RELIABLE_ORDERED, orderingchannel = 0);
cell PR_SendRPC(BitStream *bs, int player_id, RPCIndex rpc_id,
PR_PacketPriority priority, PR_PacketReliability reliability);
PR_PacketPriority priority, PR_PacketReliability reliability,
unsigned char ordering_channel);

// native PR_EmulateIncomingPacket(BitStream:bs, playerid);
cell PR_EmulateIncomingPacket(BitStream *bs, int player_id);
Expand Down

0 comments on commit 6cc91fa

Please sign in to comment.