OSDN Git Service

[Refactor] #39962 display_player_stat_info() からprocess_stats() を分離 / Separated proce...
authorHourier <hourier@users.sourceforge.jp>
Thu, 27 Feb 2020 12:19:24 +0000 (21:19 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 27 Feb 2020 12:19:24 +0000 (21:19 +0900)
src/view/display-player.c

index 7aea2d4..37eb1fc 100644 (file)
@@ -192,31 +192,14 @@ static void display_basic_stat_value(player_type *creature_ptr, int stat_num, in
 
 
 /*!
- * @brief プレイヤーの特性フラグ一覧表示2b /
- * Special display, part 2b
+ * @brief 能力値を補正しつつ表示する
  * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param row 行数
+ * @param stat_col 列数
  * @return なし
- * @details
- * <pre>
- * How to print out the modifications and sustains.
- * Positive mods with no sustain will be light green.
- * Positive mods with a sustain will be dark green.
- * Sustains (with no modification) will be a dark green 's'.
- * Negative mods (from a curse) will be red.
- * Huge mods (>9), like from MICoMorgoth, will be a '*'
- * No mod, no sustain, will be a slate '.'
- * </pre>
  */
-static void display_player_stat_info(player_type *creature_ptr)
+static void process_stats(player_type *creature_ptr, int row, int stat_col)
 {
-       int stat_col = 22;
-       int row = 3;
-       c_put_str(TERM_WHITE, _("能力", "Stat"), row, stat_col + 1);
-       c_put_str(TERM_BLUE, _("  基本", "  Base"), row, stat_col + 7);
-       c_put_str(TERM_L_BLUE, _(" 種 職 性 装 ", "RacClaPerMod"), row, stat_col + 13);
-       c_put_str(TERM_L_GREEN, _("合計", "Actual"), row, stat_col + 28);
-       c_put_str(TERM_YELLOW, _("現在", "Current"), row, stat_col + 35);
-
        char buf[80];
        for (int i = 0; i < A_MAX; i++)
        {
@@ -238,22 +221,51 @@ static void display_player_stat_info(player_type *creature_ptr)
 
                display_basic_stat_value(creature_ptr, i, r_adj, e_adj, row, stat_col, buf);
        }
+}
+
+
+/*!
+ * @brief プレイヤーの特性フラグ一覧表示2b /
+ * Special display, part 2b
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ * @details
+ * <pre>
+ * How to print out the modifications and sustains.
+ * Positive mods with no sustain will be light green.
+ * Positive mods with a sustain will be dark green.
+ * Sustains (with no modification) will be a dark green 's'.
+ * Negative mods (from a curse) will be red.
+ * Huge mods (>9), like from MICoMorgoth, will be a '*'
+ * No mod, no sustain, will be a slate '.'
+ * </pre>
+ */
+static void display_player_stat_info(player_type *creature_ptr)
+{
+       int stat_col = 22;
+       int row = 3;
+       c_put_str(TERM_WHITE, _("能力", "Stat"), row, stat_col + 1);
+       c_put_str(TERM_BLUE, _("  基本", "  Base"), row, stat_col + 7);
+       c_put_str(TERM_L_BLUE, _(" 種 職 性 装 ", "RacClaPerMod"), row, stat_col + 13);
+       c_put_str(TERM_L_GREEN, _("合計", "Actual"), row, stat_col + 28);
+       c_put_str(TERM_YELLOW, _("現在", "Current"), row, stat_col + 35);
+       process_stats(creature_ptr, row, stat_col);
 
        int col = stat_col + 41;
        c_put_str(TERM_WHITE, "abcdefghijkl@", row, col);
        c_put_str(TERM_L_GREEN, _("能力修正", "Modification"), row - 1, col);
 
-       BIT_FLAGS flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flags[TR_FLAG_SIZE];
        for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
                object_type *o_ptr;
                o_ptr = &creature_ptr->inventory_list[i];
-               object_flags_known(o_ptr, flgs);
+               object_flags_known(o_ptr, flags);
                for (int stat = 0; stat < A_MAX; stat++)
                {
                        byte a = TERM_SLATE;
                        char c = '.';
-                       if (have_flag(flgs, stat))
+                       if (have_flag(flags, stat))
                        {
                                c = '*';
 
@@ -263,7 +275,7 @@ static void display_player_stat_info(player_type *creature_ptr)
                                        if (o_ptr->pval < 10) c = '0' + o_ptr->pval;
                                }
 
-                               if (have_flag(flgs, stat + TR_SUST_STR))
+                               if (have_flag(flags, stat + TR_SUST_STR))
                                {
                                        a = TERM_GREEN;
                                }
@@ -274,7 +286,7 @@ static void display_player_stat_info(player_type *creature_ptr)
                                        if (o_ptr->pval > -10) c = '0' - o_ptr->pval;
                                }
                        }
-                       else if (have_flag(flgs, stat + TR_SUST_STR))
+                       else if (have_flag(flags, stat + TR_SUST_STR))
                        {
                                a = TERM_GREEN;
                                c = 's';
@@ -286,7 +298,7 @@ static void display_player_stat_info(player_type *creature_ptr)
                col++;
        }
 
-       player_flags(creature_ptr, flgs);
+       player_flags(creature_ptr, flags);
        for (int stat = 0; stat < A_MAX; stat++)
        {
                byte a = TERM_SLATE;
@@ -351,7 +363,7 @@ static void display_player_stat_info(player_type *creature_ptr)
                        }
                }
 
-               if (have_flag(flgs, stat + TR_SUST_STR))
+               if (have_flag(flags, stat + TR_SUST_STR))
                {
                        a = TERM_GREEN;
                        c = 's';