/home/teeworlds/git/teeworlds/src/game/server/score/file_score.cpp:200:19: required from here
/usr/include/c++/6/bits/predefined_ops.h:72:22: error: no match for 'operator<' (operand types are 'const CFileScore::CPlayerScore' and 'CFileScore::CPlayerScore')
{ return __val < *__it; }
line 200:
sort(m_Top.all());
function around it:
void CFileScore::UpdatePlayer(int ID, float Score,
float aCpTime[NUM_CHECKPOINTS])
{
const char *pName = Server()->ClientName(ID);
lock_wait(gs_ScoreLock);
CPlayerScore *pPlayer = SearchScore(ID, 0);
if (pPlayer)
{
for (int c = 0; c < NUM_CHECKPOINTS; c++)
pPlayer->m_aCpTime[c] = aCpTime[c];
pPlayer->m_Score = Score;
str_copy(pPlayer->m_aName, pName, sizeof(pPlayer->m_aName));
sort(m_Top.all());
}
else
m_Top.add(*new CPlayerScore(pName, Score, aCpTime));
lock_unlock(gs_ScoreLock);
Save();
}
m_Top is:
sorted_array<CPlayerScore> m_Top;
CPlayerScore
because they don't have an operator< definedbool operator<(const CPlayerScore& other) { return (this->m_Score < other.m_Score); }