summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-04-26 01:15:46 +0200
committersapier <Sapier at GMX dot net>2014-04-29 20:45:16 +0200
commitc03d7dc8a7c35708a39f9c14e2df243e212b283b (patch)
treec99b8036e8ef45ab9228625570d860eefe5ac8d2 /src/game.cpp
parent088b18da3db8677a8af071e6e1534e54f73640b5 (diff)
downloadminetest-c03d7dc8a7c35708a39f9c14e2df243e212b283b.tar.gz
minetest-c03d7dc8a7c35708a39f9c14e2df243e212b283b.tar.bz2
minetest-c03d7dc8a7c35708a39f9c14e2df243e212b283b.zip
Add download rate to media progress bar (non http mode only!)
Minor coding style fixes
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp20
1 files changed, 17 insertions, 3 deletions
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