OSDN Git Service

[Refactor] #40399 Separated object-value.c/h from object2.c/h
authorHourier <hourier@users.sourceforge.jp>
Mon, 1 Jun 2020 14:29:40 +0000 (23:29 +0900)
committerHourier <hourier@users.sourceforge.jp>
Mon, 1 Jun 2020 14:29:40 +0000 (23:29 +0900)
20 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/autopick/autopick-destroyer.c
src/autopick/autopick-matcher.c
src/cmd-item/cmd-item.c
src/floor/floor-events.c
src/inventory/inventory-object.c
src/io/load.c
src/market/building-craft-fix.c
src/object/object-value.c [new file with mode: 0644]
src/object/object-value.h [new file with mode: 0644]
src/object/object2.c
src/object/object2.h
src/player/player-effects.c
src/spell/spells3.c
src/store/store-util.c
src/store/store.c
src/wizard/wizard-special-process.c
src/wizard/wizard-spoiler.c

index 9f07096..655287c 100644 (file)
     <ClCompile Include="..\..\src\mind\samurai-slaying.c" />\r
     <ClCompile Include="..\..\src\mind\surprise-attack.c" />\r
     <ClCompile Include="..\..\src\object\object-appraiser.c" />\r
+    <ClCompile Include="..\..\src\object\object-value.c" />\r
     <ClCompile Include="..\..\src\pet\pet-fall-off.c" />\r
     <ClCompile Include="..\..\src\mspell\mspell-floor.c" />\r
     <ClCompile Include="..\..\src\mspell\mspell-particularity.c" />\r
     <ClInclude Include="..\..\src\mind\samurai-slaying.h" />\r
     <ClInclude Include="..\..\src\mind\surprise-attack.h" />\r
     <ClInclude Include="..\..\src\object\object-appraiser.h" />\r
+    <ClInclude Include="..\..\src\object\object-value.h" />\r
     <ClInclude Include="..\..\src\pet\pet-fall-off.h" />\r
     <ClInclude Include="..\..\src\pet\pet-util.h" />\r
     <ClInclude Include="..\..\src\mspell\assign-monster-spell.h" />\r
index e8260b8..6db9434 100644 (file)
     <ClCompile Include="..\..\src\inventory\inventory-object.c">
       <Filter>inventory</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\object\object-value.c">
+      <Filter>object</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\inventory\inventory-object.h">
       <Filter>inventory</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\object\object-value.h">
+      <Filter>object</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index a9f3c35..de77727 100644 (file)
@@ -304,6 +304,7 @@ hengband_SOURCES = \
        object/object-hook.c object/object-hook.h \
        object/object-kind.c object/object-kind.h \
        object/object-kind-hook.c object/object-kind-hook.h \
+       object/object-value.c object/object-value.h \
        object/lite-processor.c object/lite-processor.h \
        object/torch.c object/torch.h \
        object/tr-types.h object/trc-types.h object/tval-type.h \
index 9f8a97a..7d8942b 100644 (file)
@@ -12,7 +12,7 @@
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
 #include "object/object-mark-types.h"
-#include "object/object2.h"
+#include "object/object-value.h"
 #include "object/special-object-flags.h"
 #include "object/sv-other-types.h"
 #include "object/sv-wand-types.h"
index d7a3ba5..15ef7b1 100644 (file)
@@ -12,6 +12,7 @@
 #include "object/object-appraiser.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
+#include "object/object-value.h"
 #include "object/object2.h"
 #include "object/special-object-flags.h"
 
index b1fae8f..bf144b6 100644 (file)
@@ -42,6 +42,7 @@
 #include "object/special-object-flags.h"
 #include "object/sv-lite-types.h"
 #include "object/trc-types.h"
+#include "object/object-value.h"
 #include "player/avatar.h"
 #include "player/player-class.h"
 #include "player/player-effects.h"
