about summary refs log tree commit diff
path: root/src/engine/client/client.cpp
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-02-21 11:23:30 +0100
committeroy <Tom_Adams@web.de>2011-02-21 11:23:30 +0100
commit088ec3e2f3ba0419612846db8f3687f5e2de1348 (patch)
treef12d7d6a55a7ef668dcc58ee64d0869ea7434e21 /src/engine/client/client.cpp
parent4f91026a01436d95cb20b3a994e96dce5072544e (diff)
downloadzcatch-088ec3e2f3ba0419612846db8f3687f5e2de1348.tar.gz
zcatch-088ec3e2f3ba0419612846db8f3687f5e2de1348.zip
made the client's map search work with sub folders. Closes #254
Diffstat (limited to 'src/engine/client/client.cpp')
-rw-r--r--src/engine/client/client.cpp15
1 files changed, 13 insertions, 2 deletions
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<CFileCollection *>(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;
 }