MCPcopy Create free account
hub / github.com/ddnet/ddnet / FormatMapDownloadFilename

Function FormatMapDownloadFilename

src/engine/client/client.cpp:1201–1223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1199}
1200
1201static void FormatMapDownloadFilename(const char *pName, const std::optional<SHA256_DIGEST> &Sha256, int Crc, bool Temp, char *pBuffer, int BufferSize)
1202{
1203 char aSuffix[32];
1204 if(Temp)
1205 {
1206 IStorage::FormatTmpPath(aSuffix, sizeof(aSuffix), "");
1207 }
1208 else
1209 {
1210 str_copy(aSuffix, ".map");
1211 }
1212
1213 if(Sha256.has_value())
1214 {
1215 char aSha256[SHA256_MAXSTRSIZE];
1216 sha256_str(Sha256.value(), aSha256, sizeof(aSha256));
1217 str_format(pBuffer, BufferSize, "downloadedmaps/%s_%s%s", pName, aSha256, aSuffix);
1218 }
1219 else
1220 {
1221 str_format(pBuffer, BufferSize, "downloadedmaps/%s_%08x%s", pName, Crc, aSuffix);
1222 }
1223}
1224
1225const char *CClient::LoadMapSearch(const char *pMapName, const std::optional<SHA256_DIGEST> &WantedSha256, int WantedCrc)
1226{

Callers 2

LoadMapSearchMethod · 0.85
ProcessServerPacketMethod · 0.85

Calls 3

sha256_strFunction · 0.85
str_formatFunction · 0.85
str_copyFunction · 0.50

Tested by

no test coverage detected