From: <xa...@us...> - 2010-09-02 15:15:37
|
Revision: 5868 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5868&view=rev Author: xapantu Date: 2010-09-02 15:15:31 +0000 (Thu, 02 Sep 2010) Log Message: ----------- Improve the 'download in progress code' to be less verbose Modified Paths: -------------- main/trunk/src/addons/network.cpp Modified: main/trunk/src/addons/network.cpp =================================================================== --- main/trunk/src/addons/network.cpp 2010-09-02 15:11:03 UTC (rev 5867) +++ main/trunk/src/addons/network.cpp 2010-09-02 15:15:31 UTC (rev 5868) @@ -139,6 +139,8 @@ return false; } } +//FIXME : this way is a bit ugly but the simpliesst at the moment +int time_last_print = 0; int progressDownload (void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) { int progress = dlnow/dltotal*100; @@ -151,7 +153,15 @@ *progress_data = progress; } pthread_mutex_unlock(&download_mutex); - std::cout << "Download progress: " << progress << "%" << std::endl; + if(time_last_print > 10) + { + std::cout << "Download progress: " << progress << "%" << std::endl; + time_last_print = 0; + } + else + { + time_last_print += 1; + } return 0; } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |