OSDN Git Service

#37353 SINGING_COUNTを定義。 / Define SINGING_COUNT.
[hengband/hengband.git] / src / streams.c
index cd89389..e9d0127 100644 (file)
@@ -1,16 +1,18 @@
-/*
- * File: streams.c
- * Purpose: Used by dungeon generation. This file holds all the
- * functions that are applied to a level after the rest has been
- * generated, ie streams and level destruction.
- */
-
-/*
+/*!
+ * @file streams.c
+ * @brief ダンジョン生成に利用する関数群 / Used by dungeon generation.
+ * @date 2014/07/15
+ * @author
+ * <pre>
  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
- *
  * This software may be copied and distributed for educational, research,
  * and not for profit purposes provided that this copyright and statement
  * are included in all such copies.  Other copyrights may also apply.
+ * </pre>
+ * @details
+ * Purpose:  This file holds all the
+ * functions that are applied to a level after the rest has been
+ * generated, ie streams and level destruction.
  */
 
 #include "angband.h"
 #include "grid.h"
 
 
-/*
+/*!
+ * @brief 再帰フラクタルアルゴリズムによりダンジョン内に川を配置する /
  * Recursive fractal algorithm to place water through the dungeon.
+ * @param x1 起点x座標
+ * @param y1 起点y座標
+ * @param x2 終点x座標
+ * @param y2 終点y座標
+ * @param feat1 中央部地形ID
+ * @param feat2 境界部地形ID
+ * @param width 基本幅
+ * @return なし
  */
-static void recursive_river(int x1, int y1, int x2, int y2, int feat1, int feat2, int width)
+static void recursive_river(int x1, int y1, int x2, int y2, IDX feat1, IDX feat2, int width)
 {
        int dx, dy, length, l, x, y;
        int changex, changey;
@@ -137,14 +148,18 @@ static void recursive_river(int x1, int y1, int x2, int y2, int feat1, int feat2
 }
 
 
-/*
+/*!
+ * @brief ランダムに川/溶岩流をダンジョンに配置する /
  * Places water /lava through dungeon.
+ * @param feat1 中央部地形ID
+ * @param feat2 境界部地形ID
+ * @return なし
  */
-void add_river(int feat1, int feat2)
+void add_river(IDX feat1, IDX feat2)
 {
-       int y2, x2;
-       int y1 = 0, x1 = 0;
-       int wid;
+       POSITION y2, x2;
+       POSITION y1 = 0, x1 = 0;
+       POSITION wid;
 
 
        /* Hack -- Choose starting point */
@@ -197,15 +212,21 @@ void add_river(int feat1, int feat2)
 }
 
 
-/*
+/*!
+ * @brief ダンジョンの壁部にストリーマー(地質の変化)を与える /
  * Places "streamers" of rock through dungeon
- *
+ * @param feat ストリーマー地形ID
+ * @param chance 生成密度
+ * @return なし
+ * @details
+ * <pre>
  * Note that their are actually six different terrain features used
  * to represent streamers.  Three each of magma and quartz, one for
  * basic vein, one with hidden gold, and one with known gold.  The
  * hidden gold types are currently unused.
+ * </pre>
  */
-void build_streamer(int feat, int chance)
+void build_streamer(IDX feat, int chance)
 {
        int             i, tx, ty;
        int             y, x, dir;
@@ -223,7 +244,7 @@ void build_streamer(int feat, int chance)
        x = rand_spread(cur_wid / 2, cur_wid / 6);
 
        /* Choose a random compass direction */
-       dir = ddd[randint0(8)];
+       dir = randint0(8);
 
        /* Place streamer into dungeon */
        while (dummy < SAFE_MAX_ATTEMPTS)
@@ -252,7 +273,7 @@ void build_streamer(int feat, int chance)
                                continue;
 
                        /* Do not convert permanent features */
-                       if (cave_perma_grid(c_ptr)) continue;
+                       if (have_flag(f_ptr->flags, FF_PERMANENT)) continue;
 
                        /* Only convert "granite" walls */
                        if (streamer_is_wall)
@@ -261,6 +282,56 @@ void build_streamer(int feat, int chance)
                                if (is_closed_door(c_ptr->feat)) continue;
                        }
 
+                       if (c_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[m_list[c_ptr->m_idx].r_idx], 0)))
+                       {
+                               /* Delete the monster (if any) */
+                               delete_monster(ty, tx);
+                       }
+
+                       if (c_ptr->o_idx && !have_flag(streamer_ptr->flags, FF_DROP))
+                       {
+                               s16b this_o_idx, next_o_idx = 0;
+
+                               /* Scan all objects in the grid */
+                               for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
+                               {
+                                       /* Acquire object */
+                                       object_type *o_ptr = &o_list[this_o_idx];
+
+                                       /* Acquire next object */
+                                       next_o_idx = o_ptr->next_o_idx;
+
+                                       /* Hack -- Preserve unknown artifacts */
+                                       if (object_is_fixed_artifact(o_ptr))
+                                       {
+                                               /* Mega-Hack -- Preserve the artifact */
+                                               a_info[o_ptr->name1].cur_num = 0;
+
+                                               if (cheat_peek)
+                                               {
+                                                       char o_name[MAX_NLEN];
+                                                       object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
+#ifdef JP
+                                                       msg_format("伝説のアイテム (%s) はストリーマーにより削除された。", o_name);
+#else
+                                                       msg_format("Artifact (%s) was deleted by streamer.", o_name);
+#endif
+                                               }
+                                       }
+                                       else if (cheat_peek && o_ptr->art_name)
+                                       {
+#ifdef JP
+                                               msg_print("ランダム・アーティファクトの1つはストリーマーにより削除された。");
+#else
+                                               msg_print("One of the random artifacts was deleted by streamer.");
+#endif
+                                       }
+                               }
+
+                               /* Delete objects */
+                               delete_object(ty, tx);
+                       }
+
                        /* Clear previous contents, add proper vein type */
                        c_ptr->feat = feat;
 
