• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revisionb8ad87734bcedaeed9318deda8657c9e9d33e12a (tree)
Time2019-06-13 22:25:49
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 place_random_stairs() 周りを整理.一か所しか使われず簡単化にあまりなっていないマクロを削除し,ついでに関連のコメントのミスを整理したり,冗長なものも削除.

Change Summary

Incremental Difference

--- a/src/grid.c
+++ b/src/grid.c
@@ -194,7 +194,6 @@ bool new_player_spot(void)
194194 grid_type *g_ptr;
195195 feature_type *f_ptr;
196196
197- /* Place the player */
198197 while (max_attempts--)
199198 {
200199 /* Pick a legal spot */
@@ -257,16 +256,9 @@ void place_random_stairs(POSITION y, POSITION x)
257256 g_ptr = &current_floor_ptr->grid_array[y][x];
258257 if (!is_floor_grid(g_ptr) || g_ptr->o_idx) return;
259258
260- /* Town */
261259 if (!current_floor_ptr->dun_level) up_stairs = FALSE;
262-
263- /* Ironman */
264260 if (ironman_downward) up_stairs = FALSE;
265-
266- /* Bottom */
267261 if (current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) down_stairs = FALSE;
268-
269- /* Quest-level */
270262 if (quest_number(current_floor_ptr->dun_level) && (current_floor_ptr->dun_level > 1)) down_stairs = FALSE;
271263
272264 /* We can't place both */
@@ -278,8 +270,8 @@ void place_random_stairs(POSITION y, POSITION x)
278270 }
279271
280272 /* Place the stairs */
281- if (up_stairs) place_up_stairs(y, x);
282- else if (down_stairs) place_down_stairs(y, x);
273+ if (up_stairs) set_cave_feat(y, x, feat_up_stair);
274+ else if (down_stairs) set_cave_feat(y, x, feat_down_stair);
283275 }
284276
285277 /*!
--- a/src/grid.h
+++ b/src/grid.h
@@ -78,7 +78,6 @@ typedef struct
7878 } grid_template_type;
7979
8080 /* Macros */
81-
8281 #define set_cave_feat(Y,X,F) (current_floor_ptr->grid_array[(Y)][(X)].feat = (F))
8382 #define add_cave_info(Y,X,I) (current_floor_ptr->grid_array[(Y)][(X)].info |= (I))
8483
@@ -86,30 +85,13 @@ typedef struct
8685 /*#define set_cave_info(Y,X,I) (current_floor_ptr->grid_array[(Y)][(X)].info = (I)) */
8786
8887 /*!
89- * @brief 指定座標が瓦礫かどうかを返す
88+ * @brief 指定座標に瓦礫を配置する
9089 * @param Y 指定Y座標
9190 * @param X 指定X座標
92- * @return 瓦礫ならばTRUE
9391 */
9492 #define place_rubble(Y,X) set_cave_feat(Y,X,feat_rubble)
9593
9694 /*!
97- * @brief 指定座標が上り階段かどうかを返す
98- * @param Y 指定Y座標
99- * @param X 指定X座標
100- * @return 上り階段ならばTRUE
101- */
102-#define place_up_stairs(Y,X) set_cave_feat(Y,X,feat_up_stair)
103-
104-/*!
105- * @brief 指定座標が下り階段かどうかを返す
106- * @param Y 指定Y座標
107- * @param X 指定X座標
108- * @return 下り階段ならばTRUE
109- */
110-#define place_down_stairs(Y,X) set_cave_feat(Y,X,feat_down_stair)
111-
112-/*!
11395 * @brief 指定座標がFLOOR属性を持ったマスかどうかを返す
11496 * @param Y 指定Y座標
11597 * @param X 指定X座標
--- a/src/wild.c
+++ b/src/wild.c
@@ -753,10 +753,8 @@ void wilderness_gen_small(void)
753753 panel_row_min = current_floor_ptr->height;
754754 panel_col_min = current_floor_ptr->width;
755755
756- /* Place the player */
757756 p_ptr->x = p_ptr->wilderness_x;
758757 p_ptr->y = p_ptr->wilderness_y;
759-
760758 p_ptr->town_num = 0;
761759 }
762760
Show on old repository browser