From c03d7dc8a7c35708a39f9c14e2df243e212b283b Mon Sep 17 00:00:00 2001 From: sapier Date: Sat, 26 Apr 2014 01:15:46 +0200 Subject: Add download rate to media progress bar (non http mode only!) Minor coding style fixes --- src/game.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 567c2c776..51e97d61b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1432,10 +1432,24 @@ void the_game(bool &kill, bool random_input, InputHandler *input, } else { - wchar_t* text = wgettext("Media..."); + + std::stringstream message; + message.precision(3); + message << gettext("Media..."); + + if ( ( USE_CURL == 0) || + (!g_settings->getBool("enable_remote_media_server"))) { + float cur = client.getCurRate(); + std::string cur_unit = gettext(" KB/s"); + + if (cur > 900) { + cur /= 1024.0; + cur_unit = gettext(" MB/s"); + } + message << " ( " << cur << cur_unit << " )"; + } progress = 50+client.mediaReceiveProgress()*50+0.5; - draw_load_screen(text, device, font, dtime, progress); - delete[] text; + draw_load_screen(narrow_to_wide(message.str().c_str()), device, font, dtime, progress); } // On some computers framerate doesn't seem to be -- cgit v1.2.3