OSDN Git Service

[Refactor] #37917 word_of_recall() と recall_player() を整理。 / Refactor word_of_recall...
authorDeskull <deskull@users.sourceforge.jp>
Sat, 12 Jan 2019 13:16:48 +0000 (22:16 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Sat, 12 Jan 2019 13:16:48 +0000 (22:16 +0900)
14 files changed:
src/bldg.c
src/cmd-activate.c
src/cmd-read.c
src/cmd-zaprod.c
src/dungeon.c
src/externs.h
src/mind.c
src/mutation.c
src/racial.c
src/realm-arcane.c
src/realm-life.c
src/realm-sorcery.c
src/realm-trump.c
src/spells3.c

index 9bce817..c4447af 100644 (file)
@@ -4110,7 +4110,7 @@ static void bldg_process_command(building_type *bldg, int i)
                break;
 
        case BACT_RECALL:
-               if (recall_player(1)) paid = TRUE;
+               if (recall_player(p_ptr, 1)) paid = TRUE;
                break;
 
        case BACT_TELEPORT_LEVEL:
index 5be685f..8900d33 100644 (file)
@@ -1361,7 +1361,7 @@ bool activate_artifact(object_type *o_ptr)
        case ACT_RECALL:
        {
                msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
-               if (!word_of_recall()) return FALSE;
+               if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
                break;
        }
 
@@ -1381,7 +1381,7 @@ bool activate_artifact(object_type *o_ptr)
 
                if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
                {
-                       (void)word_of_recall();
+                       (void)recall_player(p_ptr, randint0(21) + 15);
                }
 
                break;
index 1a20b4e..bb0a992 100644 (file)
@@ -185,7 +185,7 @@ void do_cmd_read_scroll_aux(INVENTORY_IDX item, bool known)
 \r
                case SV_SCROLL_WORD_OF_RECALL:\r
                {\r
-                       if (!word_of_recall()) used_up = FALSE;\r
+                       if (!recall_player(p_ptr, randint0(21) + 15)) used_up = FALSE;\r
                        ident = TRUE;\r
                        break;\r
                }\r
index 29350ba..b48b412 100644 (file)
@@ -49,7 +49,7 @@ int rod_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool
 
        case SV_ROD_RECALL:
        {
-               if (!word_of_recall()) *use_charge = FALSE;
+               if (!recall_player(p_ptr, randint0(21) + 15)) *use_charge = FALSE;
                ident = TRUE;
                break;
        }
index 3f625cc..ce99e1b 100644 (file)
@@ -523,8 +523,8 @@ static void pattern_teleport(void)
        /* Ask for level */
        if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
        {
-               char    ppp[80];
-               char    tmp_val[160];
+               char ppp[80];
+               char tmp_val[160];
 
                /* Only downward in ironman mode */
                if (ironman_downward)
@@ -582,7 +582,7 @@ static void pattern_teleport(void)
 
        leave_quest_check();
 
-       if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
+       if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
 
        p_ptr->inside_quest = 0;
        p_ptr->energy_use = 0;
@@ -616,9 +616,7 @@ static void wreck_the_pattern(void)
        msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
        msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
 
-       if (!IS_INVULN())
-               take_hit(DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
-
+       if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
        to_ruin = randint1(45) + 35;
 
        while (to_ruin--)
index 5f808c4..1ed9778 100644 (file)
@@ -1019,9 +1019,8 @@ extern void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode);
 extern void teleport_away_followable(MONSTER_IDX m_idx);
 extern void teleport_level(MONSTER_IDX m_idx);
 extern DUNGEON_IDX choose_dungeon(cptr note, POSITION y, POSITION x);
-extern bool recall_player(TIME_EFFECT turns);
+extern bool recall_player(player_type *creature_ptr, TIME_EFFECT turns);
 extern bool free_level_recall(player_type *creature_ptr);
-extern bool word_of_recall(void);
 extern bool reset_recall(void);
 extern bool apply_disenchant(BIT_FLAGS mode);
 extern void mutate_player(void);
index f44fcc4..f13ca26 100644 (file)
@@ -1441,7 +1441,7 @@ static bool cast_mirror_spell(int spell)
 
                /* mirror of recall */
        case 17:
-               return word_of_recall();
+               return recall_player(p_ptr, randint0(21) + 15);
                /* multi-shadow */
        case 18:
                set_multishadow(6 + randint1(6), FALSE);
index b9759ac..7fae593 100644 (file)
@@ -2269,7 +2269,7 @@ bool mutation_power_aux(int power)
                        break;
 
                case MUT1_RECALL:
-                       if (!word_of_recall()) return FALSE;
+                       if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
                        break;
 
                case MUT1_BANISH:
index ae869d2..90e67c6 100644 (file)
@@ -1054,7 +1054,7 @@ static bool cmd_racial_power_aux(s32b command)
                }
                case CLASS_BERSERKER:
                {
-                       if (!word_of_recall()) return FALSE;
+                       if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
                        break;
                }
                case CLASS_SMITH:
index 99e5631..4d6e333 100644 (file)
@@ -517,7 +517,7 @@ cptr do_arcane_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               if (!word_of_recall()) return NULL;
+                               if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
                        }
                }
                break;
