From 6cc91faa0e0aec5abb7f7d143d186119da5c7029 Mon Sep 17 00:00:00 2001 From: katursis Date: Sat, 11 Sep 2021 11:20:40 +0000 Subject: [PATCH] Add orderingchannel param to PR_SendPacket, PR_SendRPC --- src/Pawn.RakNet.inc | 8 ++++---- src/script.cc | 15 +++++++++------ src/script.h | 11 +++++++---- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/Pawn.RakNet.inc b/src/Pawn.RakNet.inc index 306a5e4..ea5a1ad 100644 --- a/src/Pawn.RakNet.inc +++ b/src/Pawn.RakNet.inc @@ -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); diff --git a/src/script.cc b/src/script.cc index 9a96721..4bf3364 100644 --- a/src/script.cc +++ b/src/script.cc @@ -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) @@ -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) diff --git a/src/script.h b/src/script.h index bee8803..8a15390 100644 --- a/src/script.h +++ b/src/script.h @@ -41,15 +41,18 @@ class Script : public ptl::AbstractScript