[raknet] Match RakPeer::GetStatistics(...)

This commit is contained in:
RD42 2024-08-19 22:29:46 +08:00
parent c17f510bb7
commit 4476060360

View File

@ -2340,7 +2340,7 @@ RakNetStatisticsStruct * const RakPeer::GetStatistics( const PlayerID playerId )
{ {
if (playerId==UNASSIGNED_PLAYER_ID) if (playerId==UNASSIGNED_PLAYER_ID)
{ {
bool firstWrite=false; bool firstWrite=true;
static RakNetStatisticsStruct sum; static RakNetStatisticsStruct sum;
RakNetStatisticsStruct *systemStats; RakNetStatisticsStruct *systemStats;
// Return a crude sum // Return a crude sum
@ -2350,8 +2350,11 @@ RakNetStatisticsStruct * const RakPeer::GetStatistics( const PlayerID playerId )
{ {
systemStats=remoteSystemList[ i ].reliabilityLayer.GetStatistics(); systemStats=remoteSystemList[ i ].reliabilityLayer.GetStatistics();
if (firstWrite==false) if (firstWrite==true)
{
memcpy(&sum, systemStats, sizeof(RakNetStatisticsStruct)); memcpy(&sum, systemStats, sizeof(RakNetStatisticsStruct));
firstWrite=false;
}
else else
sum+=*systemStats; sum+=*systemStats;
} }