OSDN Git Service

[Refactor] #38997 'while (1)' を 'while (TRUE)' に変更 / Changed 'while (1)' to 'while...
[hengband/hengband.git] / src / floor-streams.c
index 3d386b2..597cc22 100644 (file)
@@ -226,6 +226,7 @@ void add_river(floor_type *floor_ptr, FEAT_IDX feat1, FEAT_IDX feat2)
 /*!
  * @brief ダンジョンの壁部にストリーマー(地質の変化)を与える /
  * Places "streamers" of rock through dungeon
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @param feat ストリーマー地形ID
  * @param chance 生成密度
  * @return なし
@@ -237,7 +238,7 @@ void add_river(floor_type *floor_ptr, FEAT_IDX feat1, FEAT_IDX feat2)
  * hidden gold types are currently unused.
  * </pre>
  */
-void build_streamer(floor_type *floor_ptr, FEAT_IDX feat, int chance)
+void build_streamer(player_type *player_ptr, FEAT_IDX feat, int chance)
 {
        int i;
        POSITION y, x, tx, ty;
@@ -252,6 +253,7 @@ void build_streamer(floor_type *floor_ptr, FEAT_IDX feat, int chance)
        bool streamer_may_have_gold = have_flag(streamer_ptr->flags, FF_MAY_HAVE_GOLD);
 
        /* Hack -- Choose starting point */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        y = rand_spread(floor_ptr->height / 2, floor_ptr->height / 6);
        x = rand_spread(floor_ptr->width / 2, floor_ptr->width / 6);
 
@@ -269,7 +271,7 @@ void build_streamer(floor_type *floor_ptr, FEAT_IDX feat, int chance)
                        int d = DUN_STR_RNG;
 
                        /* Pick a nearby grid */
-                       while (1)
+                       while (TRUE)
                        {
                                ty = rand_spread(y, d);
                                tx = rand_spread(x, d);
@@ -329,7 +331,7 @@ void build_streamer(floor_type *floor_ptr, FEAT_IDX feat, int chance)
                                        }
                                }
 
-                               delete_object(ty, tx);
+                               delete_object(floor_ptr, ty, tx);
                        }
 
                        /* Clear previous contents, add proper vein type */
@@ -343,14 +345,14 @@ void build_streamer(floor_type *floor_ptr, FEAT_IDX feat, int chance)
                                /* Hack -- Add some known treasure */
                                if (one_in_(chance))
                                {
-                                       cave_alter_feat(ty, tx, FF_MAY_HAVE_GOLD);
+                                       cave_alter_feat(player_ptr, ty, tx, FF_MAY_HAVE_GOLD);
                                }
 
                                /* Hack -- Add some hidden treasure */
                                else if (one_in_(chance / 4))
                                {
-                                       cave_alter_feat(ty, tx, FF_MAY_HAVE_GOLD);
-                                       cave_alter_feat(ty, tx, FF_ENSECRET);
+                                       cave_alter_feat(player_ptr, ty, tx, FF_MAY_HAVE_GOLD);
+                                       cave_alter_feat(player_ptr, ty, tx, FF_ENSECRET);
                                }
                        }
                }
@@ -445,21 +447,19 @@ void place_trees(floor_type *floor_ptr, POSITION x, POSITION y)
  * Build a destroyed level
  * @return なし
  */
-void destroy_level(floor_type *floor_ptr)
+void destroy_level(player_type *player_ptr)
 {
-       POSITION y1, x1;
-       int n;
-
-       /* Note destroyed levels */
        msg_print_wizard(CHEAT_DUNGEON, _("階に*破壊*の痕跡を生成しました。", "Destroyed Level."));
 
        /* Drop a few epi-centers (usually about two) */
-       for (n = 0; n < randint1(5); n++)
+       POSITION y1, x1;
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
+       for (int n = 0; n < randint1(5); n++)
        {
                /* Pick an epi-center */
                x1 = rand_range(5, floor_ptr->width - 1 - 5);
                y1 = rand_range(5, floor_ptr->height - 1 - 5);
 
-               (void)destroy_area(floor_ptr, y1, x1, 15, TRUE);
+               (void)destroy_area(player_ptr, y1, x1, 15, TRUE);
        }
 }