index eaf4363..ee24971 100644 (file)
@@ -11,7 +11,7 @@
 #include "object/object-hook.h"
 #include "object/object-kind.h"
 #include "object/object-mark-types.h"
-#include "object/object2.h"
+#include "object/object-value.h"
 #include "object/special-object-flags.h"
 #include "object/sv-amulet-types.h"
 #include "object/sv-protector-types.h"
index 74b7cf3..dfa01fa 100644 (file)
@@ -1,5 +1,6 @@
 #include "inventory/inventory-object.h"
 #include "object/object-flavor.h"
+#include "object/object-value.h"
 #include "object/object2.h" // 暫定、相互参照している.
 #include "player/player-effects.h" // 暫定、相互参照している.
 #include "view/object-describer.h"
index 2e62144..d440b24 100644 (file)
@@ -70,6 +70,7 @@
 #include "object/object-mark-types.h"
 #include "object/object2.h"
 #include "object/old-ego-extra-values.h" // TODO v1.5.0以前のセーブファイルをロードする処理を分離する.
+#include "object/object-value.h"
 #include "object/sv-armor-types.h"
 #include "object/sv-lite-types.h"
 #include "object/tr-types.h"
index 3eb4b53..9f5ab16 100644 (file)
@@ -9,6 +9,7 @@
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
+#include "object/object-value.h"
 #include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "object/sv-other-types.h"
