From fe2854e3e08786822c6a1ec6fa7bc1f29799dcd7 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 10 Mar 2011 21:50:43 +0000 Subject: [PATCH] - force crc refresh right after clearing the cache after file xfer --- .../menu/menu_state_connected_game.cpp | 56 ++----------------- 1 file changed, 6 insertions(+), 50 deletions(-) diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index e4bc58a3..3b2a9075 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -1966,37 +1966,15 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client Checksum::clearFileCache(); vector paths = Config::getInstance().getPathListForType(ptTilesets); - //string cacheLookupId = CacheManager::getFolderTreeContentsCheckSumRecursivelyCacheLookupKey1; - //std::map &crcTreeCache = CacheManager::getCachedItem< std::map >(cacheLookupId); string pathSearchString = string("/") + itemName + string("/*"); const string filterFileExt = ".xml"; clearFolderTreeContentsCheckSum(paths, pathSearchString, filterFileExt); clearFolderTreeContentsCheckSumList(paths, pathSearchString, filterFileExt); -// string cacheKey = ""; -// size_t count = paths.size(); -// for(size_t idx = 0; idx < count; ++idx) { -// string path = paths[idx] + pathSearchString; -// -// cacheKey += path + "_" + filterFileExt + "_"; -// } -// if(crcTreeCache.find(cacheKey) != crcTreeCache.end()) { -// SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] CLEARING CACHED checksum for cacheKey [%s]\n",__FILE__,__FUNCTION__,__LINE__,cacheKey.c_str()); -// crcTreeCache.erase(cacheKey); -// } + // Refresh CRC + Config &config = Config::getInstance(); + int32 tilesetCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTilesets,""), string("/") + gameSettings->getTileset() + string("/*"), ".xml", NULL); -// string cacheLookupId = CacheManager::getFolderTreeContentsCheckSumRecursivelyCacheLookupKey2; -// std::map &crcTreeCache2 = CacheManager::getCachedItem< std::map >(cacheLookupId); -// -// for(size_t idx = 0; idx < paths.size(); ++idx) { -// string path = paths[idx] + pathSearchString; -// -// string cacheKey = path + "_" + filterFileExt; -// if(crcTreeCache2.find(cacheKey) != crcTreeCache2.end()) { -// SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] CLEARING CACHED checksum for cacheKey [%s]\n",__FILE__,__FUNCTION__,__LINE__,cacheKey.c_str()); -// crcTreeCache2.erase(cacheKey); -// } -// } safeMutexFTPProgress.ReleaseLock(); // END @@ -2046,37 +2024,15 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client Checksum::clearFileCache(); vector paths = Config::getInstance().getPathListForType(ptTechs); - //string cacheLookupId = CacheManager::getFolderTreeContentsCheckSumRecursivelyCacheLookupKey1; - //std::map &crcTreeCache = CacheManager::getCachedItem< std::map >(cacheLookupId); string pathSearchString = string("/") + itemName + string("/*"); const string filterFileExt = ".xml"; clearFolderTreeContentsCheckSum(paths, pathSearchString, filterFileExt); clearFolderTreeContentsCheckSumList(paths, pathSearchString, filterFileExt); -// string cacheKey = ""; -// size_t count = paths.size(); -// for(size_t idx = 0; idx < count; ++idx) { -// string path = paths[idx] + pathSearchString; -// -// cacheKey += path + "_" + filterFileExt + "_"; -// } -// if(crcTreeCache.find(cacheKey) != crcTreeCache.end()) { -// SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] CLEARING CACHED checksum for cacheKey [%s]\n",__FILE__,__FUNCTION__,__LINE__,cacheKey.c_str()); -// crcTreeCache.erase(cacheKey); -// } + // Refresh CRC + Config &config = Config::getInstance(); + int32 techCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), string("/") + gameSettings->getTech() + string("/*"), ".xml", NULL); -// string cacheLookupId = CacheManager::getFolderTreeContentsCheckSumRecursivelyCacheLookupKey2; -// std::map &crcTreeCache2 = CacheManager::getCachedItem< std::map >(cacheLookupId); -// -// for(size_t idx = 0; idx < paths.size(); ++idx) { -// string path = paths[idx] + pathSearchString; -// -// string cacheKey = path + "_" + filterFileExt; -// if(crcTreeCache2.find(cacheKey) != crcTreeCache2.end()) { -// SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] CLEARING CACHED checksum for cacheKey [%s]\n",__FILE__,__FUNCTION__,__LINE__,cacheKey.c_str()); -// crcTreeCache2.erase(cacheKey); -// } -// } safeMutexFTPProgress.ReleaseLock(); // END