OSDN Git Service

[Refactor] #38997 predict_score() に player_type * 引数を追加. / Add player_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Sun, 27 Oct 2019 06:45:41 +0000 (15:45 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 27 Oct 2019 06:45:41 +0000 (15:45 +0900)
src/core.c
src/scores.c
src/scores.h

index 65c62b3..605368f 100644 (file)
@@ -5848,7 +5848,7 @@ void close_game(void)
                play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
 
                /* Predict score (or ESCAPE) */
-               if (inkey() != ESCAPE) predict_score();
+               if (inkey() != ESCAPE) predict_score(p_ptr);
        }
 
 
index 27eda8a..a6bae34 100644 (file)
@@ -596,12 +596,10 @@ errr top_twenty(void)
  * Predict the players location, and display it.
  * @return エラーコード
  */
-errr predict_score(void)
+errr predict_score(player_type *creature_ptr)
 {
-       int          j;
-
-       high_score   the_score;
-
+       int j;
+       high_score the_score;
 
        /* No score file */
        if (highscore_fd < 0)
@@ -611,16 +609,15 @@ errr predict_score(void)
                return (0);
        }
 
-
        /* Save the version */
        sprintf(the_score.what, "%u.%u.%u",
                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(creature_ptr));
 
        /* Save the current gold */
-       sprintf(the_score.gold, "%9lu", (long)p_ptr->au);
+       sprintf(the_score.gold, "%9lu", (long)creature_ptr->au);
 
        /* Save the current current_world_ptr->game_turn */
        sprintf(the_score.turns, "%9lu", (long)turn_real(current_world_ptr->game_turn));
@@ -629,20 +626,20 @@ errr predict_score(void)
        strcpy(the_score.day, _("今日", "TODAY"));
 
        /* Save the player name (15 chars) */
-       sprintf(the_score.who, "%-.15s", p_ptr->name);
+       sprintf(the_score.who, "%-.15s", creature_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", creature_ptr->player_uid);
+       sprintf(the_score.sex, "%c", (creature_ptr->psex ? 'm' : 'f'));
+       sprintf(the_score.p_r, "%2d", MIN(creature_ptr->prace, MAX_RACES));
+       sprintf(the_score.p_c, "%2d", MIN(creature_ptr->pclass, MAX_CLASS));
+       sprintf(the_score.p_a, "%2d", MIN(creature_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)creature_ptr->lev, 999));
+       sprintf(the_score.cur_dun, "%3d", (int)creature_ptr->current_floor_ptr->dun_level);
+       sprintf(the_score.max_lev, "%3d", MIN((u16b)creature_ptr->max_plv, 999));
+       sprintf(the_score.max_dun, "%3d", (int)max_dlv[creature_ptr->dungeon_idx]);
 
        /* Hack -- no cause of death */
        /* まだ死んでいないときの識別文字 */
index 1ec9b0d..c5e0a30 100644 (file)
@@ -45,7 +45,7 @@ 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 predict_score(void);
+extern errr predict_score(player_type *creature_ptr);
 extern void race_legends(void);
 extern void race_score(int race_num);
 extern void show_highclass(void);