diff --git a/src/object/object-value.c b/src/object/object-value.c
new file mode 100644 (file)
index 0000000..4039a47
--- /dev/null
@@ -0,0 +1,315 @@
+#include "object/object-value.h"
+#include "object/artifact.h"
+#include "object/object-appraiser.h"
+#include "object/object-broken.h"
+#include "object/object-curse.h"
+#include "object/object-ego.h"
+#include "object/object-hook.h"
+#include "object/object-kind.h"
+#include "object/object1.h"
+#include "object/object2.h" // 暫定、相互参照している.
+#include "object/special-object-flags.h"
+
+/*!
+ * @brief 未鑑定なベースアイテムの基本価格を返す /
+ * Return the "value" of an "unknown" item Make a guess at the value of non-aware items
+ * @param o_ptr 未鑑定価格を確認したいオブジェクトの構造体参照ポインタ
+ * @return オブジェクトの未鑑定価格
+ */
+static PRICE object_value_base(object_type *o_ptr)
+{
+    if (object_is_aware(o_ptr))
+        return (k_info[o_ptr->k_idx].cost);
+
+    switch (o_ptr->tval) {
+    case TV_FOOD:
+        return (5L);
+    case TV_POTION:
+        return (20L);
+    case TV_SCROLL:
+        return (20L);
+    case TV_STAFF:
+        return (70L);
+    case TV_WAND:
+        return (50L);
+    case TV_ROD:
+        return (90L);
+    case TV_RING:
+        return (45L);
+    case TV_AMULET:
+        return (45L);
+    case TV_FIGURINE: {
+        DEPTH level = r_info[o_ptr->pval].level;
+        if (level < 20)
+            return level * 50L;
+        else if (level < 30)
+            return 1000 + (level - 20) * 150L;
+        else if (level < 40)
+            return 2500 + (level - 30) * 350L;
+        else if (level < 50)
+            return 6000 + (level - 40) * 800L;
+        else
+            return 14000 + (level - 50) * 2000L;
+    }
+    case TV_CAPTURE:
+        if (!o_ptr->pval)
+            return 1000L;
+        else
+            return ((r_info[o_ptr->pval].level) * 50L + 1000);
+    }
+
+    return (0L);
+}
+
+/*!
+ * @brief オブジェクト価格算出のメインルーチン /
+ * Return the price of an item including plusses (and charges)
+ * @param o_ptr 判明している現価格を確認したいオブジェクトの構造体参照ポインタ
+ * @return オブジェクトの判明している現価格
+ * @details
+ * This function returns the "value" of the given item (qty one)\n
+ *\n
+ * Never notice "unknown" bonuses or properties, including "curses",\n
+ * since that would give the player information he did not have.\n
+ *\n
+ * Note that discounted items stay discounted forever, even if\n
+ * the discount is "forgotten" by the player via memory loss.\n
+ */
+PRICE object_value(object_type *o_ptr)
+{
+    PRICE value;
+
+    if (object_is_known(o_ptr)) {
+        if (object_is_broken(o_ptr))
+            return (0L);
+        if (object_is_cursed(o_ptr))
+            return (0L);
+
+        value = object_value_real(o_ptr);
+    } else {
+        if ((o_ptr->ident & (IDENT_SENSE)) && object_is_broken(o_ptr))
+            return (0L);
+        if ((o_ptr->ident & (IDENT_SENSE)) && object_is_cursed(o_ptr))
+            return (0L);
+
+        value = object_value_base(o_ptr);
+    }
+
+    if (o_ptr->discount)
+        value -= (value * o_ptr->discount / 100L);
+
+    return (value);
+}
+
+/*!
+ * @brief オブジェクトの真の価格を算出する /
+ * Return the value of the flags the object has...
+ * @param o_ptr 本価格を確認したいオブジェクトの構造体参照ポインタ
+ * @return オブジェクトの本価格
+ * @details
+ * Return the "real" price of a "known" item, not including discounts\n
+ *\n
+ * Wand and staffs get cost for each charge\n
+ *\n
+ * Armor is worth an extra 100 gold per bonus point to armor class.\n
+ *\n
+ * Weapons are worth an extra 100 gold per bonus point (AC,TH,TD).\n
+ *\n
+ * Missiles are only worth 5 gold per bonus point, since they\n
+ * usually appear in groups of 20, and we want the player to get\n
+ * the same amount of cash for any "equivalent" item.  Note that\n
+ * missiles never have any of the "pval" flags, and in fact, they\n
+ * only have a few of the available flags, primarily of the "slay"\n
+ * and "brand" and "ignore" variety.\n
+ *\n
+ * Armor with a negative armor bonus is worthless.\n
+ * Weapons with negative hit+damage bonuses are worthless.\n
+ *\n
+ * Every wearable item with a "pval" bonus is worth extra (see below).\n
+ */
+PRICE object_value_real(object_type *o_ptr)
+{
+    BIT_FLAGS flgs[TR_FLAG_SIZE];
+    object_kind *k_ptr = &k_info[o_ptr->k_idx];
+
+    if (!k_info[o_ptr->k_idx].cost)
+        return (0L);
+
+    PRICE value = k_info[o_ptr->k_idx].cost;
+    object_flags(o_ptr, flgs);
+    if (object_is_fixed_artifact(o_ptr)) {
+        artifact_type *a_ptr = &a_info[o_ptr->name1];
+        if (!a_ptr->cost)
+            return (0L);
+
+        value = a_ptr->cost;
+        value += flag_cost(o_ptr, o_ptr->pval);
+        return (value);
+    } else if (object_is_ego(o_ptr)) {
+        ego_item_type *e_ptr = &e_info[o_ptr->name2];
+        if (!e_ptr->cost)
+            return (0L);
+
+        value += e_ptr->cost;
+        value += flag_cost(o_ptr, o_ptr->pval);
+    } else {
+        bool flag = FALSE;
+        for (int i = 0; i < TR_FLAG_SIZE; i++)
+            if (o_ptr->art_flags[i])
+                flag = TRUE;
+
+        if (flag)
+            value += flag_cost(o_ptr, o_ptr->pval);
+    }
+
+    /* Analyze pval bonus for normal object */
+    switch (o_ptr->tval) {
+    case TV_SHOT:
+    case TV_ARROW:
+    case TV_BOLT:
+    case TV_BOW:
+    case TV_DIGGING:
+    case TV_HAFTED:
+    case TV_POLEARM:
+    case TV_SWORD:
+    case TV_BOOTS:
+    case TV_GLOVES:
+    case TV_HELM:
+    case TV_CROWN:
+    case TV_SHIELD:
+    case TV_CLOAK:
+    case TV_SOFT_ARMOR:
+    case TV_HARD_ARMOR:
+    case TV_DRAG_ARMOR:
+    case TV_LITE:
+    case TV_AMULET:
+    case TV_RING:
+        if (!o_ptr->pval)
+            break;
+        if (o_ptr->pval < 0)
+            return (0L);
+
+        if (have_flag(flgs, TR_STR))
+            value += (o_ptr->pval * 200L);
+        if (have_flag(flgs, TR_INT))
+            value += (o_ptr->pval * 200L);
+        if (have_flag(flgs, TR_WIS))
+            value += (o_ptr->pval * 200L);
+        if (have_flag(flgs, TR_DEX))
+            value += (o_ptr->pval * 200L);
+        if (have_flag(flgs, TR_CON))
+            value += (o_ptr->pval * 200L);
+        if (have_flag(flgs, TR_CHR))
+            value += (o_ptr->pval * 200L);
+        if (have_flag(flgs, TR_MAGIC_MASTERY))
+            value += (o_ptr->pval * 100);
+        if (have_flag(flgs, TR_STEALTH))
+            value += (o_ptr->pval * 100L);
+        if (have_flag(flgs, TR_SEARCH))
+            value += (o_ptr->pval * 100L);
+        if (have_flag(flgs, TR_INFRA))
+            value += (o_ptr->pval * 50L);
+        if (have_flag(flgs, TR_TUNNEL))
+            value += (o_ptr->pval * 50L);
+        if (have_flag(flgs, TR_BLOWS))
+            value += (o_ptr->pval * 5000L);
+        if (have_flag(flgs, TR_SPEED))
+            value += (o_ptr->pval * 10000L);
+        break;
+    }
+
+    switch (o_ptr->tval) {
+    case TV_WAND: {
+        /* Pay extra for charges, depending on standard number of
+         * charges.  Handle new-style wands correctly. -LM-
+         */
+        value += (value * o_ptr->pval / o_ptr->number / (k_ptr->pval * 2));
+        break;
+    }
+    case TV_STAFF: {
+        /* Pay extra for charges, depending on standard number of
+         * charges.  -LM-
+         */
+        value += (value * o_ptr->pval / (k_ptr->pval * 2));
+        break;
+    }
+    case TV_RING:
+    case TV_AMULET: {
+        if (o_ptr->to_h + o_ptr->to_d + o_ptr->to_a < 0)
+            return (0L);
+
+        value += ((o_ptr->to_h + o_ptr->to_d + o_ptr->to_a) * 200L);
+        break;
+    }
+    case TV_BOOTS:
+    case TV_GLOVES:
+    case TV_CLOAK:
+    case TV_CROWN:
+    case TV_HELM:
+    case TV_SHIELD:
+    case TV_SOFT_ARMOR:
+    case TV_HARD_ARMOR:
+    case TV_DRAG_ARMOR: {
+        if (o_ptr->to_a < 0)
+            return (0L);
+
+        value += (((o_ptr->to_h - k_ptr->to_h) + (o_ptr->to_d - k_ptr->to_d)) * 200L + (o_ptr->to_a) * 100L);
+        break;
+    }
+    case TV_BOW:
+    case TV_DIGGING:
+    case TV_HAFTED:
+    case TV_SWORD:
+    case TV_POLEARM: {
+        if (o_ptr->to_h + o_ptr->to_d < 0)
+            return (0L);
+
+        value += ((o_ptr->to_h + o_ptr->to_d + o_ptr->to_a) * 100L);
+        value += (o_ptr->dd - k_ptr->dd) * o_ptr->ds * 250L;
+        value += (o_ptr->ds - k_ptr->ds) * o_ptr->dd * 250L;
+        break;
+    }
+    case TV_SHOT:
+    case TV_ARROW:
+    case TV_BOLT: {
+        if (o_ptr->to_h + o_ptr->to_d < 0)
+            return (0L);
+
+        value += ((o_ptr->to_h + o_ptr->to_d) * 5L);
+        value += (o_ptr->dd - k_ptr->dd) * o_ptr->ds * 5L;
+        value += (o_ptr->ds - k_ptr->ds) * o_ptr->dd * 5L;
+        break;
+    }
+    case TV_FIGURINE: {
+        DEPTH level = r_info[o_ptr->pval].level;
+        if (level < 20)
+            value = level * 50L;
+        else if (level < 30)
+            value = 1000 + (level - 20) * 150L;
+        else if (level < 40)
+            value = 2500 + (level - 30) * 350L;
+        else if (level < 50)
+            value = 6000 + (level - 40) * 800L;
+        else
+            value = 14000 + (level - 50) * 2000L;
+        break;
+    }
+    case TV_CAPTURE: {
+        if (!o_ptr->pval)
+            value = 1000L;
+        else
+            value = ((r_info[o_ptr->pval].level) * 50L + 1000);
+        break;
+    }
+    case TV_CHEST: {
+        if (!o_ptr->pval)
+            value = 0L;
+        break;
+    }
+    }
+
+    if (value < 0)
+        return 0L;
+
+    return (value);
+}
diff --git a/src/object/object-value.h b/src/object/object-value.h
new file mode 100644 (file)
index 0000000..456b007
--- /dev/null
@@ -0,0 +1,6 @@
+#pragma once
+
+#include "system/angband.h"
+
+PRICE object_value(object_type *o_ptr);
+PRICE object_value_real(object_type *o_ptr);
index 86d2097..b358030 100644 (file)
@@ -33,6 +33,7 @@
 #include "object/object-hook.h"
 #include "object/object-kind.h"
 #include "object/object-mark-types.h"
