[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#4397: 23.0.60; update-game-score doesn't update when MAX_SCORES entr
From: |
Jason Feng |
Subject: |
bug#4397: 23.0.60; update-game-score doesn't update when MAX_SCORES entries are present |
Date: |
Thu, 10 Sep 2009 16:53:38 -0700 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
When attempting to run "update-game-score," when there are 200 entries
in the score file, the new score is never included. Apparently, the
INTENDED behavior is that the new score is included if it is larger
than the minimum entry, pushing out the minimum entry, but this doesn't
happen.
I have isolated the cause to the following lines in update-game-score.c
(pulled from the latest git tree):
(starts at line 255)
push_score (&scores, &scorecount, newscore, user_id, newdata);
/* Limit the number of scores. If we're using reverse sorting, then
we should increment the beginning of the array, to skip over the
*smallest* scores. Otherwise, we just decrement the number of
scores, since the smallest will be at the end. */
if (scorecount > MAX_SCORES)
scorecount -= (scorecount - MAX_SCORES);
if (reverse)
scores += (scorecount - MAX_SCORES);
sort_scores (scores, scorecount, reverse);
As push_score adds the new score at the end of the score list, when the
scorecount gets decremented, there is no chance for the new score to
ever get included (when reverse is zero, that is). Really the decrement
of scorecount should happen after the scores have been sorted.
Regards,
Jason Feng
- bug#4397: 23.0.60; update-game-score doesn't update when MAX_SCORES entries are present,
Jason Feng <=