OSDN Git Service

特定モンスターが落とす特定文字限定のアイテムの処理などでmake_object()
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 11 Oct 2003 06:54:48 +0000 (06:54 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 11 Oct 2003 06:54:48 +0000 (06:54 +0000)
の前にget_obj_num_prep()を呼んでいた部分を整理し, make_object()内部の
みでテーブル処理も行うように変更. get_obj_num_prep()はobject2.cでしか
使われなくなったため, staticにした.

src/externs.h
src/object2.c
src/xtra2.c

index c092dd3..459c4db 100644 (file)
@@ -897,7 +897,6 @@ extern void delete_object(int y, int x);
 extern void compact_objects(int size);
 extern void wipe_o_list(void);
 extern s16b o_pop(void);
-extern errr get_obj_num_prep(void);
 extern s16b get_obj_num(int level);
 extern void object_known(object_type *o_ptr);
 extern void object_aware(object_type *o_ptr);
index 5c46d80..f9ec08b 100644 (file)
@@ -561,7 +561,7 @@ s16b o_pop(void)
 /*
  * Apply a "object restriction function" to the "object allocation table"
  */
-errr get_obj_num_prep(void)
+static errr get_obj_num_prep(void)
 {
        int i;
 
@@ -4617,31 +4617,26 @@ bool make_object(object_type *j_ptr, u32b mode)
        {
                int k_idx;
 
-               /*
-                * Hack -- If restriction is already specified, allocation table is
-                * should be prepared by get_obj_num_prep().
-                * We rely previous preparation before reaching here.
-                */
                /* Good objects */
                if ((mode & AM_GOOD) && !get_obj_num_hook)
                {
-                       /* Activate restriction (if already specified, use it) */
+                       /* Activate restriction (if already specified, use that) */
                        get_obj_num_hook = kind_is_good;
-
-                       /* Prepare allocation table */
-                       get_obj_num_prep();
                }
 
+               /* Restricted objects - prepare allocation table */
+               if (get_obj_num_hook) get_obj_num_prep();
+
                /* Pick a random object */
                k_idx = get_obj_num(base);
 
-               /* Good objects */
+               /* Restricted objects */
                if (get_obj_num_hook)
                {
                        /* Clear restriction */
                        get_obj_num_hook = NULL;
 
-                       /* Prepare allocation table */
+                       /* Reset allocation table to default */
                        get_obj_num_prep();
                }
 
index b7e98fa..2c33bc0 100644 (file)
@@ -915,9 +915,6 @@ msg_print("
                        else
                                get_obj_num_hook = kind_is_book;
 
-                       /* Prepare allocation table */
-                       get_obj_num_prep();
-
                        /* Make a book */
                        make_object(q_ptr, mo_mode);
 
@@ -1099,9 +1096,6 @@ msg_print("
                                /* Activate restriction */
                                get_obj_num_hook = kind_is_cloak;
 
-                               /* Prepare allocation table */
-                               get_obj_num_prep();
-
                                /* Make a cloak */
                                make_object(q_ptr, mo_mode);
 
@@ -1122,9 +1116,6 @@ msg_print("
                                /* Activate restriction */
                                get_obj_num_hook = kind_is_polearm;
 
-                               /* Prepare allocation table */
-                               get_obj_num_prep();
-
                                /* Make a poleweapon */
                                make_object(q_ptr, mo_mode);
 
@@ -1145,9 +1136,6 @@ msg_print("
                                /* Activate restriction */
                                get_obj_num_hook = kind_is_armor;
 
-                               /* Prepare allocation table */
-                               get_obj_num_prep();
-
                                /* Make a hard armor */
                                make_object(q_ptr, mo_mode);
 
@@ -1168,9 +1156,6 @@ msg_print("
                                /* Activate restriction */
                                get_obj_num_hook = kind_is_sword;
 
-                               /* Prepare allocation table */
-                               get_obj_num_prep();
-
                                /* Make a sword */
                                make_object(q_ptr, mo_mode);