From 088ec3e2f3ba0419612846db8f3687f5e2de1348 Mon Sep 17 00:00:00 2001 From: oy Date: Mon, 21 Feb 2011 11:23:30 +0100 Subject: made the client's map search work with sub folders. Closes #254 --- src/engine/client/client.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/engine/client/client.cpp') diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 850c1d52..67f954dd 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -378,19 +378,21 @@ void CFileCollection::AddEntry(int64 Timestamp) } } -void CFileCollection::FilelistCallback(const char *pFilename, int IsDir, int StorageType, void *pUser) +int CFileCollection::FilelistCallback(const char *pFilename, int IsDir, int StorageType, void *pUser) { CFileCollection *pThis = static_cast(pUser); // check for valid file name format if(IsDir || !pThis->IsFilenameValid(pFilename)) - return; + return 0; // extract the timestamp int64 Timestamp = pThis->ExtractTimestamp(pFilename+pThis->m_FileDescLength+1); // add the entry pThis->AddEntry(Timestamp); + + return 0; } @@ -991,6 +993,15 @@ const char *CClient::LoadMapSearch(const char *pMapName, int WantedCrc) // try the downloaded maps str_format(aBuf, sizeof(aBuf), "downloadedmaps/%s_%08x.map", pMapName, WantedCrc); pError = LoadMap(pMapName, aBuf, WantedCrc); + if(!pError) + return pError; + + // search for the map within subfolders + char aFilename[128]; + str_format(aFilename, sizeof(aFilename), "%s.map", pMapName); + if(Storage()->FindFile(aFilename, "maps", IStorage::TYPE_ALL, aBuf, sizeof(aBuf))); + pError = LoadMap(pMapName, aBuf, WantedCrc); + return pError; } -- cgit 1.4.1