OSDN Git Service

[Refactor] #40233 Separated check_free_space() from store_check_num()
authorHourier <hourier@users.sourceforge.jp>
Thu, 16 Jul 2020 14:22:19 +0000 (23:22 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 16 Jul 2020 14:22:19 +0000 (23:22 +0900)
src/store/store.c

index 9026598..7c4d7c3 100644 (file)
@@ -46,6 +46,24 @@ int cur_store_feat;
 /* Enable "increments" */
 bool allow_inc = FALSE;
 
+/*
+ * @brief アイテムが格納可能な数より多いかをチェックする
+ * @param なし
+ * @return エラーコード
+ * オプション powerup_home が設定されていると我が家が 20 ページまで使える /
+ * Free space is always usable
+ */
+static errr check_free_space(void)
+{
+    if ((cur_store_num == STORE_HOME) && !powerup_home)
+        if (st_ptr->stock_num < ((st_ptr->stock_size) / 10))
+            return 1;
+        else if (st_ptr->stock_num < st_ptr->stock_size)
+            return 1;
+
+    return 0;
+}
+
 /*!
  * @brief 店舗に品を置くスペースがあるかどうかの判定を返す /
  * Check to see if the shop will be carrying too many objects  -RAK-
@@ -96,22 +114,7 @@ int store_check_num(object_type *o_ptr)
         }
     }
 
-    /* Free space is always usable */
-    /*
-     * オプション powerup_home が設定されていると
-     * 我が家が 20 ページまで使える
-     */
-    if ((cur_store_num == STORE_HOME) && !powerup_home) {
-        if (st_ptr->stock_num < ((st_ptr->stock_size) / 10)) {
-            return 1;
-        }
-    } else {
-        if (st_ptr->stock_num < st_ptr->stock_size) {
-            return 1;
-        }
-    }
-
-    return 0;
+    return check_free_space();
 }
 
 /*!