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

Method GetPath

src/game/client/components/ghost.cpp:126–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126void CGhost::GetPath(char *pBuf, int Size, const char *pPlayerName, int Time) const
127{
128 const char *pMap = GameClient()->Map()->BaseName();
129 SHA256_DIGEST Sha256 = GameClient()->Map()->Sha256();
130 char aSha256[SHA256_MAXSTRSIZE];
131 sha256_str(Sha256, aSha256, sizeof(aSha256));
132
133 char aPlayerName[MAX_NAME_LENGTH];
134 str_copy(aPlayerName, pPlayerName);
135 str_sanitize_filename(aPlayerName);
136
137 char aTimestamp[32];
138 str_timestamp_format(aTimestamp, sizeof(aTimestamp), FORMAT_NOSPACE);
139
140 if(Time < 0)
141 str_format(pBuf, Size, "%s/%s_%s_%s_tmp_%d.gho", ms_pGhostDir, pMap, aPlayerName, aSha256, process_id());
142 else
143 str_format(pBuf, Size, "%s/%s_%s_%d.%03d_%s_%s.gho", ms_pGhostDir, pMap, aPlayerName, Time / 1000, Time % 1000, aTimestamp, aSha256);
144}
145
146void CGhost::AddInfos(const CNetObj_Character *pChar, const CNetObj_DDNetCharacter *pDDnetChar)
147{

Callers

nothing calls this directly

Calls 9

sha256_strFunction · 0.85
str_sanitize_filenameFunction · 0.85
str_timestamp_formatFunction · 0.85
str_formatFunction · 0.85
process_idFunction · 0.85
str_copyFunction · 0.50
BaseNameMethod · 0.45
MapMethod · 0.45
Sha256Method · 0.45

Tested by

no test coverage detected