- more ftp bugfixes

This commit is contained in:
Mark Vejvoda 2010-12-29 08:10:22 +00:00
parent 0c3ceb7c99
commit d067be26d9
2 changed files with 25 additions and 18 deletions

View File

@ -56,6 +56,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
currentFactionName_factionPreview="";
ftpClientThread = NULL;
getMissingMapFromFTPServer = "";
getMissingMapFromFTPServerInProgress = false;
currentFactionLogo = "";
factionTexture=NULL;
@ -952,26 +953,29 @@ void MenuStateConnectedGame::update() {
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] hasFactions = %d, currentFactionName [%s]\n",__FILE__,__FUNCTION__,__LINE__,hasFactions,currentFactionName.c_str());
// map
if(currentMap != gameSettings->getMap()) {// load the setup again
currentMap = gameSettings->getMap();
}
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
bool mapLoaded = loadMapInfo(Map::getMapPath(currentMap,"",false), &mapInfo, true);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(mapLoaded == true) {
maps.push_back(formatString(gameSettings->getMap()));
}
else {
// try to get the map via ftp
if(ftpClientThread != NULL && getMissingMapFromFTPServer != currentMap) {
getMissingMapFromFTPServer = currentMap;
ftpClientThread->addMapToRequests(currentMap);
if(getMissingMapFromFTPServerInProgress == false) {
// map
if(currentMap != gameSettings->getMap()) {// load the setup again
currentMap = gameSettings->getMap();
}
maps.push_back("***missing***");
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
bool mapLoaded = loadMapInfo(Map::getMapPath(currentMap,"",false), &mapInfo, true);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(mapLoaded == true) {
maps.push_back(formatString(gameSettings->getMap()));
}
else {
// try to get the map via ftp
if(ftpClientThread != NULL && getMissingMapFromFTPServer != currentMap) {
getMissingMapFromFTPServer = currentMap;
getMissingMapFromFTPServerInProgress = true;
ftpClientThread->addMapToRequests(currentMap);
}
maps.push_back("***missing***");
}
listBoxMap.setItems(maps);
labelMapInfo.setText(mapInfo.desc);
}
listBoxMap.setItems(maps);
labelMapInfo.setText(mapInfo.desc);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
@ -1569,6 +1573,8 @@ void MenuStateConnectedGame::showMessageBox(const string &text, const string &he
void MenuStateConnectedGame::FTPClient_CallbackEvent(string mapFilename, FTP_Client_ResultType result) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
getMissingMapFromFTPServerInProgress = false;
printf("Got FTP Callback for [%s] result = %d\n",mapFilename.c_str(),result);
}

View File

@ -138,6 +138,7 @@ private:
FTPClientThread *ftpClientThread;
string getMissingMapFromFTPServer;
bool getMissingMapFromFTPServerInProgress;
public: