-static void update_highscore(struct termlist *tl, struct termlist_score *t)
-{
- int i;
- int smallest;
- int me = -1;
-
- if (tl->highscore_num > tl->highscore_size && t->frequency < tl->highscore_min)
- return;
-
- smallest = 0;
- for (i = 0; i < tl->highscore_num; i++)
- {
- if (tl->highscore[i]->frequency < tl->highscore[smallest]->frequency)
- smallest = i;
- if (tl->highscore[i] == t)
- me = i;
- }
- if (tl->highscore_num)
- tl->highscore_min = tl->highscore[smallest]->frequency;
- if (t->frequency < tl->highscore_min)
- tl->highscore_min = t->frequency;
- if (me >= 0)
- return;
- if (tl->highscore_num < tl->highscore_size)
- {
- tl->highscore[tl->highscore_num++] = t;
- if (t->frequency < tl->highscore_min)
- tl->highscore_min = t->frequency;
- }
- else
- {
- if (t->frequency > tl->highscore[smallest]->frequency)
- {
- tl->highscore[smallest] = t;
- }
- }
-}
-