Skip to content

Commit

Permalink
Fix networking bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingJellyfish committed Oct 28, 2024
1 parent c08e918 commit 6046997
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/modes/free_for_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,24 @@ std::pair<int, video::SColor> FreeForAll::getSpeedometerDigit(
}

int id = kart->getWorldKartId();
if (getNumKarts() == 1)

// Fade from green to red
std::vector<int> sorted_scores;
for (int i = 0; i < m_scores.size(); i++)
{
int s = m_scores[id];
if (!getKart(i)->isEliminated())
{
sorted_scores.push_back(m_scores[i]);
}
}
std::sort(sorted_scores.begin(), sorted_scores.end(), std::greater<int>());

if (sorted_scores.size() == 1)
{
int s = sorted_scores[id];
video::SColor color = video::SColor(255, s <= 0 ? 255 : 0, s >= 0 ? 255 : 0, 0);
return std::make_pair(s, color);
}

// Fade from green to red
std::vector<int> sorted_scores = m_scores;
std::sort(sorted_scores.begin(), sorted_scores.end(), std::greater<int>());

int rank = std::lower_bound(
sorted_scores.begin(), sorted_scores.end(),
Expand Down

0 comments on commit 6046997

Please sign in to comment.