(svn r11039) -Fix [FS#1191]: underflow that caused overflows in the performance rating calculation.

This commit is contained in:
rubidium
2007-09-02 20:41:46 +00:00
parent d396b0c556
commit b1effc466e
2 changed files with 3 additions and 12 deletions

View File

@@ -217,10 +217,7 @@ int UpdateCompanyRatingAndValue(Player *p, bool update)
/* Skip the total */
if (i == SCORE_TOTAL) continue;
/* Check the score */
s = (_score_part[owner][i] >= _score_info[i].needed) ?
_score_info[i].score :
_score_part[owner][i] * _score_info[i].score / _score_info[i].needed;
if (s < 0) s = 0;
s = clamp(_score_part[owner][i], 0, _score_info[i].needed) * _score_info[i].score / _score_info[i].needed;
score += s;
total_score += _score_info[i].score;
}