OSDN Git Service

[Refactor] #38997 weight_limit() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Wed, 10 Jul 2019 03:33:11 +0000 (12:33 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 10 Jul 2019 03:33:11 +0000 (12:33 +0900)
src/cmd-item.c
src/core.c
src/player-move.c
src/player-status.c
src/player-status.h

index 3907c97..1d03b79 100644 (file)
@@ -71,11 +71,11 @@ void do_cmd_inven(void)
 #ifdef JP
        sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
                (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
-               (long int)((p_ptr->total_weight * 100) / weight_limit()));
+               (long int)((p_ptr->total_weight * 100) / weight_limit(p_ptr)));
 #else
        sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
                (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
-               (p_ptr->total_weight * 100) / weight_limit());
+               (p_ptr->total_weight * 100) / weight_limit(p_ptr));
 #endif
 
        prt(out_val, 0, 0);
@@ -124,11 +124,11 @@ void do_cmd_equip(void)
 #ifdef JP
        sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
            (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
-           (long int)((p_ptr->total_weight * 100) / weight_limit()));
+           (long int)((p_ptr->total_weight * 100) / weight_limit(p_ptr)));
 #else
        sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
            (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
-           (long int)((p_ptr->total_weight * 100) / weight_limit()));
+           (long int)((p_ptr->total_weight * 100) / weight_limit(p_ptr)));
 #endif
 
        prt(out_val, 0, 0);
index f54f738..e3153f9 100644 (file)
@@ -1627,7 +1627,7 @@ static void process_world_aux_hp_and_sp(void)
        if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
            !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
        {
-               if (p_ptr->total_weight > weight_limit())
+               if (p_ptr->total_weight > weight_limit(p_ptr))
                {
                        msg_print(_("溺れている!", "You are drowning!"));
                        take_hit(p_ptr, DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
index a93d151..d3d6eb0 100644 (file)
@@ -1616,7 +1616,7 @@ static bool run_test(void)
 
                                /* Deep water */
                                else if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
-                                        (p_ptr->levitation || p_ptr->can_swim || (p_ptr->total_weight <= weight_limit())))
+                                        (p_ptr->levitation || p_ptr->can_swim || (p_ptr->total_weight <= weight_limit(p_ptr))))
                                {
                                        /* Ignore */
                                        notice = FALSE;
index 2966f25..39671ec 100644 (file)
@@ -3065,7 +3065,7 @@ void calc_bonuses(void)
        if (!p_ptr->riding)
        {
                /* Extract the "weight limit" (in tenth pounds) */
-               i = (int)weight_limit();
+               i = (int)weight_limit(p_ptr);
        }
        else
        {
@@ -4910,13 +4910,13 @@ s16b calc_num_fire(object_type *o_ptr)
  * Computes current weight limit.
  * @return 制限重量(ポンド)
  */
-WEIGHT weight_limit(void)
+WEIGHT weight_limit(player_type *creature_ptr)
 {
        WEIGHT i;
 
        /* Weight limit based only on strength */
-       i = (WEIGHT)adj_str_wgt[p_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
-       if (p_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
+       i = (WEIGHT)adj_str_wgt[creature_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
+       if (creature_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
 
        /* Return the result */
        return i;
index e8e8fd6..5e72ca6 100644 (file)
@@ -732,7 +732,7 @@ extern int spell_exp_level(int spell_exp);
 
 extern s16b calc_num_fire(object_type *o_ptr);
 extern void calc_bonuses(void);
-extern WEIGHT weight_limit(void);
+extern WEIGHT weight_limit(player_type *creature_ptr);
 extern bool has_melee_weapon(player_type *creature_ptr, int i);
 extern bool is_heavy_shoot(object_type *o_ptr);