diff --git a/Source/DiabloUI/multi/selgame.cpp b/Source/DiabloUI/multi/selgame.cpp index 52914f1c7..e6965a118 100644 --- a/Source/DiabloUI/multi/selgame.cpp +++ b/Source/DiabloUI/multi/selgame.cpp @@ -288,6 +288,11 @@ void selgame_GameSelection_Focus(size_t value) infoString.append(playerName); infoString += ' '; } + infoString += '\n'; + if (gameInfo.peerIsRelayed.value_or(false)) + infoString.append(fmt::format(fmt::runtime(_("Latency: {:d} ms (RELAYED)")), gameInfo.latency.value_or(0))); + else + infoString.append(fmt::format(fmt::runtime(_("Latency: {:d} ms")), gameInfo.latency.value_or(0))); } else { infoString.append(GetErrorMessageIncompatibility(gameInfo.gameData)); } diff --git a/Source/dvlnet/base_protocol.h b/Source/dvlnet/base_protocol.h index 9d1685174..6678a6ab1 100644 --- a/Source/dvlnet/base_protocol.h +++ b/Source/dvlnet/base_protocol.h @@ -551,8 +551,10 @@ std::vector base_protocol

::get_gamelist() std::vector ret; ret.reserve(game_list.size()); for (const auto &[name, gameInfo] : game_list) { - const auto &[gameData, players, _] = gameInfo; - ret.push_back(GameInfo { name, gameData, players }); + const auto &[gameData, players, endpoint] = gameInfo; + std::optional latency = proto.get_latency_to(endpoint); + std::optional isRelayed = proto.is_peer_relayed(endpoint); + ret.push_back(GameInfo { name, gameData, players, latency, isRelayed }); } c_sort(ret, [](const GameInfo &a, const GameInfo &b) { return a.name < b.name; }); return ret; diff --git a/Source/multi.h b/Source/multi.h index 7fa38421e..8dfae3b87 100644 --- a/Source/multi.h +++ b/Source/multi.h @@ -45,6 +45,8 @@ struct GameInfo { std::string name; GameData gameData; std::vector players; + std::optional latency; + std::optional peerIsRelayed; }; extern bool gbSomebodyWonGameKludge;