OSDN Git Service

[Refactor] #38997 calc_score() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Sat, 13 Jul 2019 11:03:38 +0000 (20:03 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 13 Jul 2019 11:03:38 +0000 (20:03 +0900)
src/player-status.c
src/player-status.h
src/report.c
src/scores.c

index 0e13397..105187b 100644 (file)
@@ -5727,12 +5727,12 @@ s16b modify_stat_value(int value, int amount)
  * @return なし
  * @details
  */
-long calc_score(void)
+long calc_score(player_type *creature_ptr)
 {
        int i, mult = 100;
        DEPTH max_dl = 0;
        u32b point, point_h, point_l;
-       int arena_win = MIN(p_ptr->arena_number, MAX_ARENA_MONS);
+       int arena_win = MIN(creature_ptr->arena_number, MAX_ARENA_MONS);
 
        if (!preserve_mode) mult += 10;
        if (!autoroller) mult += 10;
@@ -5751,7 +5751,7 @@ long calc_score(void)
                if (max_dlv[i] > max_dl)
                        max_dl = max_dlv[i];
 
-       point_l = (p_ptr->max_max_exp + (100 * max_dl));
+       point_l = (creature_ptr->max_max_exp + (100 * max_dl));
        point_h = point_l / 0x10000L;
        point_l = point_l % 0x10000L;
        point_h *= mult;
@@ -5764,20 +5764,20 @@ long calc_score(void)
        point_l /= 100;
 
        point = (point_h << 16) + (point_l);
-       if (p_ptr->arena_number >= 0)
+       if (creature_ptr->arena_number >= 0)
                point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
 
        if (ironman_downward) point *= 2;
-       if (p_ptr->pclass == CLASS_BERSERKER)
+       if (creature_ptr->pclass == CLASS_BERSERKER)
        {
-               if (p_ptr->prace == RACE_SPECTRE)
+               if (creature_ptr->prace == RACE_SPECTRE)
                        point = point / 5;
        }
 
-       if ((p_ptr->pseikaku == SEIKAKU_MUNCHKIN) && point)
+       if ((creature_ptr->pseikaku == SEIKAKU_MUNCHKIN) && point)
        {
                point = 1;
-               if (p_ptr->total_winner) point = 2;
+               if (creature_ptr->total_winner) point = 2;
        }
        if (easy_band) point = (0 - point);
 
index 822908a..df6214e 100644 (file)
@@ -751,7 +751,7 @@ extern void check_experience(player_type *creature_ptr);
 extern void wreck_the_pattern(player_type *creature_ptr);
 extern void cnv_stat(int val, char *out_val);
 extern s16b modify_stat_value(int value, int amount);
-extern long calc_score(void);
+extern long calc_score(player_type *creature_ptr);
 
 extern const s32b player_exp[PY_MAX_LEVEL];
 extern const s32b player_exp_a[PY_MAX_LEVEL];
index c1b87b8..c0213b5 100644 (file)
@@ -482,7 +482,7 @@ errr report_score(void)
        buf_sprintf(score, "version: Hengband %d.%d.%d\n",
                    FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
 #endif
-       buf_sprintf(score, "score: %d\n", calc_score());
+       buf_sprintf(score, "score: %d\n", calc_score(p_ptr));
        buf_sprintf(score, "level: %d\n", p_ptr->lev);
        buf_sprintf(score, "depth: %d\n", current_floor_ptr->dun_level);
        buf_sprintf(score, "maxlv: %d\n", p_ptr->max_plv);
index a15b120..5104cc2 100644 (file)
@@ -494,7 +494,7 @@ 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());
+       sprintf(the_score.pts, "%9ld", (long)calc_score(p_ptr));
        the_score.pts[9] = '\0';
 
        /* Save the current gold */
@@ -617,7 +617,7 @@ errr predict_score(void)
                FAKE_VER_MAJOR, FAKE_VER_MINOR, FAKE_VER_PATCH);
 
        /* Calculate and save the points */
-       sprintf(the_score.pts, "%9ld", (long)calc_score());
+       sprintf(the_score.pts, "%9ld", (long)calc_score(p_ptr));
 
        /* Save the current gold */
        sprintf(the_score.gold, "%9lu", (long)p_ptr->au);