OSDN Git Service

[Refactor] #38997 place_extra_grid() を削除し、place_grid() に統合 / Removed place_extra_grid...
[hengband/hengband.git] / src / grid.c
index 3028076..2b69681 100644 (file)
@@ -1,21 +1,19 @@
-
- /*!
-  * @file grid.c
-  * @brief グリッドの実装 / low level dungeon routines -BEN-
-  * @date 2013/12/30
-  * @author
-  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
-  *\n
-  * This software may be copied and distributed for educational, research,\n
-  * and not for profit purposes provided that this copyright and statement\n
-  * are included in all such copies.  Other copyrights may also apply.\n
-  * \n
-  * Support for Adam Bolt's tileset, lighting and transparency effects\n
-  * by Robert Ruehlmann (rr9@angband.org)\n
-  * \n
-  * 2013 Deskull Doxygen向けのコメント整理\n
-  */
-
+/*!
+ * @file grid.c
+ * @brief グリッドの実装 / low level dungeon routines -BEN-
+ * @date 2013/12/30
+ * @author
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
+ *\n
+ * This software may be copied and distributed for educational, research,\n
+ * and not for profit purposes provided that this copyright and statement\n
+ * are included in all such copies.  Other copyrights may also apply.\n
+ * \n
+ * Support for Adam Bolt's tileset, lighting and transparency effects\n
+ * by Robert Ruehlmann (rr9@angband.org)\n
+ * \n
+ * 2013 Deskull Doxygen向けのコメント整理\n
+ */
 
 #include "angband.h"
 #include "util.h"
@@ -1210,24 +1208,6 @@ bool player_can_enter(player_type *creature_ptr, FEAT_IDX feature, BIT_FLAGS16 m
 }
 
 
-void place_floor_grid(grid_type *g_ptr)
-{
-       g_ptr->feat = feat_ground_type[randint0(100)];
-       g_ptr->info &= ~(CAVE_MASK);
-       g_ptr->info |= CAVE_FLOOR;
-       if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx);
-}
-
-
-void place_extra_grid(grid_type *g_ptr)
-{
-       g_ptr->feat = feat_wall_type[randint0(100)];
-       g_ptr->info &= ~(CAVE_MASK);
-       g_ptr->info |= CAVE_EXTRA;
-       if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx);
-}
-
-
 void place_inner_grid(grid_type *g_ptr)
 {
        g_ptr->feat = feat_wall_inner;
@@ -1274,8 +1254,70 @@ void place_solid_perm_grid(grid_type *g_ptr)
        if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx);
 }
 
+
+void place_grid(grid_type *g_ptr, place_grid_type pg_type)
+{
+       switch (pg_type)
+       {
+       case floor:
+       {
+               g_ptr->feat = feat_ground_type[randint0(100)];
+               g_ptr->info |= CAVE_FLOOR;
+               break;
+       }
+       case extra:
+       {
+               g_ptr->feat = feat_wall_type[randint0(100)];
+               g_ptr->info |= CAVE_EXTRA;
+               break;
+       }
+       case innner:
+       {
+               g_ptr->feat = feat_wall_inner;
+               g_ptr->info |= CAVE_INNER;
+               break;
+       }
+       case outer:
+       {
+               g_ptr->feat = feat_permanent;
+               g_ptr->info |= CAVE_INNER;
+               break;
+       }
+       case outer_noperm:
+       {
+               feature_type *f_ptr = &f_info[feat_wall_outer];
+               if (permanent_wall(f_ptr))
+               {
+                       g_ptr->feat = (s16b)feat_state(feat_wall_outer, FF_UNPERM);
+               }
+               else
+               {
+                       g_ptr->feat = feat_wall_outer;
+               }
+
+               g_ptr->info |= (CAVE_OUTER | CAVE_VAULT);
+               break;
+       }
+       case solid_perm:
+       {
+               g_ptr->feat = feat_permanent;
+               g_ptr->info |= CAVE_SOLID;
+               break;
+       }
+       default:
+               return;
+       }
+
+       g_ptr->info &= ~(CAVE_MASK);
+       if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx);
+}
+
+
 /*!
  * モンスターにより照明が消されている地形か否かを判定する。 / Is this grid "darkened" by monster?
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @param g_ptr グリッドへの参照ポインタ
+ * @return 照明が消されている地形ならばTRUE
  */
 bool darkened_grid(player_type *player_ptr, grid_type *g_ptr)
 {