OSDN Git Service

[Refactor] #38997 top_twnenty() に player_type * 引数を追加. / Add player_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Sun, 10 Nov 2019 23:44:47 +0000 (08:44 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 10 Nov 2019 23:49:09 +0000 (08:49 +0900)
src/core.c
src/scores.c
src/scores.h

index f350a04..47b64f5 100644 (file)
@@ -5331,7 +5331,7 @@ void play_game(bool new_game)
                else
                {
                        p_ptr->wait_report_score = FALSE;
-                       top_twenty();
+                       top_twenty(p_ptr);
                        if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
                }
                /* Shut the high score file */
@@ -5825,7 +5825,7 @@ void close_game(void)
                                }
                        }
                        if (!p_ptr->wait_report_score)
-                               (void)top_twenty();
+                               (void)top_twenty(p_ptr);
                }
                else if (highscore_fd >= 0)
                {
index 2933def..66a743d 100644 (file)
@@ -472,11 +472,12 @@ bool send_world_score(bool do_send)
  * @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.
+ * @param current_player_ptr スコアに適用するための現在プレイヤークリーチャー参照ポインタ
  * @return エラーコード
  * @details
  * Assumes "signals_ignore_tstp()" has been called.
  */
-errr top_twenty(void)
+errr top_twenty(player_type *current_player_ptr)
 {
        int          j;
 
@@ -494,11 +495,11 @@ errr top_twenty(void)
                FAKE_VER_MAJOR, FAKE_VER_MINOR, FAKE_VER_PATCH);
 
        /* Calculate and save the points */
-       sprintf(the_score.pts, "%9ld", (long)calc_score(p_ptr));
+       sprintf(the_score.pts, "%9ld", (long)calc_score(current_player_ptr));
        the_score.pts[9] = '\0';
 
        /* Save the current gold */
-       sprintf(the_score.gold, "%9lu", (long)p_ptr->au);
+       sprintf(the_score.gold, "%9lu", (long)current_player_ptr->au);
        the_score.gold[9] = '\0';
 
        /* Save the current turn */
@@ -516,35 +517,35 @@ errr top_twenty(void)
 #endif
 
        /* Save the player name (15 chars) */
-       sprintf(the_score.who, "%-.15s", p_ptr->name);
+       sprintf(the_score.who, "%-.15s", current_player_ptr->name);
 
        /* Save the player info */
-       sprintf(the_score.uid, "%7u", p_ptr->player_uid);
-       sprintf(the_score.sex, "%c", (p_ptr->psex ? 'm' : 'f'));
-       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));
+       sprintf(the_score.uid, "%7u", current_player_ptr->player_uid);
+       sprintf(the_score.sex, "%c", (current_player_ptr->psex ? 'm' : 'f'));
+       sprintf(the_score.p_r, "%2d", MIN(current_player_ptr->prace, MAX_RACES));
+       sprintf(the_score.p_c, "%2d", MIN(current_player_ptr->pclass, MAX_CLASS));
+       sprintf(the_score.p_a, "%2d", MIN(current_player_ptr->pseikaku, MAX_SEIKAKU));
 
        /* Save the level and such */
-       sprintf(the_score.cur_lev, "%3d", MIN((u16b)p_ptr->lev, 999));
-       sprintf(the_score.cur_dun, "%3d", (int)p_ptr->current_floor_ptr->dun_level);
-       sprintf(the_score.max_lev, "%3d", MIN((u16b)p_ptr->max_plv, 999));
-       sprintf(the_score.max_dun, "%3d", (int)max_dlv[p_ptr->dungeon_idx]);
+       sprintf(the_score.cur_lev, "%3d", MIN((u16b)current_player_ptr->lev, 999));
+       sprintf(the_score.cur_dun, "%3d", (int)current_player_ptr->current_floor_ptr->dun_level);
+       sprintf(the_score.max_lev, "%3d", MIN((u16b)current_player_ptr->max_plv, 999));
+       sprintf(the_score.max_dun, "%3d", (int)max_dlv[current_player_ptr->dungeon_idx]);
 
        /* Save the cause of death (31 chars) */
-       if (strlen(p_ptr->died_from) >= sizeof(the_score.how))
+       if (strlen(current_player_ptr->died_from) >= sizeof(the_score.how))
        {
 #ifdef JP
-               my_strcpy(the_score.how, p_ptr->died_from, sizeof(the_score.how) - 2);
+               my_strcpy(the_score.how, current_player_ptr->died_from, sizeof(the_score.how) - 2);
                strcat(the_score.how, "…");
 #else
-               my_strcpy(the_score.how, p_ptr->died_from, sizeof(the_score.how) - 3);
+               my_strcpy(the_score.how, current_player_ptr->died_from, sizeof(the_score.how) - 3);
                strcat(the_score.how, "...");
 #endif
        }
        else
        {
-               strcpy(the_score.how, p_ptr->died_from);
+               strcpy(the_score.how, current_player_ptr->died_from);
        }
 
        /* Grab permissions */
index c5e0a30..fdbab9f 100644 (file)
@@ -44,7 +44,7 @@ extern void display_scores_aux(int from, int to, int note, high_score *score);
 extern void display_scores(int from, int to);
 extern void kingly(player_type *winner_ptr);
 extern bool send_world_score(bool do_send);
-extern errr top_twenty(void);
+extern errr top_twenty(player_type *current_player_ptr);
 extern errr predict_score(player_type *creature_ptr);
 extern void race_legends(void);
 extern void race_score(int race_num);