From 6d14a81d1134d9c5bffec5fc3aafc30ab1abae86 Mon Sep 17 00:00:00 2001 From: Hourier Date: Sun, 12 Jul 2020 18:29:00 +0900 Subject: [PATCH] [Refactor] #40542 Changed macro function cave_have_flag_bold() to normal function --- src/cmd-action/cmd-move.c | 1 - src/cmd-item/cmd-activate.c | 2 +- src/cmd-item/cmd-throw.c | 2 +- src/combat/shoot.c | 1 + src/floor/floor-events.c | 1 + src/floor/floor.c | 5 +++ src/floor/floor.h | 78 +++++++++++++++++---------------------- src/player-attack/player-attack.c | 2 +- src/player/player-move.c | 2 +- src/realm/realm-hissatsu.c | 2 +- src/room/rooms.c | 2 +- src/spell-kind/spells-fetcher.c | 2 +- src/spell-kind/spells-floor.c | 2 +- src/spell-kind/spells-neighbor.c | 2 +- src/spell-realm/spells-crusade.c | 2 +- src/spell/process-effect.c | 2 +- src/spell/spells-status.c | 2 +- 17 files changed, 53 insertions(+), 57 deletions(-) diff --git a/src/cmd-action/cmd-move.c b/src/cmd-action/cmd-move.c index 50935fc0b..b68d6a5fc 100644 --- a/src/cmd-action/cmd-move.c +++ b/src/cmd-action/cmd-move.c @@ -14,7 +14,6 @@ #include "game-option/input-options.h" #include "game-option/play-record-options.h" #include "game-option/special-options.h" -#include "grid/feature.h" #include "grid/grid.h" #include "info-reader/fixed-map-parser.h" #include "io/input-key-requester.h" diff --git a/src/cmd-item/cmd-activate.c b/src/cmd-item/cmd-activate.c index 10c4c8c01..5b09e37c3 100644 --- a/src/cmd-item/cmd-activate.c +++ b/src/cmd-item/cmd-activate.c @@ -22,7 +22,7 @@ #include "game-option/disturbance-options.h" #include "game-option/input-options.h" #include "game-option/special-options.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "io/targeting.h" #include "main/sound-definitions-table.h" diff --git a/src/cmd-item/cmd-throw.c b/src/cmd-item/cmd-throw.c index 87859f138..50e225be1 100644 --- a/src/cmd-item/cmd-throw.c +++ b/src/cmd-item/cmd-throw.c @@ -16,7 +16,7 @@ #include "floor/geometry.h" #include "game-option/cheat-types.h" #include "game-option/special-options.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "inventory/inventory-object.h" #include "inventory/inventory-slot-types.h" diff --git a/src/combat/shoot.c b/src/combat/shoot.c index b2cf0efef..6fb8bd267 100644 --- a/src/combat/shoot.c +++ b/src/combat/shoot.c @@ -11,6 +11,7 @@ #include "game-option/cheat-types.h" #include "game-option/special-options.h" #include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "inventory/inventory-object.h" #include "inventory/inventory-slot-types.h" diff --git a/src/floor/floor-events.c b/src/floor/floor-events.c index 6627b13ea..504b43596 100644 --- a/src/floor/floor-events.c +++ b/src/floor/floor-events.c @@ -9,6 +9,7 @@ #include "game-option/cheat-options.h" #include "game-option/disturbance-options.h" #include "game-option/map-screen-options.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "main/sound-of-music.h" #include "mind/mind-ninja.h" diff --git a/src/floor/floor.c b/src/floor/floor.c index 6afcf7168..142504268 100644 --- a/src/floor/floor.c +++ b/src/floor/floor.c @@ -1695,3 +1695,8 @@ bool cave_los_bold(floor_type *floor_ptr, POSITION y, POSITION x) { return feat_supports_los(floor_ptr->grid_array[y][x].feat); } + +bool cave_have_flag_bold(floor_type *floor_ptr, POSITION y, POSITION x, feature_flag_type f_idx) +{ + return have_flag(f_info[floor_ptr->grid_array[y][x].feat].flags, f_idx); +} diff --git a/src/floor/floor.h b/src/floor/floor.h index 48eca0b6f..6d87cc97b 100644 --- a/src/floor/floor.h +++ b/src/floor/floor.h @@ -208,10 +208,6 @@ extern floor_type floor_info; ((G) == &(C)->current_floor_ptr->grid_array[(C)->y][(C)->x]) -#define cave_have_flag_bold(F,Y,X,INDEX) \ - (have_flag(f_info[(F)->grid_array[(Y)][(X)].feat].flags, (INDEX))) - - #define cave_have_flag_grid(C,INDEX) \ (have_flag(f_info[(C)->feat].flags, (INDEX))) @@ -334,43 +330,37 @@ extern saved_floor_type saved_floors[MAX_SAVED_FLOORS]; #define GRID_X(G) \ ((int)((G) % 256U)) -extern bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x); -extern bool is_cave_empty_bold(player_type *player_ptr, POSITION x, POSITION y); -extern bool is_cave_empty_bold2(player_type *player_ptr, POSITION x, POSITION y); -extern void update_smell(floor_type *floor_ptr, player_type *subject_ptr); - -extern void add_door(player_type *player_ptr, POSITION x, POSITION y); -extern void place_secret_door(player_type *player_ptr, POSITION y, POSITION x, int type); -extern void place_locked_door(player_type *player_ptr, POSITION y, POSITION x); -extern void forget_flow(floor_type *floor_ptr); -extern void place_random_stairs(player_type *player_ptr, POSITION y, POSITION x); - -extern bool los(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2); -extern bool projectable(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2); - -extern void vault_monsters(player_type *player_ptr, POSITION y1, POSITION x1, int num); -extern bool cave_valid_bold(floor_type *floor_ptr, POSITION y, POSITION x); -extern void cave_set_feat(player_type *player_ptr, POSITION y, POSITION x, FEAT_IDX feat); -extern void place_random_door(player_type *player_ptr, POSITION y, POSITION x, bool room); -extern void place_closed_door(player_type *player_ptr, POSITION y, POSITION x, int type); - -extern void wipe_o_list(floor_type *floor_ptr); -extern void vault_trap_aux(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd); - -extern bool get_is_floor(floor_type *floor_ptr, POSITION x, POSITION y); -extern void try_door(player_type *player_ptr, POSITION y, POSITION x); - -extern FEAT_IDX conv_dungeon_feat(floor_type *floor_ptr, FEAT_IDX newfeat); -extern void vault_objects(player_type *player_ptr, POSITION y, POSITION x, int num); - -extern int project_path(player_type *player_ptr, u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg); - -extern void set_floor(player_type *player_ptr, POSITION x, POSITION y); -extern void place_object(player_type *owner_ptr, POSITION y, POSITION x, BIT_FLAGS mode); -extern void place_gold(player_type *player_ptr, POSITION y, POSITION x); -extern void delete_monster(player_type *player_ptr, POSITION y, POSITION x); -extern void compact_objects(player_type *owner_ptr, int size); -extern void vault_traps(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd, int num); -extern void scatter(player_type *player_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode); - -extern bool cave_los_bold(floor_type *floor_ptr, POSITION y, POSITION x); +bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x); +bool is_cave_empty_bold(player_type *player_ptr, POSITION x, POSITION y); +bool is_cave_empty_bold2(player_type *player_ptr, POSITION x, POSITION y); +void update_smell(floor_type *floor_ptr, player_type *subject_ptr); +void add_door(player_type *player_ptr, POSITION x, POSITION y); +void place_secret_door(player_type *player_ptr, POSITION y, POSITION x, int type); +void place_locked_door(player_type *player_ptr, POSITION y, POSITION x); +void forget_flow(floor_type *floor_ptr); +void place_random_stairs(player_type *player_ptr, POSITION y, POSITION x); +bool los(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2); +bool projectable(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2); +void vault_monsters(player_type *player_ptr, POSITION y1, POSITION x1, int num); +bool cave_valid_bold(floor_type *floor_ptr, POSITION y, POSITION x); +void cave_set_feat(player_type *player_ptr, POSITION y, POSITION x, FEAT_IDX feat); +void place_random_door(player_type *player_ptr, POSITION y, POSITION x, bool room); +void place_closed_door(player_type *player_ptr, POSITION y, POSITION x, int type); +void wipe_o_list(floor_type *floor_ptr); +void vault_trap_aux(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd); +bool get_is_floor(floor_type *floor_ptr, POSITION x, POSITION y); +void try_door(player_type *player_ptr, POSITION y, POSITION x); +FEAT_IDX conv_dungeon_feat(floor_type *floor_ptr, FEAT_IDX newfeat); +void vault_objects(player_type *player_ptr, POSITION y, POSITION x, int num); +int project_path(player_type *player_ptr, u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg); +void set_floor(player_type *player_ptr, POSITION x, POSITION y); +void place_object(player_type *owner_ptr, POSITION y, POSITION x, BIT_FLAGS mode); +void place_gold(player_type *player_ptr, POSITION y, POSITION x); +void delete_monster(player_type *player_ptr, POSITION y, POSITION x); +void compact_objects(player_type *owner_ptr, int size); +void vault_traps(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd, int num); +void scatter(player_type *player_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode); +bool cave_los_bold(floor_type *floor_ptr, POSITION y, POSITION x); + +typedef enum feature_flag_type feature_flag_type; +bool cave_have_flag_bold(floor_type *floor_ptr, POSITION y, POSITION x, feature_flag_type f_idx); diff --git a/src/player-attack/player-attack.c b/src/player-attack/player-attack.c index 8d88695ba..d5238472d 100644 --- a/src/player-attack/player-attack.c +++ b/src/player-attack/player-attack.c @@ -14,7 +14,7 @@ #include "core/player-update-types.h" #include "floor/floor.h" #include "game-option/cheat-types.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "inventory/inventory-slot-types.h" #include "main/sound-definitions-table.h" #include "main/sound-of-music.h" diff --git a/src/player/player-move.c b/src/player/player-move.c index 7c93ea328..69afa4714 100644 --- a/src/player/player-move.c +++ b/src/player/player-move.c @@ -33,7 +33,7 @@ #include "game-option/play-record-options.h" #include "game-option/special-options.h" #include "game-option/text-display-options.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "grid/trap.h" #include "inventory/inventory-object.h" diff --git a/src/realm/realm-hissatsu.c b/src/realm/realm-hissatsu.c index 9990ce7ae..1232da188 100644 --- a/src/realm/realm-hissatsu.c +++ b/src/realm/realm-hissatsu.c @@ -11,7 +11,7 @@ #include "dungeon/dungeon.h" #include "effect/effect-characteristics.h" #include "effect/spells-effect-util.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "inventory/inventory-slot-types.h" #include "io/input-key-acceptor.h" diff --git a/src/room/rooms.c b/src/room/rooms.c index 73310ea8f..3160588a8 100644 --- a/src/room/rooms.c +++ b/src/room/rooms.c @@ -42,7 +42,7 @@ #include "floor/floor.h" #include "game-option/birth-options.h" #include "game-option/cheat-types.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "grid/trap.h" #include "monster-floor/monster-generator.h" diff --git a/src/spell-kind/spells-fetcher.c b/src/spell-kind/spells-fetcher.c index e5ba0310f..645c2cb10 100644 --- a/src/spell-kind/spells-fetcher.c +++ b/src/spell-kind/spells-fetcher.c @@ -5,7 +5,7 @@ #include "flavor/flavor-describer.h" #include "flavor/object-flavor-types.h" #include "floor/floor.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "io/targeting.h" #include "monster-race/monster-race.h" diff --git a/src/spell-kind/spells-floor.c b/src/spell-kind/spells-floor.c index a2747f6a9..7d4898adc 100644 --- a/src/spell-kind/spells-floor.c +++ b/src/spell-kind/spells-floor.c @@ -22,7 +22,7 @@ #include "game-option/cheat-options.h" #include "game-option/map-screen-options.h" #include "game-option/play-record-options.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "io/write-diary.h" #include "mind/mind-ninja.h" diff --git a/src/spell-kind/spells-neighbor.c b/src/spell-kind/spells-neighbor.c index 9774312a7..1d7e4a372 100644 --- a/src/spell-kind/spells-neighbor.c +++ b/src/spell-kind/spells-neighbor.c @@ -3,7 +3,7 @@ #include "core/player-update-types.h" #include "effect/effect-characteristics.h" #include "floor/floor.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "spell/process-effect.h" #include "spell-kind/earthquake.h" diff --git a/src/spell-realm/spells-crusade.c b/src/spell-realm/spells-crusade.c index f79cd27eb..d151effba 100644 --- a/src/spell-realm/spells-crusade.c +++ b/src/spell-realm/spells-crusade.c @@ -11,7 +11,7 @@ #include "effect/effect-characteristics.h" #include "floor/floor.h" #include "game-option/disturbance-options.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "io/targeting.h" #include "player/player-move.h" diff --git a/src/spell/process-effect.c b/src/spell/process-effect.c index 18a59b15b..f53c8b236 100644 --- a/src/spell/process-effect.c +++ b/src/spell/process-effect.c @@ -8,7 +8,7 @@ #include "effect/spells-effect-util.h" #include "floor/floor.h" #include "game-option/special-options.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "io/cursor.h" #include "io/screen-util.h" #include "io/targeting.h" diff --git a/src/spell/spells-status.c b/src/spell/spells-status.c index 8c0362590..241094224 100644 --- a/src/spell/spells-status.c +++ b/src/spell/spells-status.c @@ -17,7 +17,7 @@ #include "flavor/object-flavor-types.h" #include "floor/floor-object.h" #include "floor/floor.h" -#include "grid/feature.h" +#include "grid/feature-flag-types.h" #include "grid/grid.h" #include "inventory/inventory-object.h" #include "inventory/inventory-slot-types.h" -- 2.11.0