@@ -1380,38 +1380,56 @@ void ConnectionManager::updateRunAhead(Int oldRunAhead, Int frameRate, Bool didS
13801380 }
13811381}
13821382
1383- Real ConnectionManager::getMaximumLatency () {
1384- #if defined(GENERALS_ONLINE)
1385- Real Maxlat = 0 .0f ;
1383+ Real ConnectionManager::getMaximumLatency ()
1384+ {
1385+ ServiceConfig& serviceConf = NGMP_OnlineServicesManager::GetInstance ()->GetServiceConfig ();
1386+ int latencyLogicModel = serviceConf.network_latency_logic_model ;
1387+ // 0 = original
1388+ // 1 = pick highest between original and Valve latency (current)
1389+ // 2 = pick highest between original and Valve latency (historic)
1390+
1391+ Real maxLatency = 0 .0f ;
13861392
13871393 for (Int i = 0 ; i < MAX_SLOTS ; ++i) {
1388- if (isPlayerConnected (i) && m_latencyAverages[i] > Maxlat ) {
1389- Maxlat = m_latencyAverages[i];
1394+ if (isPlayerConnected (i) && m_latencyAverages[i] > maxLatency ) {
1395+ maxLatency = m_latencyAverages[i];
13901396 }
13911397 }
13921398
1393- // TheSuperHackers @info the latencyAverage is the roundtrip latency
1394- return Maxlat;
1395- #else
1396- // This works for 2 player games because the latency for the packet router is always 0.
1397- Real lat1 = 0.0 ;
1398- Real lat2 = 0.0 ;
13991399
1400- for (Int i = 0 ; i < MAX_SLOTS ; ++i) {
1401- if (isPlayerConnected (i)) {
1402- if (m_latencyAverages[i] != 0.0 ) {
1403- if (m_latencyAverages[i] > lat1) {
1404- lat2 = lat1;
1405- lat1 = m_latencyAverages[i];
1406- } else if (m_latencyAverages[i] > lat2) {
1407- lat2 = m_latencyAverages[i];
1408- }
1409- }
1400+ if (latencyLogicModel == 0 )
1401+ {
1402+ return maxLatency;
1403+ }
1404+ else if (latencyLogicModel == 1 )
1405+ {
1406+ NetworkMesh* pMesh = NGMP_OnlineServicesManager::GetNetworkMesh ();
1407+
1408+ if (pMesh != nullptr )
1409+ {
1410+ Real maxGOLatency = (pMesh->getMaximumLatency () / 1000 .f );
1411+ return maxLatency > maxGOLatency ? maxLatency : maxGOLatency;
1412+ }
1413+ else
1414+ {
1415+ return maxLatency;
1416+ }
1417+ }
1418+ else if (latencyLogicModel == 2 )
1419+ {
1420+ NetworkMesh* pMesh = NGMP_OnlineServicesManager::GetNetworkMesh ();
1421+ if (pMesh != nullptr )
1422+ {
1423+ Real maxGOLatency = (pMesh->getMaximumHistoricalLatency () / 1000 .f );
1424+ return maxLatency > maxGOLatency ? maxLatency : maxGOLatency;
1425+ }
1426+ else
1427+ {
1428+ return maxLatency;
14101429 }
14111430 }
14121431
1413- return (lat1 + lat2);
1414- #endif
1432+ return maxLatency;
14151433}
14161434
14171435void ConnectionManager::getMinimumFps (Int &minFps, Int &minFpsPlayer) {
0 commit comments