Update the number of ranked races before using it in the rank computations
This commit is contained in:
parent
1d5e4de91d
commit
ab0a0da716
@ -1139,6 +1139,14 @@ void ServerLobby::computeNewRankings()
|
|||||||
new_scores[i] += distributeBasePoints(id);
|
new_scores[i] += distributeBasePoints(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// First, update the number of ranked races
|
||||||
|
for (unsigned i = 0; i < players.size(); i++)
|
||||||
|
{
|
||||||
|
const uint32_t id = race_manager->getKartInfo(i).getOnlineId();
|
||||||
|
m_num_ranked_races.at(id)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now compute points exchanges
|
||||||
for (unsigned i = 0; i < players.size(); i++)
|
for (unsigned i = 0; i < players.size(); i++)
|
||||||
{
|
{
|
||||||
scores_change.push_back(0.0);
|
scores_change.push_back(0.0);
|
||||||
@ -1227,7 +1235,6 @@ void ServerLobby::computeNewRankings()
|
|||||||
m_scores.at(id) = new_scores[i];
|
m_scores.at(id) = new_scores[i];
|
||||||
if (m_scores.at(id) > m_max_scores.at(id))
|
if (m_scores.at(id) > m_max_scores.at(id))
|
||||||
m_max_scores.at(id) = m_scores.at(id);
|
m_max_scores.at(id) = m_scores.at(id);
|
||||||
m_num_ranked_races.at(id)++;
|
|
||||||
}
|
}
|
||||||
} // computeNewRankings
|
} // computeNewRankings
|
||||||
|
|
||||||
@ -1303,7 +1310,7 @@ double ServerLobby::scalingValueForTime(double time)
|
|||||||
double ServerLobby::distributeBasePoints(uint32_t online_id)
|
double ServerLobby::distributeBasePoints(uint32_t online_id)
|
||||||
{
|
{
|
||||||
unsigned num_races = m_num_ranked_races.at(online_id);
|
unsigned num_races = m_num_ranked_races.at(online_id);
|
||||||
if (num_races < 45)
|
if (num_races <= 45)
|
||||||
{
|
{
|
||||||
return BASE_RANKING_POINTS / 2000.0 * std::max((45u - num_races), 4u);
|
return BASE_RANKING_POINTS / 2000.0 * std::max((45u - num_races), 4u);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user