• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision521f53e0a2c7c226080b70bd02adf903bfd4db72 (tree)
Time2019-06-12 23:29:18
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/core.c
+++ b/src/core.c
@@ -5173,7 +5173,7 @@ static void dungeon(bool load_game)
51735173 * Maintain Unique monsters and artifact, save current
51745174 * floor, then prepare next floor
51755175 */
5176- leave_floor();
5176+ leave_floor(change_floor_mode);
51775177
51785178 /* Forget the flag */
51795179 reinit_wilderness = FALSE;
@@ -5693,7 +5693,7 @@ void play_game(bool new_game)
56935693 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
56945694
56955695 /* prepare next floor */
5696- leave_floor();
5696+ leave_floor(change_floor_mode);
56975697 }
56985698 else
56995699 {
--- a/src/floor-save.c
+++ b/src/floor-save.c
@@ -762,7 +762,7 @@ static void get_out_monster(void)
762762 * @param sf_ptr 移動元の保存フロア構造体参照ポインタ
763763 * @return なし
764764 */
765-static void locate_connected_stairs(saved_floor_type *sf_ptr, BIT_FLAGS prev_floor_mode)
765+static void locate_connected_stairs(saved_floor_type *sf_ptr, BIT_FLAGS floor_mode)
766766 {
767767 POSITION x, y, sx = 0, sy = 0;
768768 POSITION x_table[20];
@@ -779,7 +779,7 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr, BIT_FLAGS prev_flo
779779 feature_type *f_ptr = &f_info[g_ptr->feat];
780780 bool ok = FALSE;
781781
782- if (prev_floor_mode & CFM_UP)
782+ if (floor_mode & CFM_UP)
783783 {
784784 if (have_flag(f_ptr->flags, FF_LESS) && have_flag(f_ptr->flags, FF_STAIRS) &&
785785 !have_flag(f_ptr->flags, FF_SPECIAL))
@@ -796,7 +796,7 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr, BIT_FLAGS prev_flo
796796 }
797797 }
798798
799- else if (prev_floor_mode & CFM_DOWN)
799+ else if (floor_mode & CFM_DOWN)
800800 {
801801 if (have_flag(f_ptr->flags, FF_MORE) && have_flag(f_ptr->flags, FF_STAIRS) &&
802802 !have_flag(f_ptr->flags, FF_SPECIAL))
@@ -860,7 +860,7 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr, BIT_FLAGS prev_flo
860860 * / Maintain quest monsters, mark next floor_id at stairs, save current floor, and prepare to enter next floor.
861861 * @return なし
862862 */
863-void leave_floor(void)
863+void leave_floor(BIT_FLAGS floor_mode)
864864 {
865865 grid_type *g_ptr = NULL;
866866 feature_type *f_ptr;
@@ -881,8 +881,8 @@ void leave_floor(void)
881881
882882 /* Temporary get a floor_id (for Arena) */
883883 if (!p_ptr->floor_id &&
884- (change_floor_mode & CFM_SAVE_FLOORS) &&
885- !(change_floor_mode & CFM_NO_RETURN))
884+ (floor_mode & CFM_SAVE_FLOORS) &&
885+ !(floor_mode & CFM_NO_RETURN))
886886 {
887887 /* Get temporal floor_id */
888888 p_ptr->floor_id = get_new_floor_id();
@@ -942,13 +942,13 @@ void leave_floor(void)
942942 sf_ptr = get_sf_ptr(p_ptr->floor_id);
943943
944944 /* Choose random stairs */
945- if ((change_floor_mode & CFM_RAND_CONNECT) && p_ptr->floor_id)
945+ if ((floor_mode & CFM_RAND_CONNECT) && p_ptr->floor_id)
946946 {
947- locate_connected_stairs(sf_ptr, change_floor_mode);
947+ locate_connected_stairs(sf_ptr, floor_mode);
948948 }
949949
950950 /* Extract new dungeon level */
951- if (change_floor_mode & CFM_SAVE_FLOORS)
951+ if (floor_mode & CFM_SAVE_FLOORS)
952952 {
953953 /* Extract stair position */
954954 g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
@@ -969,25 +969,25 @@ void leave_floor(void)
969969 }
970970
971971 /* Climb up/down some sort of stairs */
972- if (change_floor_mode & (CFM_DOWN | CFM_UP))
972+ if (floor_mode & (CFM_DOWN | CFM_UP))
973973 {
974974 int move_num = 0;
975975
976976 /* Extract level movement number */
977- if (change_floor_mode & CFM_DOWN) move_num = 1;
978- else if (change_floor_mode & CFM_UP) move_num = -1;
977+ if (floor_mode & CFM_DOWN) move_num = 1;
978+ else if (floor_mode & CFM_UP) move_num = -1;
979979
980980 /* Shafts are deeper than normal stairs */
981- if (change_floor_mode & CFM_SHAFT)
981+ if (floor_mode & CFM_SHAFT)
982982 move_num += SGN(move_num);
983983
984984 /* Get out from or Enter the dungeon */
985- if (change_floor_mode & CFM_DOWN)
985+ if (floor_mode & CFM_DOWN)
986986 {
987987 if (!current_floor_ptr->dun_level)
988988 move_num = d_info[p_ptr->dungeon_idx].mindepth;
989989 }
990- else if (change_floor_mode & CFM_UP)
990+ else if (floor_mode & CFM_UP)
991991 {
992992 if (current_floor_ptr->dun_level + move_num < d_info[p_ptr->dungeon_idx].mindepth)
993993 move_num = -current_floor_ptr->dun_level;
@@ -1009,11 +1009,11 @@ void leave_floor(void)
10091009 p_ptr->dungeon_idx = 0;
10101010
10111011 /* Reach to the surface -- Clear all saved floors */
1012- change_floor_mode &= ~CFM_SAVE_FLOORS;
1012+ floor_mode &= ~CFM_SAVE_FLOORS;
10131013 }
10141014
10151015 /* Kill some old saved floors */
1016- if (!(change_floor_mode & CFM_SAVE_FLOORS))
1016+ if (!(floor_mode & CFM_SAVE_FLOORS))
10171017 {
10181018 /* Kill all saved floors */
10191019 for (i = 0; i < MAX_SAVED_FLOORS; i++)
@@ -1022,7 +1022,7 @@ void leave_floor(void)
10221022 /* Reset visit_mark count */
10231023 latest_visit_mark = 1;
10241024 }
1025- else if (change_floor_mode & CFM_NO_RETURN)
1025+ else if (floor_mode & CFM_NO_RETURN)
10261026 {
10271027 /* Kill current floor */
10281028 kill_saved_floor(sf_ptr);
@@ -1050,17 +1050,17 @@ void leave_floor(void)
10501050 }
10511051
10521052 /* Fix connection -- level teleportation or trap door */
1053- if (change_floor_mode & CFM_RAND_CONNECT)
1053+ if (floor_mode & CFM_RAND_CONNECT)
10541054 {
1055- if (change_floor_mode & CFM_UP)
1055+ if (floor_mode & CFM_UP)
10561056 sf_ptr->upper_floor_id = new_floor_id;
1057- else if (change_floor_mode & CFM_DOWN)
1057+ else if (floor_mode & CFM_DOWN)
10581058 sf_ptr->lower_floor_id = new_floor_id;
10591059 }
10601060
10611061 /* If you can return, you need to save previous floor */
1062- if ((change_floor_mode & CFM_SAVE_FLOORS) &&
1063- !(change_floor_mode & CFM_NO_RETURN))
1062+ if ((floor_mode & CFM_SAVE_FLOORS) &&
1063+ !(floor_mode & CFM_NO_RETURN))
10641064 {
10651065 /* Get out of the my way! */
10661066 get_out_monster();
@@ -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(BIT_FLAGS next_floor_mode)
1096+void change_floor(BIT_FLAGS floor_mode)
10971097 {
10981098 saved_floor_type *sf_ptr;
10991099 bool loaded = FALSE;
@@ -1114,8 +1114,8 @@ void change_floor(BIT_FLAGS next_floor_mode)
11141114 p_ptr->ambush_flag = FALSE;
11151115
11161116 /* No saved floors (On the surface etc.) */
1117- if (!(next_floor_mode & CFM_SAVE_FLOORS) &&
1118- !(next_floor_mode & CFM_FIRST_FLOOR))
1117+ if (!(floor_mode & CFM_SAVE_FLOORS) &&
1118+ !(floor_mode & CFM_FIRST_FLOOR))
11191119 {
11201120 /* Create current_floor_ptr->grid_array */
11211121 generate_random_floor();
@@ -1146,13 +1146,13 @@ void change_floor(BIT_FLAGS next_floor_mode)
11461146 loaded = TRUE;
11471147
11481148 /* Forbid return stairs */
1149- if (next_floor_mode & CFM_NO_RETURN)
1149+ if (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 (next_floor_mode & (CFM_DOWN | CFM_UP))
1155+ if (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(BIT_FLAGS next_floor_mode)
11751175 {
11761176 saved_floor_type *cur_sf_ptr = get_sf_ptr(p_ptr->floor_id);
11771177
1178- if (next_floor_mode & CFM_UP)
1178+ if (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 (next_floor_mode & CFM_DOWN)
1184+ else if (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(BIT_FLAGS next_floor_mode)
11921192 /* Break connection to killed floor */
11931193 else
11941194 {
1195- if (next_floor_mode & CFM_UP)
1195+ if (floor_mode & CFM_UP)
11961196 sf_ptr->lower_floor_id = 0;
1197- else if (next_floor_mode & CFM_DOWN)
1197+ else if (floor_mode & CFM_DOWN)
11981198 sf_ptr->upper_floor_id = 0;
11991199 }
12001200
@@ -1298,11 +1298,11 @@ void change_floor(BIT_FLAGS next_floor_mode)
12981298 build_dead_end();
12991299
13001300 /* Break connection */
1301- if (next_floor_mode & CFM_UP)
1301+ if (floor_mode & CFM_UP)
13021302 {
13031303 sf_ptr->upper_floor_id = 0;
13041304 }
1305- else if (next_floor_mode & CFM_DOWN)
1305+ else if (floor_mode & CFM_DOWN)
13061306 {
13071307 sf_ptr->lower_floor_id = 0;
13081308 }
@@ -1320,7 +1320,7 @@ void change_floor(BIT_FLAGS next_floor_mode)
13201320 sf_ptr->dun_level = current_floor_ptr->dun_level;
13211321
13221322 /* Create connected stairs */
1323- if (!(next_floor_mode & CFM_NO_RETURN))
1323+ if (!(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(BIT_FLAGS next_floor_mode)
13281328 /*** Create connected stairs ***/
13291329
13301330 /* No stairs down from Quest */
1331- if ((next_floor_mode & CFM_UP) && !quest_number(current_floor_ptr->dun_level))
1331+ if ((floor_mode & CFM_UP) && !quest_number(current_floor_ptr->dun_level))
13321332 {
1333- g_ptr->feat = (next_floor_mode & CFM_SHAFT) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair;
1333+ g_ptr->feat = (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 ((next_floor_mode & CFM_DOWN) && !ironman_downward)
1337+ else if ((floor_mode & CFM_DOWN) && !ironman_downward)
13381338 {
1339- g_ptr->feat = (next_floor_mode & CFM_SHAFT) ? feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair;
1339+ g_ptr->feat = (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(BIT_FLAGS next_floor_mode)
13481348 }
13491349
13501350 /* Arrive at random grid */
1351- if (next_floor_mode & (CFM_RAND_PLACE))
1351+ if (floor_mode & (CFM_RAND_PLACE))
13521352 {
13531353 (void)new_player_spot();
13541354 }
13551355
13561356 /* You see stairs blocked */
1357- else if ((next_floor_mode & CFM_NO_RETURN) && (next_floor_mode & (CFM_DOWN | CFM_UP)))
1357+ else if ((floor_mode & CFM_NO_RETURN) && (floor_mode & (CFM_DOWN | CFM_UP)))
13581358 {
13591359 if (!p_ptr->blind)
13601360 {
@@ -1404,7 +1404,7 @@ void change_floor(BIT_FLAGS next_floor_mode)
14041404 p_ptr->feeling = 0;
14051405
14061406 /* Clear all flags */
1407- next_floor_mode = 0L;
1407+ floor_mode = 0L;
14081408
14091409 select_floor_music();
14101410 }
--- a/src/floor-save.h
+++ b/src/floor-save.h
@@ -20,8 +20,8 @@ extern u32b saved_floor_file_sign;
2020 extern BIT_FLAGS change_floor_mode; /*!<フロア移行処理に関するフラグ / Mode flags for changing floor */
2121
2222 extern void init_saved_floors(bool force);
23-extern void change_floor(BIT_FLAGS next_floor_mode);
24-extern void leave_floor(void);
23+extern void change_floor(BIT_FLAGS floor_mode);
24+extern void leave_floor(BIT_FLAGS floor_mode);
2525 extern void clear_saved_floor_files(void);
2626 extern saved_floor_type *get_sf_ptr(FLOOR_IDX floor_id);
2727 extern FLOOR_IDX get_new_floor_id(void);
--- a/src/player-status.c
+++ b/src/player-status.c
@@ -5882,7 +5882,7 @@ void cheat_death(player_type *creature_ptr)
58825882 " but revived."));
58835883
58845884 /* Prepare next floor */
5885- leave_floor();
5885+ leave_floor(change_floor_mode);
58865886 wipe_m_list();
58875887
58885888 }
Show on old repository browser