@@ -286,22 +357,19 @@ void build_streamer(int feat, int chance)
 
                if (dummy >= SAFE_MAX_ATTEMPTS)
                {
-                       if (cheat_room)
-                       {
-#ifdef JP
-msg_print("·Ù¹ð¡ª¥¹¥È¥ê¡¼¥Þ¡¼¤òÇÛÃ֤Ǥ­¤Þ¤»¤ó¡ª");
-#else
-                               msg_print("Warning! Could not place streamer!");
-#endif
-
-                       }
+                       msg_print_wizard(CHEAT_DUNGEON, _("地形のストリーマー処理に失敗しました。", "Failed to place streamer."));
                        return;
                }
 
-
                /* Advance the streamer */
-               y += ddy[dir];
-               x += ddx[dir];
+               y += ddy[cdd[dir]];
+               x += ddx[cdd[dir]];
+
+               if(one_in_(10))
+               {
+                       if(one_in_(2)) dir = (dir + 1) % 8;
+                       else dir = (dir > 0) ? dir - 1 : 7; 
+               }
 
                /* Quit before leaving the dungeon */
                if (!in_bounds(y, x)) break;
@@ -309,11 +377,19 @@ msg_print("
 }
 
 
-/*
+/*!
+ * @brief ダンジョンの指定位置近辺に森林を配置する /
+ * Places "streamers" of rock through dungeon
+ * @param x 指定X座標
+ * @param y 指定Y座標
+ * @return なし
+ * @details
+ * <pre>
  * Put trees near a hole in the dungeon roof  (rubble on ground + up stairway)
  * This happens in real world lava tubes.
+ * </pre>
  */
-void place_trees(int x, int y)
+void place_trees(POSITION x, POSITION y)
 {
        int i, j;
        cave_type *c_ptr;
@@ -339,11 +415,11 @@ void place_trees(int x, int y)
                                if ((distance(j, i, y, x) > 1) || (randint1(100) < 25))
                                {
                                        if (randint1(100) < 75)
-                                               cave[j][i].feat = FEAT_TREES;
+                                               cave[j][i].feat = feat_tree;
                                }
                                else
                                {
-                                       cave[j][i].feat = FEAT_RUBBLE;
+                                       cave[j][i].feat = feat_rubble;
                                }
 
                                /* Clear garbage of hidden trap or door */
@@ -359,24 +435,22 @@ void place_trees(int x, int y)
        if (!ironman_downward && one_in_(3))
        {
                /* up stair */
-               cave[y][x].feat = FEAT_LESS;
+               cave[y][x].feat = feat_up_stair;
        }
 }
 
 
-/*
+/*!
+ * @brief ダンジョンに*破壊*済み地形ランダムに施す /
  * Build a destroyed level
+ * @return なし
  */
 void destroy_level(void)
 {
        int y1, x1, n;
 
        /* Note destroyed levels */
-#ifdef JP
-       if (cheat_room) msg_print("Ç˲õ¤µ¤ì¤¿³¬");
-#else
-       if (cheat_room) msg_print("Destroyed Level");
-#endif
+       msg_print_wizard(CHEAT_DUNGEON, _("階に*破壊*の痕跡を生成しました。", "Destroyed Level."));
 
        /* Drop a few epi-centers (usually about two) */
        for (n = 0; n < randint1(5); n++)