diff --git a/hit.c b/hit.c index 9d27c1f..61d12b4 100644 --- a/hit.c +++ b/hit.c @@ -250,11 +250,17 @@ lget_number(const char *s) { short i = 0; long total = 0; + boolean negative = 0; + if (s[0] == '-') { + negative = 1; + i = 1; + } while ((s[i] >= '0') && (s[i] <= '9')) { total = (10 * total) + (s[i] - '0'); i++; } + if (negative) total = total * -1; return(total); } diff --git a/roguegg b/roguegg index 9fc3e07..575f1e0 100755 Binary files a/roguegg and b/roguegg differ diff --git a/score.c b/score.c index ccdf6e5..ec280b5 100644 --- a/score.c +++ b/score.c @@ -274,9 +274,9 @@ read_score_entry(struct score_entry *se, FILE *fp) sf_error(); } - xxxx(score_block, sizeof(score_block)); + /* xxxx(score_block, sizeof(score_block)); xxxx(nickname_block, sizeof(nickname_block)); - + */ /* Ensure null termination */ score_block[sizeof(score_block)-1] = 0; nickname_block[sizeof(nickname_block)-1] = 0; @@ -327,9 +327,9 @@ write_score_entry(const struct score_entry *se, int rank, FILE *fp) pad_spaces(score_block, sizeof(score_block)); /*pad_spaces(nickname_block, sizeof(nickname_block)); -- wrong! */ - xxxx(score_block, sizeof(score_block)); + /* xxxx(score_block, sizeof(score_block)); xxxx(nickname_block, sizeof(nickname_block)); - + */ fwrite(score_block, 1, sizeof(score_block), fp); fwrite(nickname_block, 1, sizeof(nickname_block), fp); } @@ -359,7 +359,7 @@ put_scores(const object *monster, short other) /* Initialize scores array */ for (i = 0; i < NUM_SCORE_ENTRIES; i++) { - scores[i].gold = -1; + scores[i].gold = -1L; scores[i].username[0] = '\0'; scores[i].death[0] = '\0'; scores[i].nickname[0] = '\0'; @@ -377,7 +377,7 @@ put_scores(const object *monster, short other) /* found our score */ if (rogue.gold < scores[i].gold) { /* we didn't do as well as last time */ - score_only = 1; + /* score_only = 1;*/ } else { /* we did better; mark entry for removal */ found_player = i; @@ -392,7 +392,7 @@ put_scores(const object *monster, short other) /* found our score */ if (rogue.exp_points < scores[i].gold) { /* we didn't do as well as last time */ - score_only = 1; + /* score_only = 1;*/ } else { /* we did better; mark entry for removal */ found_player_exp = i; @@ -401,12 +401,14 @@ put_scores(const object *monster, short other) } } + if (found_player == -1 && found_player_exp == -1) score_only = 1; + /* Remove superseded entries, if any. */ if (found_player != -1) { for (i = found_player; i < FIRST_EXP_SCORE-1; i++) { scores[i] = scores[i+1]; } - scores[i].gold = 0; + scores[i].gold = -1L; scores[i].username[0] = '\0'; scores[i].death[0] = '\0'; scores[i].nickname[0] = '\0'; @@ -415,7 +417,7 @@ put_scores(const object *monster, short other) for (i = found_player_exp; i < NUM_SCORE_ENTRIES-1; i++) { scores[i] = scores[i+1]; } - scores[i].gold = 0; + scores[i].gold = -1L; scores[i].username[0] = '\0'; scores[i].death[0] = '\0'; scores[i].nickname[0] = '\0'; @@ -488,7 +490,7 @@ put_scores(const object *monster, short other) mvaddstr(7, 0, "Rank Gold Name"); for (i = 0; i < FIRST_EXP_SCORE; i++) { - if (scores[i].gold == 0) break; + if (scores[i].gold == -1L) break; if (i == rank) { standout(); } @@ -510,7 +512,7 @@ put_scores(const object *monster, short other) mvaddstr(14, 0, "Rank Lvl/Exp Name"); for (i = FIRST_EXP_SCORE; i < NUM_SCORE_ENTRIES; i++) { - if (scores[i].gold == 0) break; + if (scores[i].gold == -1L) break; if (i == rank_exp) { standout(); }