From 46575af1e9345185859b9b3eeae7a32c8d450cc0 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sat, 17 Aug 2024 21:29:07 +0800 Subject: [PATCH] [raknet] Implement/match `RakPeer::GetAnyPlayerIDFromIndex(...)` --- raknet/RakPeer.cpp | 12 ++++++++++++ raknet/RakPeer.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/raknet/RakPeer.cpp b/raknet/RakPeer.cpp index 3d255b4..84f2a3a 100644 --- a/raknet/RakPeer.cpp +++ b/raknet/RakPeer.cpp @@ -1466,6 +1466,18 @@ PlayerID RakPeer::GetPlayerIDFromIndex( int index ) return UNASSIGNED_PLAYER_ID; } + +// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +PlayerID RakPeer::GetAnyPlayerIDFromIndex( int index ) +{ + // remoteSystemList in user thread + if ( index >= 0 && index < maximumNumberOfPeers ) + return remoteSystemList[ index ].playerId; + + return UNASSIGNED_PLAYER_ID; +} + + // -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // Description: // Bans an IP from connecting. Banned IPs persist between connections. diff --git a/raknet/RakPeer.h b/raknet/RakPeer.h index 05b6054..11ca1ab 100644 --- a/raknet/RakPeer.h +++ b/raknet/RakPeer.h @@ -232,6 +232,8 @@ public: /// \return The PlayerID PlayerID GetPlayerIDFromIndex( int index ); + PlayerID GetAnyPlayerIDFromIndex( int index ); + /// Bans an IP from connecting. Banned IPs persist between connections but are not saved on shutdown nor loaded on startup. /// param[in] IP Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will ban all IP addresses starting with 128.0.0 /// \param[in] milliseconds how many ms for a temporary ban. Use 0 for a permanent ban