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

Method SaveTeamScore

src/game/server/score.cpp:190–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190void CScore::SaveTeamScore(int Team, int *pClientIds, unsigned int Size, int TimeTicks, const char *pTimestamp)
191{
192 CConsole *pCon = (CConsole *)GameServer()->Console();
193 if(pCon->Cheated())
194 return;
195 for(unsigned int i = 0; i < Size; i++)
196 {
197 if(GameServer()->m_apPlayers[pClientIds[i]]->m_NotEligibleForFinish)
198 return;
199 }
200
201 GameServer()->TeehistorianRecordTeamFinish(Team, TimeTicks);
202
203 auto Tmp = std::make_unique<CSqlTeamScoreData>();
204 for(unsigned int i = 0; i < Size; i++)
205 str_copy(Tmp->m_aaNames[i], Server()->ClientName(pClientIds[i]), sizeof(Tmp->m_aaNames[i]));
206 Tmp->m_Size = Size;
207 Tmp->m_Time = (float)TimeTicks / (float)Server()->TickSpeed();
208 str_copy(Tmp->m_aTimestamp, pTimestamp, sizeof(Tmp->m_aTimestamp));
209 FormatUuid(GameServer()->GameUuid(), Tmp->m_aGameUuid, sizeof(Tmp->m_aGameUuid));
210 str_copy(Tmp->m_aMap, GameServer()->Map()->BaseName(), sizeof(Tmp->m_aMap));
211 Tmp->m_TeamrankUuid = RandomUuid();
212
213 m_pPool->ExecuteWrite(CScoreWorker::SaveTeamScore, std::move(Tmp), "save team score");
214}
215
216void CScore::ShowRank(int ClientId, const char *pName)
217{

Callers 1

OnTeamFinishMethod · 0.45

Calls 13

FormatUuidFunction · 0.85
RandomUuidFunction · 0.85
CheatedMethod · 0.80
ClientNameMethod · 0.80
TickSpeedMethod · 0.80
GameUuidMethod · 0.80
ExecuteWriteMethod · 0.80
str_copyFunction · 0.50
ServerClass · 0.50
ConsoleMethod · 0.45
BaseNameMethod · 0.45

Tested by

no test coverage detected