OSDN Git Service

保存階にいるアイテムを拾ったユニークモンスターが別の階に現れてから保
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 13 Aug 2003 08:37:46 +0000 (08:37 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 13 Aug 2003 08:37:46 +0000 (08:37 +0000)
存階に戻った場合, lite_spot()が呼ばれた際に配列外アクセスを起こして強
制終了する場合があるバグを修正. また, monster_drop_carried_objects()
内でのo_ptr->held_m_idxの扱いがおかしく, モンスターがアイテムを落とす
度に座標(0,0)が再描画されていたバグも修正.

src/monster2.c

index ae7d45b..6b0fb5a 100644 (file)
@@ -245,8 +245,10 @@ void delete_monster_idx(int i)
                /* Acquire next object */
                next_o_idx = o_ptr->next_o_idx;
 
-               /* Hack -- efficiency */
-               o_ptr->held_m_idx = 0;
+               /*
+                * o_ptr->held_m_idx is needed in delete_object_idx()
+                * to prevent calling lite_spot()
+                */
 
                /* Delete the object */
                delete_object_idx(this_o_idx);
@@ -4962,15 +4964,15 @@ void monster_drop_carried_objects(monster_type *m_ptr)
                /* Acquire next object */
                next_o_idx = o_ptr->next_o_idx;
 
-               /* Paranoia */
-               o_ptr->held_m_idx = 0;
-
                /* Get local object */
                q_ptr = &forge;
 
                /* Copy the object */
                object_copy(q_ptr, o_ptr);
 
+               /* Forget monster */
+               q_ptr->held_m_idx = 0;
+
                /* Delete the object */
                delete_object_idx(this_o_idx);