OSDN Git Service

[Refactor] #38997 build_streamer() に floor_type * 引数を追加. / Add floor_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Fri, 6 Dec 2019 10:26:54 +0000 (19:26 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 6 Dec 2019 10:26:54 +0000 (19:26 +0900)
src/cmd/cmd-basic.c
src/floor-generate.c
src/floor-streams.c
src/floor-streams.h

index baa2e78..6ad13a2 100644 (file)
@@ -2865,7 +2865,6 @@ void do_cmd_suicide(player_type *creature_ptr)
                if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) return;
        }
 
-
        if (!creature_ptr->noscore)
        {
                /* Special Verification for suicide */
index 3601e25..338ffae 100644 (file)
@@ -886,7 +886,7 @@ static bool cave_gen(floor_type *floor_ptr)
                        /* Hack -- Add some quartz streamers */
                        for (i = 0; i < DUN_STR_QUA; i++)
                        {
-                               build_streamer(dungeon_ptr->stream2, DUN_STR_QC);
+                               build_streamer(floor_ptr, dungeon_ptr->stream2, DUN_STR_QC);
                        }
                }
 
@@ -895,7 +895,7 @@ static bool cave_gen(floor_type *floor_ptr)
                        /* Hack -- Add some magma streamers */
                        for (i = 0; i < DUN_STR_MAG; i++)
                        {
-                               build_streamer(dungeon_ptr->stream1, DUN_STR_MC);
+                               build_streamer(floor_ptr, dungeon_ptr->stream1, DUN_STR_MC);
                        }
                }
        }
index 4516bd3..73404e1 100644 (file)
@@ -144,7 +144,7 @@ static void recursive_river(floor_type *floor_ptr, POSITION x1, POSITION y1, POS
                                                /* Lava terrain glows */
                                                if (have_flag(f_info[feat1].flags, FF_LAVA))
                                                {
-                                                       if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) g_ptr->info |= CAVE_GLOW;
+                                                       if (!(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) g_ptr->info |= CAVE_GLOW;
                                                }
 
                                                /* Hack -- don't teleport here */
@@ -237,7 +237,7 @@ void add_river(floor_type *floor_ptr, FEAT_IDX feat1, FEAT_IDX feat2)
  * hidden gold types are currently unused.
  * </pre>
  */
-void build_streamer(FEAT_IDX feat, int chance)
+void build_streamer(floor_type *floor_ptr, FEAT_IDX feat, int chance)
 {
        int i;
        POSITION y, x, tx, ty;
@@ -252,8 +252,8 @@ void build_streamer(FEAT_IDX feat, int chance)
        bool streamer_may_have_gold = have_flag(streamer_ptr->flags, FF_MAY_HAVE_GOLD);
 
        /* Hack -- Choose starting point */
-       y = rand_spread(p_ptr->current_floor_ptr->height / 2, p_ptr->current_floor_ptr->height / 6);
-       x = rand_spread(p_ptr->current_floor_ptr->width / 2, p_ptr->current_floor_ptr->width / 6);
+       y = rand_spread(floor_ptr->height / 2, floor_ptr->height / 6);
+       x = rand_spread(floor_ptr->width / 2, floor_ptr->width / 6);
 
        /* Choose a random compass direction */
        dir = randint0(8);
@@ -273,10 +273,10 @@ void build_streamer(FEAT_IDX feat, int chance)
                        {
                                ty = rand_spread(y, d);
                                tx = rand_spread(x, d);
-                               if (!in_bounds2(p_ptr->current_floor_ptr, ty, tx)) continue;
+                               if (!in_bounds2(floor_ptr, ty, tx)) continue;
                                break;
                        }
-                       g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx];
+                       g_ptr = &floor_ptr->grid_array[ty][tx];
                        f_ptr = &f_info[g_ptr->feat];
 
                        if (have_flag(f_ptr->flags, FF_MOVE) && (have_flag(f_ptr->flags, FF_WATER) || have_flag(f_ptr->flags, FF_LAVA)))
@@ -292,7 +292,7 @@ void build_streamer(FEAT_IDX feat, int chance)
                                if (is_closed_door(g_ptr->feat)) continue;
                        }
 
-                       if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[p_ptr->current_floor_ptr->m_list[g_ptr->m_idx].r_idx], 0)))
+                       if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[floor_ptr->m_list[g_ptr->m_idx].r_idx], 0)))
                        {
                                /* Delete the monster (if any) */
                                delete_monster(ty, tx);
@@ -305,7 +305,7 @@ void build_streamer(FEAT_IDX feat, int chance)
                                /* Scan all objects in the grid */
                                for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
                                {
-                                       object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
+                                       object_type *o_ptr = &floor_ptr->o_list[this_o_idx];
                                        next_o_idx = o_ptr->next_o_idx;
 
                                        /* Hack -- Preserve unknown artifacts */
@@ -372,7 +372,7 @@ void build_streamer(FEAT_IDX feat, int chance)
                }
 
                /* Quit before leaving the dungeon */
-               if (!in_bounds(p_ptr->current_floor_ptr, y, x)) break;
+               if (!in_bounds(floor_ptr, y, x)) break;
        }
 }
 
index 6424fd6..fbe6dd8 100644 (file)
@@ -15,6 +15,6 @@
 /* Externs */
 
 extern void add_river(floor_type *floor_ptr, FEAT_IDX feat1, FEAT_IDX feat2);
-extern void build_streamer(FEAT_IDX feat, int chance);
+extern void build_streamer(floor_type *floor_ptr, FEAT_IDX feat, int chance);
 extern void place_trees(floor_type *floor_ptr, POSITION x, POSITION y);
 extern void destroy_level(void);