@@ -462,12 +462,16 @@ void NGMP_OnlineServices_LobbyInterface::SearchForLobbies(std::function<void()>
462462 std::map<std::string, std::string> mapHeaders;
463463
464464 NGMP_OnlineServicesManager::GetInstance ()->GetHTTPManager ()->SendGETRequest (strURI.c_str (), EIPProtocolVersion::DONT_CARE , mapHeaders, [=](bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)
465- {
466- // TODO_NGMP: Error handling
467- try
468465 {
469- nlohmann::json jsonObject = nlohmann::json::parse (strBody);
466+ try
467+ {
468+ nlohmann::json jsonObject = nlohmann::json::parse (strBody);
469+
470+ std::vector<int > vecLatencies;
470471
472+ jsonObject[" latencies" ].get_to (vecLatencies);
473+
474+ int latencyIndex = 0 ;
471475 for (const auto & lobbyEntryIter : jsonObject[" lobbies" ])
472476 {
473477 LobbyEntry lobbyEntry;
@@ -490,6 +494,19 @@ void NGMP_OnlineServices_LobbyInterface::SearchForLobbies(std::function<void()>
490494 lobbyEntryIter[" IniCRC" ].get_to (lobbyEntry.ini_crc );
491495 lobbyEntryIter[" MatchID" ].get_to (lobbyEntry.match_id );
492496 lobbyEntryIter[" LobbyType" ].get_to (lobbyEntry.lobby_type );
497+ lobbyEntryIter[" Region" ].get_to (lobbyEntry.region );
498+
499+ // attach latency
500+ if (latencyIndex < vecLatencies.size ())
501+ {
502+ lobbyEntry.latency = vecLatencies[latencyIndex];
503+ }
504+ else
505+ {
506+ // dummy value
507+ lobbyEntry.latency = 9001 ;
508+ }
509+ ++latencyIndex;
493510
494511 // correct map path
495512 if (lobbyEntry.map_official )
@@ -722,6 +739,7 @@ void NGMP_OnlineServices_LobbyInterface::UpdateRoomDataCache(std::function<void(
722739 lobbyEntryIter[" IniCRC" ].get_to (lobbyEntry.ini_crc );
723740 lobbyEntryIter[" MatchID" ].get_to (lobbyEntry.match_id );
724741 lobbyEntryIter[" LobbyType" ].get_to (lobbyEntry.lobby_type );
742+ lobbyEntryIter[" Region" ].get_to (lobbyEntry.region );
725743
726744 // store, we'll need it later and lobby obj gets destroyed on leave
727745 m_CurrentMatchID = lobbyEntry.match_id ;
0 commit comments