OSDN Git Service

have_nightmare()の準備処理を同関数に含め、引数を削除。 / Include previous process of have_nightmare...
authorDeskull <desull@users.sourceforge.jp>
Wed, 25 Feb 2015 13:51:56 +0000 (22:51 +0900)
committerDeskull <desull@users.sourceforge.jp>
Wed, 25 Feb 2015 13:51:56 +0000 (22:51 +0900)
src/bldg.c
src/cmd1.c
src/cmd6.c
src/externs.h
src/spells1.c

index d3ec854..d5d6aa3 100644 (file)
@@ -2092,13 +2092,22 @@ bool get_nightmare(int r_idx)
  * @return なし
  * @todo 重複関数あり、要リファクタリング。
  */
-void have_nightmare(int r_idx)
+void have_nightmare()
 {
        bool happened = FALSE;
-       monster_race *r_ptr = &r_info[r_idx];
-       int power = r_ptr->level + 10;
+       monster_race *r_ptr;
+       int power;
        char m_name[80];
-       cptr desc = r_name + r_ptr->name;
+       cptr desc;
+
+       get_mon_num_prep(get_nightmare, NULL);
+
+       r_ptr = &r_info[get_mon_num(MAX_DEPTH)];
+       power = r_ptr->level + 10;
+       desc = r_name + r_ptr->name;
+
+       get_mon_num_prep(NULL, NULL);
+
 
        /* Describe it */
 #ifndef JP
@@ -2376,20 +2385,14 @@ static bool inn_comm(int cmd)
                                {
                                        msg_print(_("眠りに就くと恐ろしい光景が心をよぎった。", "Horrible visions flit through your mind as you sleep."));
 
-                                       /* Pick a nightmare */
-                                       get_mon_num_prep(get_nightmare, NULL);
-
                                        /* Have some nightmares */
                                        while(1)
                                        {
-                                               have_nightmare(get_mon_num(MAX_DEPTH));
+                                               have_nightmare();
 
                                                if (!one_in_(3)) break;
                                        }
 
-                                       /* Remove the monster restriction */
-                                       get_mon_num_prep(NULL, NULL);
-
                                        msg_print(_("あなたは絶叫して目を覚ました。", "You awake screaming."));
                                        do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("悪夢にうなされてよく眠れなかった。", "be troubled by a nightmare."));
                                }
index 77b418a..8c6c394 100644 (file)
@@ -1240,14 +1240,9 @@ static void hit_trap(bool break_trap)
                                {
                                        msg_print(_("身の毛もよだつ光景が頭に浮かんだ。", "A horrible vision enters your mind."));
 
-                                       /* Pick a nightmare */
-                                       get_mon_num_prep(get_nightmare, NULL);
-
                                        /* Have some nightmares */
-                                       have_nightmare(get_mon_num(MAX_DEPTH));
+                                       have_nightmare();
 
-                                       /* Remove the monster restriction */
-                                       get_mon_num_prep(NULL, NULL);
                                }
                                (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5);
                        }
index 1a45776..7107cd0 100644 (file)
@@ -809,14 +809,8 @@ static void do_cmd_quaff_potion_aux(int item)
                                {
                                        msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
 
-                                       /* Pick a nightmare */
-                                       get_mon_num_prep(get_nightmare, NULL);
-
                                        /* Have some nightmares */
-                                       have_nightmare(get_mon_num(MAX_DEPTH));
-
-                                       /* Remove the monster restriction */
-                                       get_mon_num_prep(NULL, NULL);
+                                       have_nightmare();
                                }
                                if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4))
                                {
index 5845f47..351a54f 100644 (file)
@@ -1296,7 +1296,7 @@ extern void move_to_black_market(object_type * o_ptr);
 
 /* bldg.c */
 extern bool get_nightmare(int r_idx);
-extern void have_nightmare(int r_idx);
+extern void have_nightmare(void);
 extern void battle_monsters(void);
 extern void do_cmd_bldg(void);
 extern void do_cmd_quest(void);
index a5bbeae..59ba66e 100644 (file)
@@ -5889,15 +5889,8 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
                        if (ironman_nightmare)
                        {
                 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
-
-                               /* Pick a nightmare */
-                               get_mon_num_prep(get_nightmare, NULL);
-
                                /* Have some nightmares */
-                               have_nightmare(get_mon_num(MAX_DEPTH));
-
-                               /* Remove the monster restriction */
-                               get_mon_num_prep(NULL, NULL);
+                               have_nightmare();
                        }
 
                        set_paralyzed(p_ptr->paralyzed + dam);