diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index 5f22711d..c0052218 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -1712,9 +1712,9 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client if(stats != NULL) { int fileProgress = 0; if(stats->download_total > 0) { - fileProgress = (stats->download_now * 100.0 / stats->download_total); + fileProgress = ((stats->download_now / stats->download_total) * 100.0); } - printf("Got FTP Callback for [%s] fileProgress = %d [now = %f, total = %f]\n",itemName.c_str(),fileProgress,stats->download_now,stats->download_total); + printf("Got FTP Callback for [%s] current file [%s] fileProgress = %d [now = %f, total = %f]\n",itemName.c_str(),stats->currentFilename.c_str(), fileProgress,stats->download_now,stats->download_total); fileFTPProgressList[itemName] = pair(fileProgress,stats->currentFilename); } diff --git a/source/shared_lib/sources/platform/posix/miniftpclient.cpp b/source/shared_lib/sources/platform/posix/miniftpclient.cpp index 3c2d6e14..4ee7c932 100644 --- a/source/shared_lib/sources/platform/posix/miniftpclient.cpp +++ b/source/shared_lib/sources/platform/posix/miniftpclient.cpp @@ -91,7 +91,10 @@ static long file_is_comming(struct curl_fileinfo *finfo,void *data,int remains) if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n===> FTP Client thread file_is_comming: remains: [%3d] filename: [%s] size: [%10luB] ", remains, finfo->filename,(unsigned long)finfo->size); if(out != NULL) { - out->currentFilename = finfo->filename; + //out->currentFilename = finfo->filename; + out->currentFilename = fullFilePath; + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" current filename: [%s] ", fullFilePath.c_str()); } switch(finfo->filetype) { @@ -263,7 +266,8 @@ void FTPClientThread::getMapFromServer(string mapFileName) { } if(this->pCBObject != NULL) { - this->pCBObject->FTPClient_CallbackEvent(mapFileName,ftp_cct_Map,result,NULL); + MutexSafeWrapper safeMutex(this->getProgressMutex()); + this->pCBObject->FTPClient_CallbackEvent(mapFileName,ftp_cct_Map,result,NULL); } } @@ -288,7 +292,8 @@ void FTPClientThread::getTilesetFromServer(string tileSetName) { } if(this->pCBObject != NULL) { - this->pCBObject->FTPClient_CallbackEvent(tileSetName,ftp_cct_Tileset,result,NULL); + MutexSafeWrapper safeMutex(this->getProgressMutex()); + this->pCBObject->FTPClient_CallbackEvent(tileSetName,ftp_cct_Tileset,result,NULL); } }