OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / scores.c
index f01c7f1..9c53621 100644 (file)
@@ -128,12 +128,20 @@ static int highscore_add(high_score *score)
 
 
 
-/*
- * Display the scores in a given range.
+/*!
+ * @brief 指定された順位範囲でスコアを並べて表示する / Display the scores in a given range.
+ * @param from 順位先頭
+ * @param to 順位末尾
+ * @param note 黄色表示でハイライトする順位
+ * @param score スコア配列参照ポインタ
+ * @return なし
+ * @details
+ * <pre>
  * Assumes the high score list is already open.
  * Only five entries per line, too much info.
  *
  * Mega-Hack -- allow "fake" entry at the given position.
+ * </pre>
  */
 void display_scores_aux(int from, int to, int note, high_score *score)
 {
@@ -364,11 +372,16 @@ void display_scores_aux(int from, int to, int note, high_score *score)
 }
 
 
-/*
- * Hack -- Display the scores in a given range and quit.
- *
+/*!
+ * @brief スコア表示処理メインルーチン / Hack -- Display the scores in a given range and quit.
+ * @param from 順位先頭
+ * @param to 順位末尾
+ * @return なし
+ * @details
+ * <pre>
  * This function is only called from "main.c" when the user asks
  * to see the "high scores".
+ * </pre>
  */
 void display_scores(int from, int to)
 {
@@ -400,7 +413,11 @@ void display_scores(int from, int to)
 }
 
 
-
+/*!
+ * @brief スコアサーバへの転送処理
+ * @param do_send 実際に転送ア処置を行うか否か
+ * @return 転送が成功したらTRUEを返す
+ */
 bool send_world_score(bool do_send)
 {
 #ifdef WORLD_SCORE
@@ -434,10 +451,12 @@ bool send_world_score(bool do_send)
        return TRUE;
 }
 
-/*
+/*!
+ * @brief スコアの過去二十位内ランキングを表示する
  * Enters a players name on a hi-score table, if "legal", and in any
  * case, displays some relevant portion of the high score list.
- *
+ * @return エラーコード
+ * @details
  * Assumes "signals_ignore_tstp()" has been called.
  */
 errr top_twenty(void)
@@ -480,20 +499,20 @@ errr top_twenty(void)
 #endif
 
        /* Save the player name (15 chars) */
-       sprintf(the_score.who, "%-.15s", player_name);
+       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))
@@ -555,9 +574,10 @@ errr top_twenty(void)
        return (0);
 }
 
-
-/*
+/*!
+ * @brief プレイヤーの現在のスコアをランキングに挟む /
  * Predict the players location, and display it.
+ * @return エラーコード
  */
 errr predict_score(void)
 {
@@ -592,20 +612,20 @@ errr predict_score(void)
        strcpy(the_score.day, _("今日", "TODAY"));
 
        /* Save the player name (15 chars) */
-       sprintf(the_score.who, "%-.15s", player_name);
+       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 */
        /* まだ死んでいないときの識別文字 */
@@ -634,16 +654,17 @@ errr predict_score(void)
 }
 
 
-
-/*
- * show_highclass - selectively list highscores based on class
- * -KMW-
+/*!
+ * @brief スコアランキングの簡易表示 /
+ * show_highclass - selectively list highscores based on class -KMW-
+ * @return なし
  */
 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];
 
@@ -675,7 +696,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)",
@@ -692,10 +713,10 @@ void show_highclass(void)
 
 #ifdef JP
        sprintf(out_val, "あなた) %sの%s (レベル %2d)",
-           race_info[p_ptr->prace].title,player_name, p_ptr->lev);
+           race_info[p_ptr->prace].title,p_ptr->name, p_ptr->lev);
 #else
        sprintf(out_val, "You) %s the %s (Level %2d)",
-           player_name, race_info[p_ptr->prace].title, p_ptr->lev);
+           p_ptr->name, race_info[p_ptr->prace].title, p_ptr->lev);
 #endif
 
        prt(out_val, (m + 8), 0);
@@ -710,10 +731,11 @@ void show_highclass(void)
        screen_load();
 }
 
-
-/*
- * Race Legends
- * -KMW-
+/*!
+ * @brief スコアランキングの簡易表示(種族毎)サブルーチン /
+ * Race Legends -KMW-
+ * @param race_num 種族ID
+ * @return なし
  */
 void race_score(int race_num)
 {
@@ -782,10 +804,10 @@ void race_score(int race_num)
        {
 #ifdef JP
        sprintf(out_val, "あなた) %sの%s (レベル %2d)",
-                    race_info[p_ptr->prace].title,player_name, p_ptr->lev);
+                    race_info[p_ptr->prace].title,p_ptr->name, p_ptr->lev);
 #else
                sprintf(out_val, "You) %s the %s (Level %3d)",
-                   player_name, race_info[p_ptr->prace].title, p_ptr->lev);
+                   p_ptr->name, race_info[p_ptr->prace].title, p_ptr->lev);
 #endif
 
                prt(out_val, (m + 8), 0);
@@ -796,9 +818,10 @@ void race_score(int race_num)
 }
 
 
-/*
- * Race Legends
- * -KMW-
+/*!
+ * @brief スコアランキングの簡易表示(種族毎)メインルーチン /
+ * Race Legends -KMW-
+ * @return なし
  */
 void race_legends(void)
 {
@@ -814,9 +837,10 @@ void race_legends(void)
        }
 }
 
-
-/*
- * Change the player into a King!                      -RAK-
+/*!
+ * @brief 勝利者用の引退演出処理 /
+ * Change the player into a King! -RAK-
+ * @return なし
  */
 void kingly(void)
 {