OSDN Git Service

[Refactor] #37353 型の置換(C_MAKE)。 / Type replacement(C_MAKE).
[hengband/hengband.git] / src / scores.c
index ba25c73..e8d61dc 100644 (file)
@@ -145,15 +145,15 @@ static int highscore_add(high_score *score)
  */
 void display_scores_aux(int from, int to, int note, high_score *score)
 {
-       int             i, j, k, n, place;
-       byte attr;
+       int i, j, k, n, place;
+       TERM_COLOR attr;
 
-       high_score      the_score;
+       high_score the_score;
 
-       char    out_val[256];
-       char    tmp_val[160];
+       GAME_TEXT out_val[256];
+       GAME_TEXT tmp_val[160];
 
-       int wid, hgt, per_screen;
+       TERM_LEN wid, hgt, per_screen;
 
        Term_get_size(&wid, &hgt);
        per_screen = (hgt - 4) / 4;
@@ -187,7 +187,6 @@ void display_scores_aux(int from, int to, int note, high_score *score)
        /* Show per_screen per page, until "done" */
        for (k = from, place = k+1; k < i; k += per_screen)
        {
-               /* Clear screen */
                Term_clear();
 
                /* Title */
@@ -205,7 +204,7 @@ void display_scores_aux(int from, int to, int note, high_score *score)
                {
                        int pr, pc, pa, clev, mlev, cdun, mdun;
 
-                       cptr user, gold, when, aged;
+                       concptr user, gold, when, aged;
 
 
                        /* Hack -- indicate death in yellow */
@@ -395,8 +394,6 @@ void display_scores(int from, int to)
 
        /* Paranoia -- No score file */
        if (highscore_fd < 0) quit(_("スコア・ファイルが使用できません。", "Score file unavailable."));
-
-       /* Clear screen */
        Term_clear();
 
        /* Display the scores */
@@ -501,18 +498,18 @@ errr top_twenty(void)
        /* Save the player name (15 chars) */
        sprintf(the_score.who, "%-.15s", p_ptr->name);
 
-       /* Save the player info XXX XXX XXX */
+       /* Save the player info */
        sprintf(the_score.uid, "%7u", player_uid);
        sprintf(the_score.sex, "%c", (p_ptr->psex ? 'm' : 'f'));
-       sprintf(the_score.p_r, "%2d", p_ptr->prace);
-       sprintf(the_score.p_c, "%2d", p_ptr->pclass);
-       sprintf(the_score.p_a, "%2d", p_ptr->pseikaku);
+       sprintf(the_score.p_r, "%2d", MIN(p_ptr->prace, MAX_RACES));
+       sprintf(the_score.p_c, "%2d", MIN(p_ptr->pclass, MAX_CLASS));
+       sprintf(the_score.p_a, "%2d", MIN(p_ptr->pseikaku, MAX_SEIKAKU));
 
        /* Save the level and such */
-       sprintf(the_score.cur_lev, "%3d", p_ptr->lev);
-       sprintf(the_score.cur_dun, "%3d", dun_level);
-       sprintf(the_score.max_lev, "%3d", p_ptr->max_plv);
-       sprintf(the_score.max_dun, "%3d", max_dlv[dungeon_type]);
+       sprintf(the_score.cur_lev, "%3d", MIN((u16b)p_ptr->lev, 999));
+       sprintf(the_score.cur_dun, "%3d", (int)dun_level);
+       sprintf(the_score.max_lev, "%3d", MIN((u16b)p_ptr->max_plv, 999));
+       sprintf(the_score.max_dun, "%3d", (int)max_dlv[dungeon_type]);
 
        /* Save the cause of death (31 chars) */
        if (strlen(p_ptr->died_from) >= sizeof(the_score.how))
@@ -614,18 +611,18 @@ errr predict_score(void)
        /* Save the player name (15 chars) */
        sprintf(the_score.who, "%-.15s", p_ptr->name);
 
-       /* Save the player info XXX XXX XXX */
+       /* Save the player info */
        sprintf(the_score.uid, "%7u", player_uid);
        sprintf(the_score.sex, "%c", (p_ptr->psex ? 'm' : 'f'));
-       sprintf(the_score.p_r, "%2d", p_ptr->prace);
-       sprintf(the_score.p_c, "%2d", p_ptr->pclass);
-       sprintf(the_score.p_a, "%2d", p_ptr->pseikaku);
+       sprintf(the_score.p_r, "%2d", MIN(p_ptr->prace, MAX_RACES));
+       sprintf(the_score.p_c, "%2d", MIN(p_ptr->pclass, MAX_CLASS));
+       sprintf(the_score.p_a, "%2d", MIN(p_ptr->pseikaku, MAX_SEIKAKU));
 
        /* Save the level and such */
-       sprintf(the_score.cur_lev, "%3d", p_ptr->lev);
-       sprintf(the_score.cur_dun, "%3d", dun_level);
-       sprintf(the_score.max_lev, "%3d", p_ptr->max_plv);
-       sprintf(the_score.max_dun, "%3d", max_dlv[dungeon_type]);
+       sprintf(the_score.cur_lev, "%3d", MIN((u16b)p_ptr->lev, 999));
+       sprintf(the_score.cur_dun, "%3d", (int)dun_level);
+       sprintf(the_score.max_lev, "%3d", MIN((u16b)p_ptr->max_plv, 999));
+       sprintf(the_score.max_dun, "%3d", (int)max_dlv[dungeon_type]);
 
        /* Hack -- no cause of death */
        /* まだ死んでいないときの識別文字 */
@@ -663,7 +660,8 @@ void show_highclass(void)
 {
 
        register int i = 0, j, m = 0;
-       int pr, clev/*, al*/;
+       int pr;
+       PLAYER_LEVEL clev/*, al*/;
        high_score the_score;
        char buf[1024], out_val[256];
 
@@ -695,7 +693,7 @@ void show_highclass(void)
                if (highscore_seek(j)) break;
                if (highscore_read(&the_score)) break;
                pr = atoi(the_score.p_r);
-               clev = atoi(the_score.cur_lev);
+               clev = (PLAYER_LEVEL)atoi(the_score.cur_lev);
 
 #ifdef JP
                sprintf(out_val, "   %3d) %sの%s (レベル %2d)",
@@ -843,8 +841,8 @@ void race_legends(void)
  */
 void kingly(void)
 {
-       int wid, hgt;
-       int cx, cy;
+       TERM_LEN wid, hgt;
+       TERM_LEN cx, cy;
        bool seppuku = streq(p_ptr->died_from, "Seppuku");
 
        /* Hack -- retire in town */
@@ -867,8 +865,6 @@ void kingly(void)
 
        /* Hack -- Instant Gold */
        p_ptr->au += 10000000L;
-
-       /* Clear screen */
        Term_clear();
 
        /* Display a crown */