From b84bede3df8a0e550fb9d1feb64e290f84ce435c Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 29 Dec 2010 06:11:06 +0000 Subject: [PATCH] - ftp file xfer bugfixes --- source/glest_game/menu/menu_state_connected_game.cpp | 4 +++- source/glest_game/menu/menu_state_connected_game.h | 1 + source/shared_lib/sources/platform/posix/miniftpclient.cpp | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index 022cad22..522ce014 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -55,6 +55,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM currentTechName_factionPreview=""; currentFactionName_factionPreview=""; ftpClientThread = NULL; + getMissingMapFromFTPServer = ""; currentFactionLogo = ""; factionTexture=NULL; @@ -963,7 +964,8 @@ void MenuStateConnectedGame::update() { } else { // try to get the map via ftp - if(ftpClientThread != NULL) { + if(ftpClientThread != NULL && getMissingMapFromFTPServer != currentMap) { + getMissingMapFromFTPServer = currentMap; ftpClientThread->addMapToRequests(currentMap); } maps.push_back("***missing***"); diff --git a/source/glest_game/menu/menu_state_connected_game.h b/source/glest_game/menu/menu_state_connected_game.h index 02d0624b..c05b1ac3 100644 --- a/source/glest_game/menu/menu_state_connected_game.h +++ b/source/glest_game/menu/menu_state_connected_game.h @@ -137,6 +137,7 @@ private: std::vector tileSets; FTPClientThread *ftpClientThread; + string getMissingMapFromFTPServer; public: diff --git a/source/shared_lib/sources/platform/posix/miniftpclient.cpp b/source/shared_lib/sources/platform/posix/miniftpclient.cpp index 56ae766e..83b81f00 100644 --- a/source/shared_lib/sources/platform/posix/miniftpclient.cpp +++ b/source/shared_lib/sources/platform/posix/miniftpclient.cpp @@ -87,7 +87,7 @@ void FTPClientThread::getMapFromServer(string mapFileName) { */ char szBuf[1024]=""; - sprintf(szBuf,"ftp://maps:mg_ftp_server@%s/maps/%s",serverUrl.c_str(),mapFileName.c_str()); + sprintf(szBuf,"ftp://maps:mg_ftp_server@%s/%s",serverUrl.c_str(),mapFileName.c_str()); curl_easy_setopt(curl, CURLOPT_URL,szBuf); /* Define our callback to get called when there's data to be written */ @@ -107,7 +107,7 @@ void FTPClientThread::getMapFromServer(string mapFileName) { /* we failed */ fprintf(stderr, "curl told us %d\n", res); - sprintf(szBuf,"ftp://maps_custom:mg_ftp_server@%s/maps/%s",serverUrl.c_str(),mapFileName.c_str()); + sprintf(szBuf,"ftp://maps_custom:mg_ftp_server@%s/%s",serverUrl.c_str(),mapFileName.c_str()); curl_easy_setopt(curl, CURLOPT_URL,szBuf); /* Define our callback to get called when there's data to be written */