#define MAX_STACK_SIZE 99
/*!
- * todo この関数ポインタは何とかならんのか?
- * Hack -- function hook to restrict "get_obj_num_prep()" function
+ * Function hook to restrict "get_obj_num_prep()" function
*/
bool(*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
OBJECT_SUBTYPE_VALUE coin_type; /* Hack -- force coin type */
/*!
- * @brief オブジェクト生成テーブルからアイテムを取得する /
- * Choose an object kind that seems "appropriate" to the given level
- * @param owner_ptr プレーヤーへの参照ポインタ
- * @param level 生成階
- * @return 選ばれたオブジェクトベースID
- * @details
- * This function uses the "prob2" field of the "object allocation table",\n
- * and various local information, to calculate the "prob3" field of the\n
- * same table, which is then used to choose an "appropriate" object, in\n
- * a relatively efficient manner.\n
- *\n
- * It is (slightly) more likely to acquire an object of the given level\n
- * than one of a lower level. This is done by choosing several objects\n
- * appropriate to the given level and keeping the "hardest" one.\n
- *\n
- * Note that if no objects are "appropriate", then this function will\n
- * fail, and return zero, but this should *almost* never happen.\n
- */
-OBJECT_IDX get_obj_num(player_type *owner_ptr, DEPTH level, BIT_FLAGS mode)
-{
- int i, j, p;
- KIND_OBJECT_IDX k_idx;
- long value, total;
- object_kind *k_ptr;
- alloc_entry *table = alloc_kind_table;
-
- if (level > MAX_DEPTH - 1) level = MAX_DEPTH - 1;
-
- if ((level > 0) && !(d_info[owner_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
- {
- if (one_in_(GREAT_OBJ))
- {
- level = 1 + (level * MAX_DEPTH / randint1(MAX_DEPTH));
- }
- }
-
- total = 0L;
- for (i = 0; i < alloc_kind_size; i++)
- {
- if (table[i].level > level) break;
-
- table[i].prob3 = 0;
- k_idx = table[i].index;
- k_ptr = &k_info[k_idx];
-
- if ((mode & AM_FORBID_CHEST) && (k_ptr->tval == TV_CHEST)) continue;
-
- table[i].prob3 = table[i].prob2;
- total += table[i].prob3;
- }
-
- if (total <= 0) return 0;
-
- value = randint0(total);
- for (i = 0; i < alloc_kind_size; i++)
- {
- if (value < table[i].prob3) break;
-
- value = value - table[i].prob3;
- }
-
- p = randint0(100);
- if (p < 60)
- {
- j = i;
- value = randint0(total);
- for (i = 0; i < alloc_kind_size; i++)
- {
- if (value < table[i].prob3) break;
-
- value = value - table[i].prob3;
- }
-
- if (table[i].level < table[j].level) i = j;
- }
-
- if (p >= 10) return (table[i].index);
-
- j = i;
- value = randint0(total);
- for (i = 0; i < alloc_kind_size; i++)
- {
- if (value < table[i].prob3) break;
-
- value = value - table[i].prob3;
- }
-
- if (table[i].level < table[j].level) i = j;
- return (table[i].index);
-}
-
-
-/*!
* @brief 重度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 1 (Heavy).
* @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
* @return 擬似鑑定結果のIDを返す。
extern bool (*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
s32b flag_cost(object_type *o_ptr, int plusses);
-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);
void distribute_charges(object_type *o_ptr, object_type *q_ptr, int amt);
#include "store/store-util.h"
#include "object-enchant/item-apply-magic.h"
#include "object-enchant/item-feeling.h"
+#include "object-enchant/special-object-flags.h"
+#include "object-enchant/tr-types.h"
#include "object/object-appraiser.h"
#include "object/object-generator.h"
#include "object/object-hook.h"
#include "object/object-kind.h"
#include "object/object-value.h"
#include "object/object2.h"
-#include "object-enchant/special-object-flags.h"
#include "sv-definition/sv-lite-types.h"
#include "sv-definition/sv-potion-types.h"
#include "sv-definition/sv-scroll-types.h"
#include "sv-definition/sv-weapon-types.h"
-#include "object-enchant/tr-types.h"
+#include "world/world-object.h"
int cur_store_num = 0;
store_type *st_ptr = NULL;
#include "world/world-object.h"
+#include "dungeon/dungeon.h"
+#include "object-enchant/item-apply-magic.h"
+#include "object/object-kind.h"
#include "world/world.h"
/*!
return 0;
}
+
+/*!
+ * @brief オブジェクト生成テーブルからアイテムを取得する /
+ * Choose an object kind that seems "appropriate" to the given level
+ * @param owner_ptr プレーヤーへの参照ポインタ
+ * @param level 生成階
+ * @return 選ばれたオブジェクトベースID
+ * @details
+ * This function uses the "prob2" field of the "object allocation table",\n
+ * and various local information, to calculate the "prob3" field of the\n
+ * same table, which is then used to choose an "appropriate" object, in\n
+ * a relatively efficient manner.\n
+ *\n
+ * It is (slightly) more likely to acquire an object of the given level\n
+ * than one of a lower level. This is done by choosing several objects\n
+ * appropriate to the given level and keeping the "hardest" one.\n
+ *\n
+ * Note that if no objects are "appropriate", then this function will\n
+ * fail, and return zero, but this should *almost* never happen.\n
+ */
+OBJECT_IDX get_obj_num(player_type *owner_ptr, DEPTH level, BIT_FLAGS mode)
+{
+ int i, j, p;
+ KIND_OBJECT_IDX k_idx;
+ long value, total;
+ object_kind *k_ptr;
+ alloc_entry *table = alloc_kind_table;
+
+ if (level > MAX_DEPTH - 1)
+ level = MAX_DEPTH - 1;
+
+ if ((level > 0) && !(d_info[owner_ptr->dungeon_idx].flags1 & DF1_BEGINNER)) {
+ if (one_in_(GREAT_OBJ)) {
+ level = 1 + (level * MAX_DEPTH / randint1(MAX_DEPTH));
+ }
+ }
+
+ total = 0L;
+ for (i = 0; i < alloc_kind_size; i++) {
+ if (table[i].level > level)
+ break;
+
+ table[i].prob3 = 0;
+ k_idx = table[i].index;
+ k_ptr = &k_info[k_idx];
+
+ if ((mode & AM_FORBID_CHEST) && (k_ptr->tval == TV_CHEST))
+ continue;
+
+ table[i].prob3 = table[i].prob2;
+ total += table[i].prob3;
+ }
+
+ if (total <= 0)
+ return 0;
+
+ value = randint0(total);
+ for (i = 0; i < alloc_kind_size; i++) {
+ if (value < table[i].prob3)
+ break;
+
+ value = value - table[i].prob3;
+ }
+
+ p = randint0(100);
+ if (p < 60) {
+ j = i;
+ value = randint0(total);
+ for (i = 0; i < alloc_kind_size; i++) {
+ if (value < table[i].prob3)
+ break;
+
+ value = value - table[i].prob3;
+ }
+
+ if (table[i].level < table[j].level)
+ i = j;
+ }
+
+ if (p >= 10)
+ return (table[i].index);
+
+ j = i;
+ value = randint0(total);
+ for (i = 0; i < alloc_kind_size; i++) {
+ if (value < table[i].prob3)
+ break;
+
+ value = value - table[i].prob3;
+ }
+
+ if (table[i].level < table[j].level)
+ i = j;
+ return (table[i].index);
+}
#include "floor/floor.h"
OBJECT_IDX o_pop(floor_type *floor_ptr);
+OBJECT_IDX get_obj_num(player_type *o_ptr, DEPTH level, BIT_FLAGS mode);