From: Deskull Date: Wed, 25 Feb 2015 13:51:56 +0000 (+0900) Subject: have_nightmare()の準備処理を同関数に含め、引数を削除。 / Include previous process of have_nightmare... X-Git-Tag: v2.2.0~76 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=52405daa8dcabe41a5023abefa1b38bbda98e5a9;p=hengbandforosx%2Fhengbandosx.git have_nightmare()の準備処理を同関数に含め、引数を削除。 / Include previous process of have_nightmare to that function, and delete a argument. --- diff --git a/src/bldg.c b/src/bldg.c index d3ec8548e..d5d6aa3b6 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -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.")); } diff --git a/src/cmd1.c b/src/cmd1.c index 77b418a2f..8c6c394cb 100644 --- a/src/cmd1.c +++ b/src/cmd1.c @@ -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); } diff --git a/src/cmd6.c b/src/cmd6.c index 1a457767d..7107cd0e6 100644 --- a/src/cmd6.c +++ b/src/cmd6.c @@ -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)) { diff --git a/src/externs.h b/src/externs.h index 5845f4795..351a54fda 100644 --- a/src/externs.h +++ b/src/externs.h @@ -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); diff --git a/src/spells1.c b/src/spells1.c index a5bbeae00..59ba66ef8 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -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);