OSDN Git Service

[Refactor] #38997 teleport_level() に player_type * 引数を追加. / Add player_type * argumen...
authordeskull <deskull@users.sourceforge.jp>
Sun, 3 Nov 2019 12:50:32 +0000 (21:50 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 3 Nov 2019 12:50:32 +0000 (21:50 +0900)
src/cmd/cmd-activate.c
src/cmd/cmd-read.c
src/mspells4.c
src/realm-arcane.c
src/realm-sorcery.c
src/realm-trump.c
src/spells-status.c
src/spells.h
src/spells3.c
src/wild.c

index 4a029b4..aaf0dda 100644 (file)
@@ -1710,7 +1710,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_TELEPORT_LEVEL:
        {
                if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return FALSE;
-               teleport_level(0);
+               teleport_level(user_ptr, 0);
                break;
        }
 
index ef8cf1b..c7f682e 100644 (file)
@@ -181,7 +181,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known)
 
                case SV_SCROLL_TELEPORT_LEVEL:
                {
-                       (void)teleport_level(0);
+                       (void)teleport_level(creature_ptr, 0);
                        ident = TRUE;
                        break;
                }
index 6f18d46..98ab1e2 100644 (file)
@@ -2324,7 +2324,7 @@ void spell_RF6_TELE_LEVEL(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 
                if (!resist && !saving_throw)
                {
-                       teleport_level(0);
+                       teleport_level(p_ptr, 0);
                }
                learn_spell(MS_TELE_LEVEL);
                update_smart_learn(m_idx, DRS_NEXUS);
@@ -2344,7 +2344,7 @@ void spell_RF6_TELE_LEVEL(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 
                if (!resist && !saving_throw)
                {
-                       teleport_level((t_idx == p_ptr->riding) ? 0 : t_idx);
+                       teleport_level(p_ptr, (t_idx == p_ptr->riding) ? 0 : t_idx);
                }
        }
 }
@@ -4136,4 +4136,4 @@ HIT_POINT monspell_bluemage_damage(int SPELL_NUM, PLAYER_LEVEL plev, int TYPE)
                shoot_base = o_ptr->to_d;
        }
        return monspell_damage_base(SPELL_NUM, hp, plev * 2, FALSE, shoot_dd, shoot_ds, shoot_base, TYPE);
-}
\ No newline at end of file
+}
index 46c5edd..5850ba4 100644 (file)
@@ -446,7 +446,7 @@ concptr do_arcane_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode
                        if (cast)
                        {
                                if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return NULL;
-                               teleport_level(0);
+                               teleport_level(caster_ptr, 0);
                        }
                }
                break;
index 2e0cd00..1428e13 100644 (file)
@@ -377,7 +377,7 @@ concptr do_sorcery_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mod
                        if (cast)
                        {
                                if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return NULL;
-                               teleport_level(0);
+                               teleport_level(caster_ptr, 0);
                        }
                }
                break;
index 0525a60..0289376 100644 (file)
@@ -272,7 +272,7 @@ concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
                        if (cast)
                        {
                                if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return NULL;
-                               teleport_level(0);
+                               teleport_level(caster_ptr, 0);
                        }
                }
                break;
index e5fa97d..93dadba 100644 (file)
@@ -505,7 +505,7 @@ void apply_nexus(monster_type *m_ptr)
                        msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
                        break;
                }
-               teleport_level(0);
+               teleport_level(p_ptr, 0);
                break;
        }
 
index d16f2ec..8e5fe1e 100644 (file)
@@ -290,7 +290,7 @@ extern void teleport_player_away(MONSTER_IDX m_idx, POSITION dis);
 extern void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode);
 extern void teleport_away_followable(MONSTER_IDX m_idx);
 extern bool teleport_level_other(player_type *creature_ptr);
-extern void teleport_level(MONSTER_IDX m_idx);
+extern void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx);
 extern bool recall_player(player_type *creature_ptr, TIME_EFFECT turns);
 extern bool free_level_recall(player_type *creature_ptr);
 extern bool reset_recall(void);
index 1a885f8..77bdc8c 100644 (file)
@@ -607,7 +607,7 @@ bool teleport_level_other(player_type *creature_ptr)
        {
                msg_format(_("しかし効果がなかった!", "%^s is unaffected!"), m_name);
        }
-       else teleport_level(target_m_idx);
+       else teleport_level(creature_ptr, target_m_idx);
        return TRUE;
 }
 
@@ -617,11 +617,11 @@ bool teleport_level_other(player_type *creature_ptr)
  * @param m_idx テレポートの対象となるモンスターID(0ならばプレイヤー) / If m_idx <= 0, target is player.
  * @return なし
  */
-void teleport_level(MONSTER_IDX m_idx)
+void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx)
 {
-       bool         go_up;
+       bool go_up;
        GAME_TEXT m_name[160];
-       bool         see_m = TRUE;
+       bool see_m = TRUE;
 
        if (m_idx <= 0) /* To player */
        {
@@ -629,7 +629,7 @@ void teleport_level(MONSTER_IDX m_idx)
        }
        else /* To monster */
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+               monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
 
                /* Get the monster name (or "it") */
                monster_desc(m_name, m_ptr, 0);
@@ -644,7 +644,7 @@ void teleport_level(MONSTER_IDX m_idx)
                return;
        }
 
