mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-07-01 08:10:22 +00:00
fixed rank calculation out of bounds
This commit is contained in:
parent
b765821552
commit
32ff55b559
@ -133,8 +133,9 @@ static void racingEnd(CNSocket* sock, CNPacketData* data) {
|
|||||||
std::vector<int>* rankRewards = &EPRewards[epInfo.EPID].second;
|
std::vector<int>* rankRewards = &EPRewards[epInfo.EPID].second;
|
||||||
|
|
||||||
// top ranking
|
// top ranking
|
||||||
|
int maxRank = rankScores->size() - 1;
|
||||||
int topRank = 0;
|
int topRank = 0;
|
||||||
while (rankScores->at(topRank) > topRankingPlayer.Score)
|
while (topRank < maxRank && rankScores->at(topRank) > topRankingPlayer.Score)
|
||||||
topRank++;
|
topRank++;
|
||||||
|
|
||||||
resp.iEPTopRank = topRank + 1;
|
resp.iEPTopRank = topRank + 1;
|
||||||
@ -144,7 +145,7 @@ static void racingEnd(CNSocket* sock, CNPacketData* data) {
|
|||||||
|
|
||||||
// this ranking
|
// this ranking
|
||||||
int rank = 0;
|
int rank = 0;
|
||||||
while (rankScores->at(rank) > postRanking.Score)
|
while (rank < maxRank && rankScores->at(rank) > postRanking.Score)
|
||||||
rank++;
|
rank++;
|
||||||
|
|
||||||
resp.iEPRank = rank + 1;
|
resp.iEPRank = rank + 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user