OSDN Git Service

[Refactor] #40233 Moved display_store() from store.c to display-store.c/h
authorHourier <hourier@users.sourceforge.jp>
Thu, 16 Jul 2020 12:01:52 +0000 (21:01 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 16 Jul 2020 12:01:52 +0000 (21:01 +0900)
src/store/store.c
src/store/store.h
src/view/display-store.c
src/view/display-store.h

index 7681f9d..71a62fc 100644 (file)
@@ -110,7 +110,7 @@ static s16b inner_town_num = 0;
 /*
  * We store the current "store feat" here so everyone can access it
  */
-static int cur_store_feat;
+int cur_store_feat;
 
 /*!
  * @brief 店舗価格を決定する. 無料にはならない /
@@ -469,7 +469,7 @@ static void updatebargain(PRICE price, PRICE minprice, int num)
  * @return なし
  * @details
  */
-static void store_prt_gold(player_type *player_ptr)
+void store_prt_gold(player_type *player_ptr)
 {
     prt(_("手持ちのお金: ", "Gold Remaining: "), 19 + xtra_stock, 53);
     char out_val[64];
@@ -478,60 +478,6 @@ static void store_prt_gold(player_type *player_ptr)
 }
 
 /*!
- * @brief 店舗情報全体を表示するメインルーチン /
- * Displays store (after clearing screen)              -RAK-
- * @param player_ptr プレーヤーへの参照ポインタ
- * @return なし
- * @details
- */
-static void display_store(player_type *player_ptr)
-{
-    term_clear();
-    if (cur_store_num == STORE_HOME) {
-        put_str(_("我が家", "Your Home"), 3, 31);
-        put_str(_("アイテムの一覧", "Item Description"), 5, 4);
-        if (show_weights) {
-            put_str(_("  重さ", "Weight"), 5, 70);
-        }
-
-        store_prt_gold(player_ptr);
-        display_store_inventory(player_ptr);
-        return;
-    }
-
-    if (cur_store_num == STORE_MUSEUM) {
-        put_str(_("博物館", "Museum"), 3, 31);
-        put_str(_("アイテムの一覧", "Item Description"), 5, 4);
-        if (show_weights) {
-            put_str(_("  重さ", "Weight"), 5, 70);
-        }
-
-        store_prt_gold(player_ptr);
-        display_store_inventory(player_ptr);
-        return;
-    }
-
-    concptr store_name = (f_name + f_info[cur_store_feat].name);
-    concptr owner_name = (ot_ptr->owner_name);
-    concptr race_name = race_info[ot_ptr->owner_race].title;
-    char buf[80];
-    sprintf(buf, "%s (%s)", owner_name, race_name);
-    put_str(buf, 3, 10);
-
-    sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
-    prt(buf, 3, 50);
-
-    put_str(_("商品の一覧", "Item Description"), 5, 5);
-    if (show_weights) {
-        put_str(_("  重さ", "Weight"), 5, 60);
-    }
-
-    put_str(_(" 価格", "Price"), 5, 72);
-    store_prt_gold(player_ptr);
-    display_store_inventory(player_ptr);
-}
-
-/*!
  * @brief 店舗からアイテムを選択する /
  * Get the ID of a store item and return its value     -RAK-
  * @param com_val 選択IDを返す参照ポインタ
index 92b05bc..474eaf6 100644 (file)
@@ -16,9 +16,12 @@ extern int store_bottom;
 extern int xtra_stock;
 extern const owner_type *ot_ptr;
 
+extern int cur_store_feat;
+
 PRICE price_item(player_type *player_ptr, object_type *o_ptr, int greed, bool flip);
 bool combine_and_reorder_home(player_type *player_ptr, int store_num);
 bool noneedtobargain(PRICE minprice);
+void store_prt_gold(player_type *player_ptr);
 void do_cmd_store(player_type *player_ptr);
 void store_shuffle(player_type *player_ptr, int which);
 void store_maintenance(player_type *player_ptr, int town_num, int store_num);
index 807f58f..d36cc83 100644 (file)
@@ -3,9 +3,11 @@
 #include "game-option/birth-options.h"
 #include "game-option/special-options.h"
 #include "game-option/text-display-options.h"
+#include "grid/feature.h"
 #include "object-enchant/special-object-flags.h"
 #include "object/object-info.h"
 #include "object/object-kind.h"
+#include "player/race-info-table.h"
 #include "store/store-util.h"
 #include "store/store.h" // todo 相互依存している、こっちは残す?.
 #include "system/object-type-definition.h"
@@ -136,3 +138,56 @@ void display_store_inventory(player_type *player_ptr)
         put_str(format(_("アイテム数:  %4d/%4d", "Objects:  %4d/%4d"), st_ptr->stock_num, k), 19 + xtra_stock, _(27, 30));
     }
 }
+
+/*!
+ * @brief 店舗情報全体を表示するメインルーチン /
+ * Displays store (after clearing screen)              -RAK-
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ * @details
+ */
+void display_store(player_type *player_ptr)
+{
+    term_clear();
+    if (cur_store_num == STORE_HOME) {
+        put_str(_("我が家", "Your Home"), 3, 31);
+        put_str(_("アイテムの一覧", "Item Description"), 5, 4);
+        if (show_weights) {
+            put_str(_("  重さ", "Weight"), 5, 70);
+        }
+
+        store_prt_gold(player_ptr);
+        display_store_inventory(player_ptr);
+        return;
+    }
+
+    if (cur_store_num == STORE_MUSEUM) {
+        put_str(_("博物館", "Museum"), 3, 31);
+        put_str(_("アイテムの一覧", "Item Description"), 5, 4);
+        if (show_weights) {
+            put_str(_("  重さ", "Weight"), 5, 70);
+        }
+
+        store_prt_gold(player_ptr);
+        display_store_inventory(player_ptr);
+        return;
+    }
+
+    concptr store_name = (f_name + f_info[cur_store_feat].name);
+    concptr owner_name = (ot_ptr->owner_name);
+    concptr race_name = race_info[ot_ptr->owner_race].title;
+    char buf[80];
+    sprintf(buf, "%s (%s)", owner_name, race_name);
+    put_str(buf, 3, 10);
+
+    sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
+    prt(buf, 3, 50);
+
+    put_str(_("商品の一覧", "Item Description"), 5, 5);
+    if (show_weights)
+        put_str(_("  重さ", "Weight"), 5, 60);
+
+    put_str(_(" 価格", "Price"), 5, 72);
+    store_prt_gold(player_ptr);
+    display_store_inventory(player_ptr);
+}
index 838200b..628469f 100644 (file)
@@ -4,3 +4,4 @@
 
 void display_entry(player_type *player_ptr, int pos);
 void display_store_inventory(player_type *player_ptr);
+void display_store(player_type *player_ptr);