OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / grid.c
index 3f77f0c..81aadab 100644 (file)
@@ -64,7 +64,6 @@ bool new_player_spot(void)
                /* Refuse to start on anti-teleport grids */
                if (c_ptr->info & (CAVE_ICKY)) continue;
 
-               /* Done */
                break;
        }
 
@@ -97,36 +96,28 @@ void place_random_stairs(POSITION y, POSITION x)
        if (!is_floor_grid(c_ptr) || c_ptr->o_idx) return;
 
        /* Town */
-       if (!dun_level)
-               up_stairs = FALSE;
+       if (!dun_level) up_stairs = FALSE;
 
        /* Ironman */
-       if (ironman_downward)
-               up_stairs = FALSE;
+       if (ironman_downward) up_stairs = FALSE;
 
        /* Bottom */
-       if (dun_level >= d_info[dungeon_type].maxdepth)
-               down_stairs = FALSE;
+       if (dun_level >= d_info[dungeon_type].maxdepth) down_stairs = FALSE;
 
        /* Quest-level */
-       if (quest_number(dun_level) && (dun_level > 1))
-               down_stairs = FALSE;
+       if (quest_number(dun_level) && (dun_level > 1)) down_stairs = FALSE;
 
        /* We can't place both */
        if (down_stairs && up_stairs)
        {
                /* Choose a staircase randomly */
-               if (randint0(100) < 50)
-                       up_stairs = FALSE;
-               else
-                       down_stairs = FALSE;
+               if (randint0(100) < 50) up_stairs = FALSE;
+               else down_stairs = FALSE;
        }
 
        /* Place the stairs */
-       if (up_stairs)
-               place_up_stairs(y, x);
-       else if (down_stairs)
-               place_down_stairs(y, x);
+       if (up_stairs) place_up_stairs(y, x);
+       else if (down_stairs) place_down_stairs(y, x);
 }
 
 /*!
@@ -139,7 +130,7 @@ void place_random_stairs(POSITION y, POSITION x)
 void place_random_door(POSITION y, POSITION x, bool room)
 {
        int tmp, type;
-       s16b feat = feat_none;
+       FEAT_IDX feat = feat_none;
        cave_type *c_ptr = &cave[y][x];
 
        /* Initialize mimic info */
@@ -223,7 +214,7 @@ void place_random_door(POSITION y, POSITION x, bool room)
 void place_closed_door(POSITION y, POSITION x, int type)
 {
        int tmp;
-       s16b feat = feat_none;
+       FEAT_IDX feat = feat_none;
 
        if (d_info[dungeon_type].flags1 & DF1_NO_DOORS)
        {
@@ -400,9 +391,10 @@ void add_door(POSITION x, POSITION y)
 * grids which are not in rooms.  We might want to also count stairs,\n
 * open doors, closed doors, etc.
 */
-static int next_to_corr(int y1, int x1)
+static int next_to_corr(POSITION y1, POSITION x1)
 {
-       int i, y, x, k = 0;
+       int i, k = 0;
+       POSITION y, x;
 
        cave_type *c_ptr;
 
@@ -412,8 +404,6 @@ static int next_to_corr(int y1, int x1)
                /* Extract the location */
                y = y1 + ddy_ddd[i];
                x = x1 + ddx_ddd[i];
-
-               /* Access the grid */
                c_ptr = &cave[y][x];
 
                /* Skip non floors */
@@ -441,10 +431,10 @@ static int next_to_corr(int y1, int x1)
 * @return ドアを設置可能ならばTRUEを返す
 * @note Assumes "in_bounds(y1, x1)"
 * @details
-* XXX XXX XXX\n
+* \n
 * Assumes "in_bounds(y, x)"\n
 */
-static bool possible_doorway(int y, int x)
+static bool possible_doorway(POSITION y, POSITION x)
 {
        /* Count the adjacent corridors */
        if (next_to_corr(y, x) >= 2)
@@ -505,7 +495,7 @@ void try_door(POSITION y, POSITION x)
  */
 void place_floor(POSITION x1, POSITION x2, POSITION y1, POSITION y2, bool light)
 {
-       int x, y;
+       POSITION x, y;
 
        /* Place a full floor under the room */
        for (y = y1 - 1; y <= y2 + 1; y++)
@@ -531,7 +521,7 @@ void place_floor(POSITION x1, POSITION x2, POSITION y1, POSITION y2, bool light)
  */
 void place_room(POSITION x1, POSITION x2, POSITION y1, POSITION y2, bool light)
 {
-       int y, x;
+       POSITION y, x;
 
        place_floor(x1, x2, y1, y2, light);
 
@@ -653,7 +643,6 @@ void vault_trap_aux(POSITION y, POSITION x, POSITION yd, POSITION xd)
                /* Place the trap */
                place_trap(y1, x1);
 
-               /* Done */
                break;
        }
 }
@@ -728,7 +717,7 @@ void vault_monsters(POSITION y1, POSITION x1, int num)
  * @param x2 終点X座標
  * @return なし
  */
-void correct_dir(int *rdir, int *cdir, int y1, int x1, int y2, int x2)
+void correct_dir(int *rdir, int *cdir, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 {
        /* Extract vertical and horizontal directions */
        *rdir = (y1 == y2) ? 0 : (y1 < y2) ? 1 : -1;
@@ -766,7 +755,7 @@ void rand_dir(int *rdir, int *cdir)
  * @param y チェックするマスのY座標
  * @return 床系地形ならばTRUE
  */
-bool get_is_floor(int x, int y)
+bool get_is_floor(POSITION x, POSITION y)
 {
        if (!in_bounds(y, x))
        {
@@ -786,7 +775,7 @@ bool get_is_floor(int x, int y)
  * @param y 地形を変えたいマスのY座標
  * @return なし
  */
-void set_floor(int x, int y)
+void set_floor(POSITION x, POSITION y)
 {
        if (!in_bounds(y, x))
        {