mirror of
https://github.com/glest/glest-source.git
synced 2025-08-11 10:54:01 +02:00
- bugfix for CRC handling in connected menu
This commit is contained in:
@@ -1819,6 +1819,9 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client
|
|||||||
fileFTPProgressList.erase(itemName);
|
fileFTPProgressList.erase(itemName);
|
||||||
safeMutexFTPProgress.ReleaseLock();
|
safeMutexFTPProgress.ReleaseLock();
|
||||||
|
|
||||||
|
// Clear the CRC file Cache
|
||||||
|
Checksum::clearFileCache();
|
||||||
|
|
||||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||||
ClientInterface* clientInterface= networkManager.getClientInterface();
|
ClientInterface* clientInterface= networkManager.getClientInterface();
|
||||||
const GameSettings *gameSettings = clientInterface->getGameSettings();
|
const GameSettings *gameSettings = clientInterface->getGameSettings();
|
||||||
@@ -1889,6 +1892,9 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client
|
|||||||
}
|
}
|
||||||
// END
|
// END
|
||||||
|
|
||||||
|
// Clear the CRC file Cache
|
||||||
|
Checksum::clearFileCache();
|
||||||
|
|
||||||
// Reload tilesets for the UI
|
// Reload tilesets for the UI
|
||||||
findDirs(Config::getInstance().getPathListForType(ptTilesets), tileSets);
|
findDirs(Config::getInstance().getPathListForType(ptTilesets), tileSets);
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@ private:
|
|||||||
static std::map<string,int32> fileListCache;
|
static std::map<string,int32> fileListCache;
|
||||||
|
|
||||||
void addSum(int32 value);
|
void addSum(int32 value);
|
||||||
void addFileToSum(const string &path);
|
bool addFileToSum(const string &path);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Checksum();
|
Checksum();
|
||||||
@@ -49,6 +49,9 @@ public:
|
|||||||
void addByte(int8 value);
|
void addByte(int8 value);
|
||||||
void addString(const string &value);
|
void addString(const string &value);
|
||||||
void addFile(const string &path);
|
void addFile(const string &path);
|
||||||
|
|
||||||
|
static void removeFileFromCache(const string file);
|
||||||
|
static void clearFileCache();
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
@@ -66,7 +66,7 @@ void Checksum::addFile(const string &path){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checksum::addFileToSum(const string &path){
|
bool Checksum::addFileToSum(const string &path){
|
||||||
|
|
||||||
// OLD SLOW FILE I/O
|
// OLD SLOW FILE I/O
|
||||||
/*
|
/*
|
||||||
@@ -115,10 +115,10 @@ void Checksum::addFileToSum(const string &path){
|
|||||||
free(data);
|
free(data);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bool fileExists = false;
|
||||||
FILE* file= fopen(path.c_str(), "rb");
|
FILE* file= fopen(path.c_str(), "rb");
|
||||||
if(file!=NULL) {
|
if(file != NULL) {
|
||||||
|
fileExists = true;
|
||||||
addString(lastFile(path));
|
addString(lastFile(path));
|
||||||
|
|
||||||
bool isXMLFile = (EndsWith(path, ".xml") == true);
|
bool isXMLFile = (EndsWith(path, ".xml") == true);
|
||||||
@@ -162,12 +162,11 @@ void Checksum::addFileToSum(const string &path){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
throw runtime_error("Can not open file: " + path);
|
throw runtime_error("Can not open file: " + path);
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
return fileExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 Checksum::getSum() {
|
int32 Checksum::getSum() {
|
||||||
@@ -200,4 +199,14 @@ int32 Checksum::getFileCount() {
|
|||||||
return (int32)fileList.size();
|
return (int32)fileList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Checksum::removeFileFromCache(const string file) {
|
||||||
|
if(Checksum::fileListCache.find(file) != Checksum::fileListCache.end()) {
|
||||||
|
Checksum::fileListCache.erase(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Checksum::clearFileCache() {
|
||||||
|
Checksum::fileListCache.clear();
|
||||||
|
}
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
Reference in New Issue
Block a user