-       if ((m_idx <= 0) && p_ptr->anti_tele) /* To player */
+       if ((m_idx <= 0) && creature_ptr->anti_tele) /* To player */
        {
                msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
                return;
@@ -661,7 +661,7 @@ void teleport_level(MONSTER_IDX m_idx)
        }
 
        /* Down only */ 
-       if ((ironman_downward && (m_idx <= 0)) || (p_ptr->current_floor_ptr->dun_level <= d_info[p_ptr->dungeon_idx].mindepth))
+       if ((ironman_downward && (m_idx <= 0)) || (creature_ptr->current_floor_ptr->dun_level <= d_info[creature_ptr->dungeon_idx].mindepth))
        {
 #ifdef JP
                if (see_m) msg_format("%^sは床を突き破って沈んでいく。", m_name);
@@ -670,32 +670,32 @@ void teleport_level(MONSTER_IDX m_idx)
 #endif
                if (m_idx <= 0) /* To player */
                {
-                       if (!p_ptr->current_floor_ptr->dun_level)
+                       if (!creature_ptr->current_floor_ptr->dun_level)
                        {
-                               p_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon;
-                               p_ptr->oldpy = p_ptr->y;
-                               p_ptr->oldpx = p_ptr->x;
+                               creature_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : creature_ptr->recall_dungeon;
+                               creature_ptr->oldpy = creature_ptr->y;
+                               creature_ptr->oldpx = creature_ptr->x;
                        }
 
-                       if (record_stair) exe_write_diary(p_ptr, NIKKI_TELE_LEV, 1, NULL);
+                       if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, 1, NULL);
 
                        if (autosave_l) do_cmd_save_game(TRUE);
 
-                       if (!p_ptr->current_floor_ptr->dun_level)
+                       if (!creature_ptr->current_floor_ptr->dun_level)
                        {
-                               p_ptr->current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].mindepth;
+                               creature_ptr->current_floor_ptr->dun_level = d_info[creature_ptr->dungeon_idx].mindepth;
                                prepare_change_floor_mode(CFM_RAND_PLACE);
                        }
                        else
                        {
                                prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
                        }
-                       p_ptr->leaving = TRUE;
+                       creature_ptr->leaving = TRUE;
                }
        }
 
        /* Up only */
-       else if (quest_number(p_ptr->current_floor_ptr->dun_level) || (p_ptr->current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth))
+       else if (quest_number(creature_ptr->current_floor_ptr->dun_level) || (creature_ptr->current_floor_ptr->dun_level >= d_info[creature_ptr->dungeon_idx].maxdepth))
        {
 #ifdef JP
                if (see_m) msg_format("%^sは天井を突き破って宙へ浮いていく。", m_name);
@@ -706,15 +706,15 @@ void teleport_level(MONSTER_IDX m_idx)
 
                if (m_idx <= 0) /* To player */
                {
-                       if (record_stair) exe_write_diary(p_ptr, NIKKI_TELE_LEV, -1, NULL);
+                       if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, -1, NULL);
 
                        if (autosave_l) do_cmd_save_game(TRUE);
 
                        prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
 
                        leave_quest_check();
-                       p_ptr->inside_quest = 0;
-                       p_ptr->leaving = TRUE;
+                       creature_ptr->inside_quest = 0;
+                       creature_ptr->leaving = TRUE;
                }
        }
        else if (go_up)
@@ -728,12 +728,12 @@ void teleport_level(MONSTER_IDX m_idx)
 
                if (m_idx <= 0) /* To player */
                {
-                       if (record_stair) exe_write_diary(p_ptr, NIKKI_TELE_LEV, -1, NULL);
+                       if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, -1, NULL);
 
                        if (autosave_l) do_cmd_save_game(TRUE);
 
                        prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
-                       p_ptr->leaving = TRUE;
+                       creature_ptr->leaving = TRUE;
                }
        }
        else
@@ -747,19 +747,19 @@ void teleport_level(MONSTER_IDX m_idx)
                if (m_idx <= 0) /* To player */
                {
                        /* Never reach this code on the surface */
-                       /* if (!p_ptr->current_floor_ptr->dun_level) p_ptr->dungeon_idx = p_ptr->recall_dungeon; */
-                       if (record_stair) exe_write_diary(p_ptr, NIKKI_TELE_LEV, 1, NULL);
+                       /* if (!creature_ptr->current_floor_ptr->dun_level) creature_ptr->dungeon_idx = creature_ptr->recall_dungeon; */
+                       if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, 1, NULL);
                        if (autosave_l) do_cmd_save_game(TRUE);
 
                        prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
-                       p_ptr->leaving = TRUE;
+                       creature_ptr->leaving = TRUE;
                }
        }
 
        /* Monster level teleportation is simple deleting now */
        if (m_idx > 0)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+               monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
 
                check_quest_completion(m_ptr);
 
@@ -768,7 +768,7 @@ void teleport_level(MONSTER_IDX m_idx)
                        char m2_name[MAX_NLEN];
 
                        monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
-                       exe_write_diary(p_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_TELE_LEVEL, m2_name);
+                       exe_write_diary(creature_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_TELE_LEVEL, m2_name);
                }
 
                delete_monster_idx(m_idx);
index c842e33..9bbf105 100644 (file)
@@ -702,7 +702,6 @@ void wilderness_gen(floor_type *floor_ptr)
        }
 }
 
-
 static s16b conv_terrain2feat[MAX_WILDERNESS];
 
 /*!