Save top scores for both gold and exp.
This commit is contained in:
parent
b67447d150
commit
73b8af02c3
60
score.c
60
score.c
@ -369,6 +369,8 @@ put_scores(const object *monster, short other)
|
|||||||
sf_error();
|
sf_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Gold & Glory: First half of score entries are top gold-gatherers,
|
||||||
|
second half (starting from index expscore) are top experience-earners. */
|
||||||
expscore = numscores / 2;
|
expscore = numscores / 2;
|
||||||
|
|
||||||
/* Search the gold score list. */
|
/* Search the gold score list. */
|
||||||
@ -418,12 +420,36 @@ put_scores(const object *monster, short other)
|
|||||||
/* If we're going to insert ourselves, do it now */
|
/* If we're going to insert ourselves, do it now */
|
||||||
if (!score_only) {
|
if (!score_only) {
|
||||||
|
|
||||||
|
/* Gold&Glory: did we make the top gold list? */
|
||||||
|
/* if we aren't better than anyone, add at end. */
|
||||||
|
rank = expscore;
|
||||||
|
|
||||||
|
/* Otherwise, find our slot. */
|
||||||
|
for (i = 0; i < expscore; i++) {
|
||||||
|
if (rogue.gold >= scores[i].gold) {
|
||||||
|
rank = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rank < NUM_SCORE_ENTRIES/2) {
|
||||||
|
/* Open up a slot */
|
||||||
|
for (i = numscores; i > rank; i--) {
|
||||||
|
scores[i] = scores[i-1];
|
||||||
|
}
|
||||||
|
numscores++;
|
||||||
|
|
||||||
|
/* Put our info in the slot */
|
||||||
|
make_score(&scores[rank], monster, other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gold&Glory: did we make the top experience list? */
|
||||||
/* if we aren't better than anyone, add at end. */
|
/* if we aren't better than anyone, add at end. */
|
||||||
rank = numscores;
|
rank = numscores;
|
||||||
|
|
||||||
/* Otherwise, find our slot. */
|
/* Otherwise, find our slot. */
|
||||||
for (i = 0; i < numscores; i++) {
|
for (i = expscore; i < numscores; i++) {
|
||||||
if (rogue.gold >= scores[i].gold) {
|
if (rogue.exp_level >= scores[i].gold) {
|
||||||
rank = i;
|
rank = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -456,10 +482,10 @@ put_scores(const object *monster, short other)
|
|||||||
/* Display the scores */
|
/* Display the scores */
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
mvaddstr(3, 30, "Top Ten Rogueists");
|
mvaddstr(3, 27, "Top Gold & Glory Rogueists");
|
||||||
mvaddstr(8, 0, "Rank Score Name");
|
mvaddstr(7, 0, "Rank Gold Name");
|
||||||
|
|
||||||
for (i = 0; i < numscores; i++) {
|
for (i = 0; i < expscore; i++) {
|
||||||
if (i == rank) {
|
if (i == rank) {
|
||||||
standout();
|
standout();
|
||||||
}
|
}
|
||||||
@ -470,13 +496,35 @@ put_scores(const object *monster, short other)
|
|||||||
name = scores[i].username;
|
name = scores[i].username;
|
||||||
}
|
}
|
||||||
|
|
||||||
mvprintw(i+10, 0, "%2d %6ld %s: %s",
|
mvprintw(i+8, 0, "%2d %6ld %s: %s",
|
||||||
i+1, scores[i].gold, name, scores[i].death);
|
i+1, scores[i].gold, name, scores[i].death);
|
||||||
|
|
||||||
if (i == rank) {
|
if (i == rank) {
|
||||||
standend();
|
standend();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mvaddstr(14, 0, "Rank Exp Lev Name");
|
||||||
|
|
||||||
|
for (i = expscore; i < numscores; i++) {
|
||||||
|
if (i == rank) {
|
||||||
|
standout();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scores[i].nickname[0]) {
|
||||||
|
name = scores[i].nickname;
|
||||||
|
} else {
|
||||||
|
name = scores[i].username;
|
||||||
|
}
|
||||||
|
|
||||||
|
mvprintw(i+15, 0, "%2d %6ld %02d %s: %s",
|
||||||
|
i+1 - expscore, scores[i].gold, get_exp_level(scores[i].gold),
|
||||||
|
name, scores[i].death);
|
||||||
|
|
||||||
|
if (i == rank) {
|
||||||
|
standend();
|
||||||
|
}
|
||||||
|
}
|
||||||
refresh();
|
refresh();
|
||||||
messagef(0, "%s", ""); /* gcc objects to just "" */
|
messagef(0, "%s", ""); /* gcc objects to just "" */
|
||||||
if (dopause) {
|
if (dopause) {
|
||||||
|
Loading…
Reference in New Issue
Block a user