OSDN Git Service

[Refactor] #38997 stair_creation() に player_type * 引数を追加. / Add player_type * argumen...
authordeskull <deskull@users.sourceforge.jp>
Wed, 16 Oct 2019 11:16:12 +0000 (20:16 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 16 Oct 2019 11:20:12 +0000 (20:20 +0900)
src/cmd/cmd-activate.c
src/realm-nature.c
src/spells-floor.c
src/spells-floor.h

index 4db2469..cad8d1b 100644 (file)
@@ -1611,7 +1611,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                        teleport_player(222, 0L);
                        break;
                case 11: case 12:
-                       (void)stair_creation();
+                       (void)stair_creation(user_ptr);
                        break;
                default:
                        if (get_check(_("この階を去りますか?", "Leave this level? ")))
index 7b6216f..db9ede8 100644 (file)
@@ -327,7 +327,7 @@ concptr do_nature_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode
                {
                        if (cast)
                        {
-                               stair_creation();
+                               stair_creation(caster_ptr);
                        }
                }
                break;
index f046c5c..04f0d7e 100644 (file)
@@ -263,8 +263,9 @@ bool place_mirror(void)
  * Create stairs at or move previously created stairs into the player location.
  * @return なし
  */
-void stair_creation(void)
+void stair_creation(player_type *caster_ptr)
 {
+       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
        saved_floor_type *sf_ptr;
        saved_floor_type *dest_sf_ptr;
 
@@ -277,10 +278,10 @@ void stair_creation(void)
        if (ironman_downward) up = FALSE;
 
        /* Forbid down staircases on quest level */
-       if (quest_number(p_ptr->current_floor_ptr->dun_level) || (p_ptr->current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) down = FALSE;
+       if (quest_number(floor_ptr->dun_level) || (floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) down = FALSE;
 
        /* No effect out of standard dungeon floor */
-       if (!p_ptr->current_floor_ptr->dun_level || (!up && !down) ||
+       if (!floor_ptr->dun_level || (!up && !down) ||
                (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) ||
                p_ptr->inside_arena || p_ptr->phase_out)
        {
@@ -331,11 +332,11 @@ void stair_creation(void)
        {
                POSITION x, y;
 
-               for (y = 0; y < p_ptr->current_floor_ptr->height; y++)
+               for (y = 0; y < floor_ptr->height; y++)
                {
-                       for (x = 0; x < p_ptr->current_floor_ptr->width; x++)
+                       for (x = 0; x < floor_ptr->width; x++)
                        {
-                               grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
+                               grid_type *g_ptr = &floor_ptr->grid_array[y][x];
 
                                if (!g_ptr->special) continue;
                                if (feat_uses_special(g_ptr->feat)) continue;
@@ -368,19 +369,19 @@ void stair_creation(void)
        if (up)
        {
                cave_set_feat(p_ptr->y, p_ptr->x,
-                       (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level <= p_ptr->current_floor_ptr->dun_level - 2)) ?
+                       (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level <= floor_ptr->dun_level - 2)) ?
                        feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair);
        }
        else
        {
                cave_set_feat(p_ptr->y, p_ptr->x,
-                       (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level >= p_ptr->current_floor_ptr->dun_level + 2)) ?
+                       (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level >= floor_ptr->dun_level + 2)) ?
                        feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair);
        }
 
 
        /* Connect this stairs to the destination */
-       p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special = dest_floor_id;
+       floor_ptr->grid_array[p_ptr->y][p_ptr->x].special = dest_floor_id;
 }
 
 /*
index 07d3ae6..6c9b8eb 100644 (file)
@@ -5,7 +5,7 @@ extern void wiz_dark(void);
 extern bool warding_glyph(player_type *caster_ptr);
 extern bool explosive_rune(void);
 extern bool place_mirror(void);
-extern void stair_creation(void);
+extern void stair_creation(player_type *caster_ptr);
 extern void map_area(POSITION range);
 extern bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate);
 extern bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx);