OSDN Git Service

[Refactor] #38997 summon_cyber() にplayer_type * 引数を追加 / Added player_type * argument...
authorHourier <hourier@users.sourceforge.jp>
Mon, 13 Jan 2020 10:31:35 +0000 (19:31 +0900)
committerHourier <hourier@users.sourceforge.jp>
Mon, 13 Jan 2020 10:31:35 +0000 (19:31 +0900)
src/mspells4.c
src/spells-summon.c
src/spells-summon.h
src/spells2.c

index 62f8692..fee1dd6 100644 (file)
@@ -2976,7 +2976,7 @@ void spell_RF6_S_CYBER(player_type *target_ptr, POSITION y, POSITION x, MONSTER_
        }
        else
        {
-               count += summon_cyber(m_idx, y, x);
+               count += summon_cyber(floor_ptr, m_idx, y, x);
        }
 
        if (target_ptr->blind && count && mon_to_player)
index a110451..e75d52f 100644 (file)
@@ -250,17 +250,17 @@ bool summon_kin_player(DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode)
  * @param x 召喚位置X座標
  * @return 作用が実際にあった場合TRUEを返す
  */
-int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
+int summon_cyber(floor_type *floor_ptr, MONSTER_IDX who, POSITION y, POSITION x)
 {
        int i;
-       int max_cyber = (easy_band ? 1 : (p_ptr->current_floor_ptr->dun_level / 50) + randint1(2));
+       int max_cyber = (easy_band ? 1 : (floor_ptr->dun_level / 50) + randint1(2));
        int count = 0;
        BIT_FLAGS mode = PM_ALLOW_GROUP;
 
        /* Summoned by a monster */
        if (who > 0)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[who];
+               monster_type *m_ptr = &floor_ptr->m_list[who];
                if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
        }
 
index 8873a2e..235f949 100644 (file)
@@ -65,7 +65,6 @@ extern bool cast_summon_octopus(player_type *creature_ptr);
 extern bool item_tester_offer(object_type *o_ptr);
 extern bool cast_summon_greater_demon(player_type *caster_ptr);
 extern bool summon_kin_player(DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode);
-extern int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x);
+extern int summon_cyber(floor_type *floor_ptr, MONSTER_IDX who, POSITION y, POSITION x);
 
 extern void mitokohmon(player_type *kohmon_ptr);
-
index 6019e60..dc9cdb8 100644 (file)
@@ -2598,6 +2598,7 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
 {
        BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
        bool is_first_curse = TRUE;
+       floor_type *floor_ptr = target_ptr->current_floor_ptr;
        while (is_first_curse || one_in_(3) && !stop_ty)
        {
                is_first_curse = FALSE;
@@ -2644,7 +2645,7 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
                        (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
                        if (!one_in_(6)) break;
                case 7: case 8: case 9: case 18:
-                       (*count) += summon_specific(0, target_ptr->y, target_ptr->x, target_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+                       (*count) += summon_specific(0, target_ptr->y, target_ptr->x, floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                        if (!one_in_(6)) break;
                case 10: case 11: case 12:
                        msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
@@ -2674,9 +2675,9 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
                        lose_all_info(target_ptr);
                        if (!one_in_(6)) break;
                case 25:
-                       if ((target_ptr->current_floor_ptr->dun_level > 65) && !stop_ty)
+                       if ((floor_ptr->dun_level > 65) && !stop_ty)
                        {
-                               (*count) += summon_cyber(-1, target_ptr->y, target_ptr->x);
+                               (*count) += summon_cyber(floor_ptr, -1, target_ptr->y, target_ptr->x);
                                stop_ty = TRUE;
                                break;
                        }
@@ -3263,6 +3264,7 @@ void wild_magic(player_type *caster_ptr, int spell)
        if (type < SUMMON_MOLD) type = SUMMON_MOLD;
        else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
 
+       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
        switch (randint1(spell) + randint1(8) + 1)
        {
        case 1:
@@ -3334,7 +3336,7 @@ void wild_magic(player_type *caster_ptr, int spell)
        case 35:
                for (int counter = 0; counter < 8; counter++)
                {
-                       (void)summon_specific(0, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
+                       (void)summon_specific(0, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
                }
 
                break;
@@ -3343,7 +3345,7 @@ void wild_magic(player_type *caster_ptr, int spell)
                activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
                break;
        case 38:
-               (void)summon_cyber(-1, caster_ptr->y, caster_ptr->x);
+               (void)summon_cyber(floor_ptr, -1, caster_ptr->y, caster_ptr->x);
                break;
        default:
        {