From 447606036020e9a4dab022caac66db66d46ed691 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Mon, 19 Aug 2024 22:29:46 +0800 Subject: [PATCH] [raknet] Match `RakPeer::GetStatistics(...)` --- raknet/RakPeer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/raknet/RakPeer.cpp b/raknet/RakPeer.cpp index 21ef204..8e0cac6 100644 --- a/raknet/RakPeer.cpp +++ b/raknet/RakPeer.cpp @@ -2340,7 +2340,7 @@ RakNetStatisticsStruct * const RakPeer::GetStatistics( const PlayerID playerId ) { if (playerId==UNASSIGNED_PLAYER_ID) { - bool firstWrite=false; + bool firstWrite=true; static RakNetStatisticsStruct sum; RakNetStatisticsStruct *systemStats; // Return a crude sum @@ -2350,8 +2350,11 @@ RakNetStatisticsStruct * const RakPeer::GetStatistics( const PlayerID playerId ) { systemStats=remoteSystemList[ i ].reliabilityLayer.GetStatistics(); - if (firstWrite==false) + if (firstWrite==true) + { memcpy(&sum, systemStats, sizeof(RakNetStatisticsStruct)); + firstWrite=false; + } else sum+=*systemStats; }