X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2Fui.cpp;h=8768095559cdf6335cf24be4043984c6cd0a7632;hb=a957788426ff011acf662e29ec5fc0525c1a578f;hp=6c7ab6aa49ff53163b734c271e5fc0b92cf4bff9;hpb=225a7e66ed3f3f03ab458ab39c914ed55cd69600;p=blank.git diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp index 6c7ab6a..8768095 100644 --- a/src/ui/ui.cpp +++ b/src/ui/ui.cpp @@ -17,7 +17,7 @@ #include "../graphics/Viewport.hpp" #include "../io/TokenStreamReader.hpp" #include "../model/bounds.hpp" -#include "../net/ConnectionHandler.hpp" +#include "../net/CongestionControl.hpp" #include "../world/BlockLookup.hpp" #include "../world/World.hpp" #include "../world/WorldManipulator.hpp" @@ -381,19 +381,21 @@ void HUD::PostMessage(const char *msg) { } -void HUD::UpdateNetStats(const ConnectionHandler &conn) { +void HUD::UpdateNetStats(const CongestionControl &stat) { + if (!config.video.debug) return; + std::stringstream s; s << std::fixed << std::setprecision(1) - << "TX: " << conn.Upstream() - << "KB/s, RX: " << conn.Downstream() << "KB/s"; + << "TX: " << stat.Upstream() + << "KB/s, RX: " << stat.Downstream() << "KB/s"; bandwidth_text.Set(env.assets.small_ui_font, s.str()); s.str(""); - s << "RTT: " << conn.RoundTripTime() << "ms"; + s << "RTT: " << stat.RoundTripTime() << "ms"; rtt_text.Set(env.assets.small_ui_font, s.str()); s.str(""); - s << "Packet loss: " << (conn.PacketLoss() * 100.0f) << "%"; + s << "Packet loss: " << (stat.PacketLoss() * 100.0f) << "%"; packet_loss_text.Set(env.assets.small_ui_font, s.str()); show_net = true;