index 78835b3..6450852 100644 (file)
@@ -320,7 +320,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               if (!word_of_recall()) return NULL;
+                               if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
                        }
                }
                break;
index 7951151..35e276f 100644 (file)
@@ -386,7 +386,7 @@ cptr do_sorcery_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               if (!word_of_recall()) return NULL;
+                               if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
                        }
                }
                break;
index 9081bb3..135c865 100644 (file)
@@ -298,7 +298,7 @@ cptr do_trump_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               if (!word_of_recall()) return NULL;
+                               if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
                        }
                }
                break;
index 14230d2..5708c21 100644 (file)
@@ -823,7 +823,7 @@ DUNGEON_IDX choose_dungeon(cptr note, POSITION y, POSITION x)
  * @param turns 発動までのターン数
  * @return 常にTRUEを返す
  */
-bool recall_player(TIME_EFFECT turns)
+bool recall_player(player_type *creature_ptr, TIME_EFFECT turns)
 {
        /*
         * TODO: Recall the player to the last
@@ -831,13 +831,13 @@ bool recall_player(TIME_EFFECT turns)
         */
 
        /* Ironman option */
-       if (p_ptr->inside_arena || ironman_downward)
+       if (creature_ptr->inside_arena || ironman_downward)
        {
                msg_print(_("何も起こらなかった。", "Nothing happens."));
                return TRUE;
        }
 
-       if (dun_level && (max_dlv[dungeon_type] > dun_level) && !p_ptr->inside_quest && !p_ptr->word_recall)
+       if (dun_level && (max_dlv[dungeon_type] > dun_level) && !creature_ptr->inside_quest && !creature_ptr->word_recall)
        {
                if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? ")))
                {
@@ -847,24 +847,24 @@ bool recall_player(TIME_EFFECT turns)
                }
 
        }
-       if (!p_ptr->word_recall)
+       if (!creature_ptr->word_recall)
        {
                if (!dun_level)
                {
                        DUNGEON_IDX select_dungeon;
                        select_dungeon = choose_dungeon(_("に帰還", "recall"), 2, 14);
                        if (!select_dungeon) return FALSE;
-                       p_ptr->recall_dungeon = select_dungeon;
+                       creature_ptr->recall_dungeon = select_dungeon;
                }
-               p_ptr->word_recall = turns;
+               creature_ptr->word_recall = turns;
                msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged..."));
-               p_ptr->redraw |= (PR_STATUS);
+               creature_ptr->redraw |= (PR_STATUS);
        }
        else
        {
-               p_ptr->word_recall = 0;
+               creature_ptr->word_recall = 0;
                msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
-               p_ptr->redraw |= (PR_STATUS);
+               creature_ptr->redraw |= (PR_STATUS);
        }
        return TRUE;
 }
@@ -908,15 +908,6 @@ bool free_level_recall(player_type *creature_ptr)
 
 
 /*!
- * @brief 帰還用メインルーチン
- * @return 常にTRUEを返す
- */
-bool word_of_recall(void)
-{
-       return(recall_player(randint0(21) + 15));
-}
-
-/*!
  * @brief フロア・リセット処理
  * @return リセット処理が実際に行われたらTRUEを返す
  */