OSDN Git Service

[Refactor] #37353 型の置換。 / Type replacement.
[hengband/hengband.git] / src / scores.c
index 4a92db2..9c53621 100644 (file)
@@ -501,17 +501,17 @@ 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_lev, "%3d", MIN((u16b)p_ptr->lev, 999));
        sprintf(the_score.cur_dun, "%3d", (int)dun_level);
-       sprintf(the_score.max_lev, "%3d", p_ptr->max_plv);
+       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) */
@@ -614,17 +614,17 @@ 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", (int)p_ptr->lev);
+       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", (int)p_ptr->max_plv);
+       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 */