+#include "object/object-value.h" // 暫定、相互参照している.
 #include "object/special-object-flags.h"
 #include "object/sv-amulet-types.h"
 #include "object/sv-armor-types.h"
@@ -404,45 +405,6 @@ byte value_check_aux2(object_type *o_ptr)
 
 
 /*!
- * @brief 未鑑定なベースアイテムの基本価格を返す /
- * Return the "value" of an "unknown" item Make a guess at the value of non-aware items
- * @param o_ptr 未鑑定価格を確認したいオブジェクトの構造体参照ポインタ
- * @return オブジェクトの未鑑定価格
- */
-static PRICE object_value_base(object_type *o_ptr)
-{
-       if (object_is_aware(o_ptr))
-               return (k_info[o_ptr->k_idx].cost);
-
-       switch (o_ptr->tval)
-       {
-       case TV_FOOD: return (5L);
-       case TV_POTION: return (20L);
-       case TV_SCROLL: return (20L);
-       case TV_STAFF: return (70L);
-       case TV_WAND: return (50L);
-       case TV_ROD: return (90L);
-       case TV_RING: return (45L);
-       case TV_AMULET: return (45L);
-       case TV_FIGURINE:
-       {
-               DEPTH level = r_info[o_ptr->pval].level;
-               if (level < 20) return level * 50L;
-               else if (level < 30) return 1000 + (level - 20) * 150L;
-               else if (level < 40) return 2500 + (level - 30) * 350L;
-               else if (level < 50) return 6000 + (level - 40) * 800L;
-               else return 14000 + (level - 50) * 2000L;
-       }
-       case TV_CAPTURE:
-               if (!o_ptr->pval) return 1000L;
-               else return ((r_info[o_ptr->pval].level) * 50L + 1000);
-       }
-
-       return (0L);
-}
-
-
-/*!
  * @brief オブジェクトのフラグ類から価格を算出する /
  * Return the value of the flags the object has...
  * @param o_ptr フラグ価格を確認したいオブジェクトの構造体参照ポインタ
@@ -650,242 +612,6 @@ PRICE flag_cost(object_type *o_ptr, int plusses)
 
 
 /*!
- * @brief オブジェクトの真の価格を算出する /
- * Return the value of the flags the object has...
- * @param o_ptr 本価格を確認したいオブジェクトの構造体参照ポインタ
- * @return オブジェクトの本価格
- * @details
- * Return the "real" price of a "known" item, not including discounts\n
- *\n
- * Wand and staffs get cost for each charge\n
- *\n
- * Armor is worth an extra 100 gold per bonus point to armor class.\n
- *\n
- * Weapons are worth an extra 100 gold per bonus point (AC,TH,TD).\n
- *\n
- * Missiles are only worth 5 gold per bonus point, since they\n
- * usually appear in groups of 20, and we want the player to get\n
- * the same amount of cash for any "equivalent" item.  Note that\n
- * missiles never have any of the "pval" flags, and in fact, they\n
- * only have a few of the available flags, primarily of the "slay"\n
- * and "brand" and "ignore" variety.\n
- *\n
- * Armor with a negative armor bonus is worthless.\n
- * Weapons with negative hit+damage bonuses are worthless.\n
- *\n
- * Every wearable item with a "pval" bonus is worth extra (see below).\n
- */
-PRICE object_value_real(object_type *o_ptr)
-{
-       BIT_FLAGS flgs[TR_FLAG_SIZE];
-       object_kind *k_ptr = &k_info[o_ptr->k_idx];
-
-       if (!k_info[o_ptr->k_idx].cost) return (0L);
-
-       PRICE value = k_info[o_ptr->k_idx].cost;
-       object_flags(o_ptr, flgs);
-       if (object_is_fixed_artifact(o_ptr))
-       {
-               artifact_type *a_ptr = &a_info[o_ptr->name1];
-               if (!a_ptr->cost) return (0L);
-
-               value = a_ptr->cost;
-               value += flag_cost(o_ptr, o_ptr->pval);
-               return (value);
-       }
-       else if (object_is_ego(o_ptr))
-       {
-               ego_item_type *e_ptr = &e_info[o_ptr->name2];
-               if (!e_ptr->cost) return (0L);
-
-               value += e_ptr->cost;
-               value += flag_cost(o_ptr, o_ptr->pval);
-       }
-       else
-       {
-               bool flag = FALSE;
-               for (int i = 0; i < TR_FLAG_SIZE; i++)
-                       if (o_ptr->art_flags[i]) flag = TRUE;
-
-               if (flag) value += flag_cost(o_ptr, o_ptr->pval);
-       }
-
-       /* Analyze pval bonus for normal object */
-       switch (o_ptr->tval)
-       {
-       case TV_SHOT:
-       case TV_ARROW:
-       case TV_BOLT:
-       case TV_BOW:
-       case TV_DIGGING:
-       case TV_HAFTED:
-       case TV_POLEARM:
-       case TV_SWORD:
-       case TV_BOOTS:
-       case TV_GLOVES:
-       case TV_HELM:
-       case TV_CROWN:
-       case TV_SHIELD:
-       case TV_CLOAK:
-       case TV_SOFT_ARMOR:
-       case TV_HARD_ARMOR:
-       case TV_DRAG_ARMOR:
-       case TV_LITE:
-       case TV_AMULET:
-       case TV_RING:
-               if (!o_ptr->pval) break;
-               if (o_ptr->pval < 0) return (0L);
-
-               if (have_flag(flgs, TR_STR)) value += (o_ptr->pval * 200L);
-               if (have_flag(flgs, TR_INT)) value += (o_ptr->pval * 200L);
-               if (have_flag(flgs, TR_WIS)) value += (o_ptr->pval * 200L);
-               if (have_flag(flgs, TR_DEX)) value += (o_ptr->pval * 200L);
-               if (have_flag(flgs, TR_CON)) value += (o_ptr->pval * 200L);
-               if (have_flag(flgs, TR_CHR)) value += (o_ptr->pval * 200L);
-               if (have_flag(flgs, TR_MAGIC_MASTERY)) value += (o_ptr->pval * 100);
-               if (have_flag(flgs, TR_STEALTH)) value += (o_ptr->pval * 100L);
-               if (have_flag(flgs, TR_SEARCH)) value += (o_ptr->pval * 100L);
-               if (have_flag(flgs, TR_INFRA)) value += (o_ptr->pval * 50L);
-               if (have_flag(flgs, TR_TUNNEL)) value += (o_ptr->pval * 50L);
-               if (have_flag(flgs, TR_BLOWS)) value += (o_ptr->pval * 5000L);
-               if (have_flag(flgs, TR_SPEED)) value += (o_ptr->pval * 10000L);
-               break;
-       }
-
-       switch (o_ptr->tval)
-       {
-       case TV_WAND:
-       {
-               /* Pay extra for charges, depending on standard number of
-                * charges.  Handle new-style wands correctly. -LM-
-                */
-               value += (value * o_ptr->pval / o_ptr->number / (k_ptr->pval * 2));
-               break;
-       }
-       case TV_STAFF:
-       {
-               /* Pay extra for charges, depending on standard number of
-                * charges.  -LM-
-                */
-               value += (value * o_ptr->pval / (k_ptr->pval * 2));
-               break;
-       }
-       case TV_RING:
-       case TV_AMULET:
-       {
-               if (o_ptr->to_h + o_ptr->to_d + o_ptr->to_a < 0) return (0L);
-
-               value += ((o_ptr->to_h + o_ptr->to_d + o_ptr->to_a) * 200L);
-               break;
-       }
-       case TV_BOOTS:
-       case TV_GLOVES:
-       case TV_CLOAK:
-       case TV_CROWN:
-       case TV_HELM:
-       case TV_SHIELD:
-       case TV_SOFT_ARMOR:
-       case TV_HARD_ARMOR:
-       case TV_DRAG_ARMOR:
-       {
-               if (o_ptr->to_a < 0) return (0L);
-
-               value += (((o_ptr->to_h - k_ptr->to_h) + (o_ptr->to_d - k_ptr->to_d)) * 200L + (o_ptr->to_a) * 100L);
-               break;
-       }
-       case TV_BOW:
-       case TV_DIGGING:
-       case TV_HAFTED:
-       case TV_SWORD:
-       case TV_POLEARM:
-       {
-               if (o_ptr->to_h + o_ptr->to_d < 0) return (0L);
-
-               value += ((o_ptr->to_h + o_ptr->to_d + o_ptr->to_a) * 100L);
-               value += (o_ptr->dd - k_ptr->dd) * o_ptr->ds * 250L;
-               value += (o_ptr->ds - k_ptr->ds) * o_ptr->dd * 250L;
-               break;
-       }
-       case TV_SHOT:
-       case TV_ARROW:
-       case TV_BOLT:
-       {
-               if (o_ptr->to_h + o_ptr->to_d < 0) return (0L);
-
-               value += ((o_ptr->to_h + o_ptr->to_d) * 5L);
-               value += (o_ptr->dd - k_ptr->dd) * o_ptr->ds * 5L;
-               value += (o_ptr->ds - k_ptr->ds) * o_ptr->dd * 5L;
-               break;
-       }
-       case TV_FIGURINE:
-       {
-               DEPTH level = r_info[o_ptr->pval].level;
-               if (level < 20) value = level * 50L;
-               else if (level < 30) value = 1000 + (level - 20) * 150L;
-               else if (level < 40) value = 2500 + (level - 30) * 350L;
-               else if (level < 50) value = 6000 + (level - 40) * 800L;
-               else value = 14000 + (level - 50) * 2000L;
-               break;
-       }
-       case TV_CAPTURE:
-       {
-               if (!o_ptr->pval) value = 1000L;
-               else value = ((r_info[o_ptr->pval].level) * 50L + 1000);
-               break;
-       }
-       case TV_CHEST:
-       {
-               if (!o_ptr->pval) value = 0L;
-               break;
-       }
-       }
-
-       if (value < 0) return 0L;
-
-       return (value);
-}
-
-
-/*!
- * @brief オブジェクト価格算出のメインルーチン /
- * Return the price of an item including plusses (and charges)
- * @param o_ptr 判明している現価格を確認したいオブジェクトの構造体参照ポインタ
- * @return オブジェクトの判明している現価格
- * @details
- * This function returns the "value" of the given item (qty one)\n
- *\n
- * Never notice "unknown" bonuses or properties, including "curses",\n
- * since that would give the player information he did not have.\n
- *\n
- * Note that discounted items stay discounted forever, even if\n
- * the discount is "forgotten" by the player via memory loss.\n
- */
-PRICE object_value(object_type *o_ptr)
-{
-       PRICE value;
-
-       if (object_is_known(o_ptr))
-       {
-               if (object_is_broken(o_ptr)) return (0L);
-               if (object_is_cursed(o_ptr)) return (0L);
-
-               value = object_value_real(o_ptr);
-       }
-       else
-       {
-               if ((o_ptr->ident & (IDENT_SENSE)) && object_is_broken(o_ptr)) return (0L);
-               if ((o_ptr->ident & (IDENT_SENSE)) && object_is_cursed(o_ptr)) return (0L);
-
-               value = object_value_base(o_ptr);
-       }
-
-       if (o_ptr->discount) value -= (value * o_ptr->discount / 100L);
-
-       return (value);
-}
-
-
-/*!
  * @brief 魔法棒やロッドのスロット分割時に使用回数を分配する /
  * Distribute charges of rods or wands.
  * @param o_ptr 分割元オブジェクトの構造体参照ポインタ source item
index afcaded..01af4cb 100644 (file)
@@ -18,8 +18,6 @@ OBJECT_IDX get_obj_num(player_type *o_ptr, DEPTH level, BIT_FLAGS mode);
 byte value_check_aux1(object_type *o_ptr);
 byte value_check_aux2(object_type *o_ptr);
 
-PRICE object_value(object_type *o_ptr);
-PRICE object_value_real(object_type *o_ptr);
 void distribute_charges(object_type *o_ptr, object_type *q_ptr, int amt);
 void reduce_charges(object_type *o_ptr, int amt);
 int object_similar_part(object_type *o_ptr, object_type *j_ptr);
index 20cd9da..a7ecc64 100644 (file)
@@ -39,6 +39,7 @@
 #include "object/object-ego.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
+#include "object/object-value.h"
 #include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "object/sv-armor-types.h"
index 5db3ea5..6eb3919 100644 (file)
@@ -50,6 +50,7 @@
 #include "object/object-hook.h"
 #include "object/object-kind.h"
 #include "object/object-mark-types.h"
+#include "object/object-value.h"
 #include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "object/tr-types.h"
index 0a9b103..7f4670e 100644 (file)
@@ -10,6 +10,7 @@
 #include "object/object-appraiser.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
+#include "object/object-value.h"
 #include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "object/sv-lite-types.h"
index 4ac6e07..5dc834a 100644 (file)
@@ -48,6 +48,7 @@
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
+#include "object/object-value.h"
 #include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "player/avatar.h"
index 68c7193..5919f36 100644 (file)
@@ -40,6 +40,7 @@
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
 #include "object/object-kind.h"
+#include "object/object-value.h"
 #include "object/object2.h"
 #include "object/trc-types.h"
 #include "player/patron.h"
index 8c3d121..d24cdee 100644 (file)
@@ -20,6 +20,7 @@
 #include "object/object-ego.h"
 #include "object/object-flavor.h"
 #include "object/object-kind.h"
+#include "object/object-value.h"
 #include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "object/tr-types.h"