OSDN Git Service

[fix] #65 未初期化の変数を参照している
[hengbandforosx/hengbandosx.git] / src / floor / floor-object.c
index 1c2f329..254ceec 100644 (file)
@@ -6,20 +6,24 @@
  */
 
 #include "floor/floor-object.h"
+#include "artifact/fixed-art-generator.h"
+#include "flavor/flavor-describer.h"
+#include "flavor/object-flavor-types.h"
+#include "floor/cave.h"
 #include "game-option/birth-options.h"
 #include "game-option/cheat-options.h"
 #include "game-option/cheat-types.h"
 #include "grid/feature.h"
 #include "grid/grid.h"
+#include "inventory/inventory-slot-types.h"
+#include "inventory/item-getter.h"
 #include "main/sound-definitions-table.h"
 #include "main/sound-of-music.h"
 #include "object-enchant/apply-magic.h"
-#include "object-enchant/artifact.h"
 #include "object-enchant/item-apply-magic.h"
 #include "object-enchant/special-object-flags.h"
 #include "object-hook/hook-checker.h"
 #include "object-hook/hook-enchant.h"
-#include "object/object-flavor.h"
 #include "object/object-generator.h"
 #include "object/object-info.h"
 #include "object/object-kind-hook.h"
 #include "object/object-stack.h"
 #include "perception/object-perception.h"
 #include "system/alloc-entries.h"
+#include "system/artifact-type-definition.h"
+#include "system/floor-type-definition.h"
 #include "system/system-variables.h"
+#include "target/projection-path-calculator.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
 #include "wizard/wizard-messages.h"
@@ -69,8 +76,8 @@ static void object_mention(player_type *owner_ptr, object_type *o_ptr)
 
     o_ptr->ident |= (IDENT_FULL_KNOWN);
     GAME_TEXT o_name[MAX_NLEN];
-    object_desc(owner_ptr, o_name, o_ptr, 0);
-    msg_format_wizard(CHEAT_OBJECT, _("%sを生成しました。", "%s was generated."), o_name);
+    describe_flavor(owner_ptr, o_name, o_ptr, 0);
+    msg_format_wizard(owner_ptr, CHEAT_OBJECT, _("%sを生成しました。", "%s was generated."), o_name);
 }
 
 /*!
@@ -355,7 +362,7 @@ OBJECT_IDX drop_near(player_type *owner_ptr, object_type *j_ptr, PERCENTAGE chan
 #else
     bool plural = (j_ptr->number != 1);
 #endif
-    object_desc(owner_ptr, o_name, j_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+    describe_flavor(owner_ptr, o_name, j_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
     if (!object_is_artifact(j_ptr) && (randint0(100) < chance)) {
 #ifdef JP
         msg_format("%sは消えた。", o_name);
@@ -595,7 +602,7 @@ void floor_item_describe(player_type *owner_ptr, INVENTORY_IDX item)
 {
     object_type *o_ptr = &owner_ptr->current_floor_ptr->o_list[item];
     GAME_TEXT o_name[MAX_NLEN];
-    object_desc(owner_ptr, o_name, o_ptr, 0);
+    describe_flavor(owner_ptr, o_name, o_ptr, 0);
 #ifdef JP
     if (o_ptr->number <= 0) {
         msg_format("床上には、もう%sはない。", o_name);
@@ -606,3 +613,25 @@ void floor_item_describe(player_type *owner_ptr, INVENTORY_IDX item)
     msg_format("You see %s.", o_name);
 #endif
 }
+
+/*
+ * Choose an item and get auto-picker entry from it.
+ */
+object_type *choose_object(player_type *owner_ptr, OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option, tval_type tval)
+{
+    OBJECT_IDX item;
+
+    if (idx)
+        *idx = INVEN_NONE;
+
+    if (!get_item(owner_ptr, &item, q, s, option, tval))
+        return NULL;
+
+    if (idx)
+        *idx = item;
+
+    if (item == INVEN_FORCE)
+        return NULL;
+
+    return ref_item(owner_ptr, item);
+}