Fixed a crash when score is not good enough to enter high score list

git-svn-id: https://svn.code.sf.net/p/extremetuxracer/code/trunk@706 0420edf4-82e4-42fc-9478-35b55e6d67a3
master
cazfi 2018-04-25 05:01:06 +00:00
parent ece8e396ed
commit 9ee386c908
2 changed files with 8 additions and 2 deletions

6
NEWS
View File

@ -16,6 +16,12 @@ version 0.8 features the following changes:
- Swedish
Version 0.7.5 ??th of ???, 2018
-------------------------------------------------------------------------------
Bugfix release
- Fixed a crash when score is not good enough to enter high score list
Version 0.7.4 27th of October, 2016
-------------------------------------------------------------------------------
Bugfix release

View File

@ -45,7 +45,7 @@ int CScore::AddScore(const std::string& group, const std::string& course, TScore
list->scores[0] = score;
list->numScores++;
} else if (num == MAX_SCORES) {
while (val <= list->scores[pos].points && pos < num) pos++;
while (pos < num && val <= list->scores[pos].points) pos++;
if (pos == lastpos) {
list->scores[pos] = score;
} else if (pos < lastpos) {
@ -53,7 +53,7 @@ int CScore::AddScore(const std::string& group, const std::string& course, TScore
list->scores[pos] = score;
}
} else {
while (val <= list->scores[pos].points && pos < num) pos++;
while (pos < num && val <= list->scores[pos].points) pos++;
for (int i=num; i>pos; i--) list->scores[i] = list->scores[i-1];
list->scores[pos] = score;
list->numScores++;