• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision1789f6c03102d6401681d909632fa1f9e0b68274 (tree)
Time2019-06-12 22:32:59
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #39068 change_floor() の change_floor_mode グローバル参照をローカル引数に収める。

Change Summary

Incremental Difference

--- a/src/core.c
+++ b/src/core.c
@@ -5547,7 +5547,7 @@ void play_game(bool new_game)
55475547 /* Generate a dungeon level if needed */
55485548 if (!current_world_ptr->character_dungeon)
55495549 {
5550- change_floor();
5550+ change_floor(change_floor_mode);
55515551 }
55525552
55535553 else
@@ -5559,7 +5559,7 @@ void play_game(bool new_game)
55595559 if (!p_ptr->y || !p_ptr->x)
55605560 {
55615561 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5562- change_floor();
5562+ change_floor(change_floor_mode);
55635563 }
55645564
55655565 /* Still no player? -- Try to locate random place */
@@ -5709,7 +5709,7 @@ void play_game(bool new_game)
57095709 if (p_ptr->is_dead) break;
57105710
57115711 /* Make a new level */
5712- change_floor();
5712+ change_floor(change_floor_mode);
57135713 }
57145714
57155715 /* Close stuff */
--- a/src/floor-save.c
+++ b/src/floor-save.c
@@ -44,7 +44,7 @@
4444
4545
4646 static FLOOR_IDX new_floor_id; /*!<次のフロアのID / floor_id of the destination */
47-static u32b change_floor_mode; /*!<フロア移行処理に関するフラグ / Mode flags for changing floor */
47+BIT_FLAGS change_floor_mode; /*!<フロア移行処理に関するフラグ / Mode flags for changing floor */
4848 static u32b latest_visit_mark; /*!<フロアを渡った回数?(確認中) / Max number of visit_mark */
4949
5050 /*
@@ -1093,7 +1093,7 @@ void leave_floor(void)
10931093 * restored from the temporal file. If the floor is new one, new current_floor_ptr->grid_array\n
10941094 * will be generated.\n
10951095 */
1096-void change_floor(void)
1096+void change_floor(BIT_FLAGS next_floor_mode)
10971097 {
10981098 saved_floor_type *sf_ptr;
10991099 bool loaded = FALSE;
@@ -1114,8 +1114,8 @@ void change_floor(void)
11141114 p_ptr->ambush_flag = FALSE;
11151115
11161116 /* No saved floors (On the surface etc.) */
1117- if (!(change_floor_mode & CFM_SAVE_FLOORS) &&
1118- !(change_floor_mode & CFM_FIRST_FLOOR))
1117+ if (!(next_floor_mode & CFM_SAVE_FLOORS) &&
1118+ !(next_floor_mode & CFM_FIRST_FLOOR))
11191119 {
11201120 /* Create current_floor_ptr->grid_array */
11211121 generate_random_floor();
@@ -1146,13 +1146,13 @@ void change_floor(void)
11461146 loaded = TRUE;
11471147
11481148 /* Forbid return stairs */
1149- if (change_floor_mode & CFM_NO_RETURN)
1149+ if (next_floor_mode & CFM_NO_RETURN)
11501150 {
11511151 grid_type *g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
11521152
11531153 if (!feat_uses_special(g_ptr->feat))
11541154 {
1155- if (change_floor_mode & (CFM_DOWN | CFM_UP))
1155+ if (next_floor_mode & (CFM_DOWN | CFM_UP))
11561156 {
11571157 /* Reset to floor */
11581158 g_ptr->feat = feat_ground_type[randint0(100)];
@@ -1175,13 +1175,13 @@ void change_floor(void)
11751175 {
11761176 saved_floor_type *cur_sf_ptr = get_sf_ptr(p_ptr->floor_id);
11771177
1178- if (change_floor_mode & CFM_UP)
1178+ if (next_floor_mode & CFM_UP)
11791179 {
11801180 /* New floor is right-above */
11811181 if (cur_sf_ptr->upper_floor_id == new_floor_id)
11821182 sf_ptr->lower_floor_id = p_ptr->floor_id;
11831183 }
1184- else if (change_floor_mode & CFM_DOWN)
1184+ else if (next_floor_mode & CFM_DOWN)
11851185 {
11861186 /* New floor is right-under */
11871187 if (cur_sf_ptr->lower_floor_id == new_floor_id)
@@ -1192,9 +1192,9 @@ void change_floor(void)
11921192 /* Break connection to killed floor */
11931193 else
11941194 {
1195- if (change_floor_mode & CFM_UP)
1195+ if (next_floor_mode & CFM_UP)
11961196 sf_ptr->lower_floor_id = 0;
1197- else if (change_floor_mode & CFM_DOWN)
1197+ else if (next_floor_mode & CFM_DOWN)
11981198 sf_ptr->upper_floor_id = 0;
11991199 }
12001200
@@ -1298,11 +1298,11 @@ void change_floor(void)
12981298 build_dead_end();
12991299
13001300 /* Break connection */
1301- if (change_floor_mode & CFM_UP)
1301+ if (next_floor_mode & CFM_UP)
13021302 {
13031303 sf_ptr->upper_floor_id = 0;
13041304 }
1305- else if (change_floor_mode & CFM_DOWN)
1305+ else if (next_floor_mode & CFM_DOWN)
13061306 {
13071307 sf_ptr->lower_floor_id = 0;
13081308 }
@@ -1320,7 +1320,7 @@ void change_floor(void)
13201320 sf_ptr->dun_level = current_floor_ptr->dun_level;
13211321
13221322 /* Create connected stairs */
1323- if (!(change_floor_mode & CFM_NO_RETURN))
1323+ if (!(next_floor_mode & CFM_NO_RETURN))
13241324 {
13251325 /* Extract stair position */
13261326 grid_type *g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
@@ -1328,15 +1328,15 @@ void change_floor(void)
13281328 /*** Create connected stairs ***/
13291329
13301330 /* No stairs down from Quest */
1331- if ((change_floor_mode & CFM_UP) && !quest_number(current_floor_ptr->dun_level))
1331+ if ((next_floor_mode & CFM_UP) && !quest_number(current_floor_ptr->dun_level))
13321332 {
1333- g_ptr->feat = (change_floor_mode & CFM_SHAFT) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair;
1333+ g_ptr->feat = (next_floor_mode & CFM_SHAFT) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair;
13341334 }
13351335
13361336 /* No stairs up when ironman_downward */
1337- else if ((change_floor_mode & CFM_DOWN) && !ironman_downward)
1337+ else if ((next_floor_mode & CFM_DOWN) && !ironman_downward)
13381338 {
1339- g_ptr->feat = (change_floor_mode & CFM_SHAFT) ? feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair;
1339+ g_ptr->feat = (next_floor_mode & CFM_SHAFT) ? feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair;
13401340 }
13411341
13421342 /* Paranoia -- Clear mimic */
@@ -1348,13 +1348,13 @@ void change_floor(void)
13481348 }
13491349
13501350 /* Arrive at random grid */
1351- if (change_floor_mode & (CFM_RAND_PLACE))
1351+ if (next_floor_mode & (CFM_RAND_PLACE))
13521352 {
13531353 (void)new_player_spot();
13541354 }
13551355
13561356 /* You see stairs blocked */
1357- else if ((change_floor_mode & CFM_NO_RETURN) && (change_floor_mode & (CFM_DOWN | CFM_UP)))
1357+ else if ((next_floor_mode & CFM_NO_RETURN) && (next_floor_mode & (CFM_DOWN | CFM_UP)))
13581358 {
13591359 if (!p_ptr->blind)
13601360 {
@@ -1404,7 +1404,7 @@ void change_floor(void)
14041404 p_ptr->feeling = 0;
14051405
14061406 /* Clear all flags */
1407- change_floor_mode = 0L;
1407+ next_floor_mode = 0L;
14081408
14091409 select_floor_music();
14101410 }
--- a/src/floor-save.h
+++ b/src/floor-save.h
@@ -17,9 +17,10 @@ typedef struct
1717 } saved_floor_type;
1818
1919 extern u32b saved_floor_file_sign;
20+extern BIT_FLAGS change_floor_mode; /*!<フロア移行処理に関するフラグ / Mode flags for changing floor */
2021
2122 extern void init_saved_floors(bool force);
22-extern void change_floor(void);
23+extern void change_floor(BIT_FLAGS next_floor_mode);
2324 extern void leave_floor(void);
2425 extern void clear_saved_floor_files(void);
2526 extern saved_floor_type *get_sf_ptr(FLOOR_IDX floor_id);
Show on old repository browser