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

Method LoadBestTime

src/game/server/scoreworker.cpp:145–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145bool CScoreWorker::LoadBestTime(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize)
146{
147 const auto *pData = dynamic_cast<const CSqlLoadBestTimeRequest *>(pGameData);
148 auto *pResult = dynamic_cast<CScoreLoadBestTimeResult *>(pGameData->m_pResult.get());
149
150 char aBuf[512];
151 // get the best time
152 str_format(aBuf, sizeof(aBuf),
153 "SELECT Time FROM %s_race WHERE Map=? ORDER BY `Time` ASC LIMIT 1",
154 pSqlServer->GetPrefix());
155 if(!pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
156 {
157 return false;
158 }
159 pSqlServer->BindString(1, pData->m_aMap);
160
161 bool End;
162 if(!pSqlServer->Step(&End, pError, ErrorSize))
163 {
164 return false;
165 }
166 if(!End)
167 {
168 pResult->m_CurrentRecord = pSqlServer->GetFloat(1);
169 }
170
171 return true;
172}
173
174// update stuff
175bool CScoreWorker::LoadPlayerData(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize)

Callers

nothing calls this directly

Calls 7

str_formatFunction · 0.85
getMethod · 0.80
GetPrefixMethod · 0.80
PrepareStatementMethod · 0.45
BindStringMethod · 0.45
StepMethod · 0.45
GetFloatMethod · 0.45

Tested by

no test coverage detected