From: Hourier Date: Thu, 16 Jan 2020 13:30:03 +0000 (+0900) Subject: [Refactor] #38997 delete_monster_idx() にplayer_type 構造体を追加する予定のため、関数マクロ place_*(... X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=eca4c8cbcd251ecd0877d0b539e2288070116941;p=hengband%2Fhengband.git [Refactor] #38997 delete_monster_idx() にplayer_type 構造体を追加する予定のため、関数マクロ place_*() を普通の関数に展開し、使われていないものを削除 / Changed macro functions place_*() to normal functions in order to add player_type * argument to delete_monster_idx() and removed unused some functions --- diff --git a/src/grid.c b/src/grid.c index 7a584efe0..e32526464 100644 --- a/src/grid.c +++ b/src/grid.c @@ -1209,3 +1209,67 @@ bool player_can_enter(player_type *creature_ptr, FEAT_IDX feature, BIT_FLAGS16 m return TRUE; } + +void place_floor_grid(grid_type *g_ptr) +{ + g_ptr->feat = feat_ground_type[randint0(100)]; + g_ptr->info &= ~(CAVE_MASK); + g_ptr->info |= CAVE_FLOOR; + if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx); +} + + +void place_extra_grid(grid_type *g_ptr) +{ + g_ptr->feat = feat_wall_type[randint0(100)]; + g_ptr->info &= ~(CAVE_MASK); + g_ptr->info |= CAVE_EXTRA; + if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx); +} + + +void place_inner_grid(grid_type *g_ptr) +{ + g_ptr->feat = feat_wall_inner; + g_ptr->info &= ~(CAVE_MASK); + g_ptr->info |= CAVE_INNER; + if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx); +} + + +void place_inner_perm_grid(grid_type *g_ptr) +{ + g_ptr->feat = feat_permanent; + g_ptr->info &= ~(CAVE_MASK); + g_ptr->info |= CAVE_INNER; + if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx); +} + + +void place_outer_grid(grid_type *g_ptr) +{ + g_ptr->feat = feat_wall_outer; + g_ptr->info &= ~(CAVE_MASK); + g_ptr->info |= CAVE_OUTER; + if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx); +} + + +void place_outer_noperm_grid(grid_type *g_ptr) +{ + feature_type *_f_ptr = &f_info[feat_wall_outer]; + if (permanent_wall(_f_ptr)) g_ptr->feat = (s16b)feat_state(feat_wall_outer, FF_UNPERM); + else g_ptr->feat = feat_wall_outer; + g_ptr->info &= ~(CAVE_MASK); + g_ptr->info |= (CAVE_OUTER | CAVE_VAULT); + if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx); +} + + +void place_solid_perm_grid(grid_type *g_ptr) +{ + g_ptr->feat = feat_permanent; + g_ptr->info &= ~(CAVE_MASK); + g_ptr->info |= CAVE_SOLID; + if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx); +} diff --git a/src/grid.h b/src/grid.h index 6f61a3607..bd34b21ad 100644 --- a/src/grid.h +++ b/src/grid.h @@ -125,14 +125,6 @@ typedef struct delete_monster(F, Y, X); \ } -#define place_floor_grid(C) \ -{ \ - (C)->feat = feat_ground_type[randint0(100)]; \ - (C)->info &= ~(CAVE_MASK); \ - (C)->info |= CAVE_FLOOR; \ - if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ -} - #define place_extra_bold(F, Y, X) \ { \ set_cave_feat((F), Y,X,feat_wall_type[randint0(100)]); \ @@ -141,14 +133,6 @@ typedef struct delete_monster(F, Y, X); \ } -#define place_extra_grid(C) \ -{ \ - (C)->feat = feat_wall_type[randint0(100)]; \ - (C)->info &= ~(CAVE_MASK); \ - (C)->info |= CAVE_EXTRA; \ - if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ -} - #define place_extra_perm_bold(F, Y, X) \ { \ set_cave_feat(F, Y, X,feat_permanent); \ @@ -157,14 +141,6 @@ typedef struct delete_monster(F, Y, X); \ } -#define place_extra_perm_grid(C) \ -{ \ - (C)->feat = feat_permanent; \ - (C)->info &= ~(CAVE_MASK); \ - (C)->info |= CAVE_EXTRA; \ - if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ -} - #define place_extra_noperm_bold(F, Y, X) \ { \ feature_type *_f_ptr; \ @@ -184,14 +160,6 @@ typedef struct delete_monster(F, Y, X); \ } -#define place_inner_grid(C) \ -{ \ - (C)->feat = feat_wall_inner; \ - (C)->info &= ~(CAVE_MASK); \ - (C)->info |= CAVE_INNER; \ - if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ -} - #define place_inner_perm_bold(F, Y, X) \ { \ set_cave_feat(F, Y,X,feat_permanent); \ @@ -200,14 +168,6 @@ typedef struct delete_monster(F, Y, X); \ } -#define place_inner_perm_grid(C) \ -{ \ - (C)->feat = feat_permanent; \ - (C)->info &= ~(CAVE_MASK); \ - (C)->info |= CAVE_INNER; \ - if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ -} - #define place_outer_bold(F, Y, X) \ { \ set_cave_feat((F), Y, X, feat_wall_outer); \ @@ -216,14 +176,6 @@ typedef struct delete_monster(F, Y, X); \ } -#define place_outer_grid(C) \ -{ \ - (C)->feat = feat_wall_outer; \ - (C)->info &= ~(CAVE_MASK); \ - (C)->info |= CAVE_OUTER; \ - if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ -} - #define place_outer_perm_bold(F, Y, X) \ { \ set_cave_feat(F, Y, X, feat_permanent); \ @@ -232,14 +184,6 @@ typedef struct delete_monster(F, Y, X); \ } -#define place_outer_perm_grid(C) \ -{ \ - (C)->feat = feat_permanent; \ - (C)->info &= ~(CAVE_MASK); \ - (C)->info |= CAVE_OUTER; \ - if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ -} - #define place_outer_noperm_bold(F, Y, X) \ { \ feature_type *_f_ptr = &f_info[feat_wall_outer]; \ @@ -250,16 +194,6 @@ typedef struct delete_monster(F, Y, X); \ } -#define place_outer_noperm_grid(C) \ -{ \ - feature_type *_f_ptr = &f_info[feat_wall_outer]; \ - if (permanent_wall(_f_ptr)) (C)->feat = (s16b)feat_state(feat_wall_outer, FF_UNPERM); \ - else (C)->feat = feat_wall_outer; \ - (C)->info &= ~(CAVE_MASK); \ - (C)->info |= (CAVE_OUTER | CAVE_VAULT); \ - if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ -} - #define place_solid_bold(F, Y, X) \ { \ set_cave_feat(F,Y,X,feat_wall_solid); \ @@ -268,14 +202,6 @@ typedef struct delete_monster(F, Y, X); \ } -#define place_solid_grid(C) \ -{ \ - (C)->feat = feat_wall_solid; \ - (C)->info &= ~(CAVE_MASK); \ - (C)->info |= CAVE_SOLID; \ - if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ -} - #define place_solid_perm_bold(F, Y, X) \ { \ set_cave_feat(F, Y, X, feat_permanent); \ @@ -284,14 +210,6 @@ typedef struct delete_monster(F, Y, X); \ } -#define place_solid_perm_grid(C) \ -{ \ - (C)->feat = feat_permanent; \ - (C)->info &= ~(CAVE_MASK); \ - (C)->info |= CAVE_SOLID; \ - if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ -} - #define place_solid_noperm_bold(F, Y, X) \ { \ feature_type *_f_ptr = &f_info[feat_wall_solid]; \ @@ -303,17 +221,6 @@ typedef struct delete_monster(F, Y, X); \ } -#define place_solid_noperm_grid(C) \ -{ \ - feature_type *_f_ptr = &f_info[feat_wall_solid]; \ - if (((C)->info & CAVE_VAULT) && permanent_wall(_f_ptr)) \ - (C)->feat = feat_state(feat_wall_solid, FF_UNPERM); \ - else (C)->feat = feat_wall_solid; \ - (C)->info &= ~(CAVE_MASK); \ - (C)->info |= CAVE_SOLID; \ - if ((C)->m_idx) delete_monster_idx((C)->m_idx); \ -} - /* * 特殊なマス状態フラグ / Special grid flags @@ -400,6 +307,14 @@ extern bool check_local_illumination(player_type *creature_ptr, POSITION y, POSI extern bool cave_monster_teleportable_bold(MONSTER_IDX m_idx, POSITION y, POSITION x, BIT_FLAGS mode); extern bool cave_player_teleportable_bold(POSITION y, POSITION x, BIT_FLAGS mode); +extern void place_floor_grid(grid_type *g_ptr); +extern void place_extra_grid(grid_type *g_ptr); +extern void place_inner_grid(grid_type *g_ptr); +extern void place_inner_grid(grid_type *g_ptr); +extern void place_inner_perm_grid(grid_type *g_ptr); +extern void place_outer_grid(grid_type *g_ptr); +extern void place_outer_noperm_grid(grid_type *g_ptr); +extern void place_solid_perm_grid(grid_type *g_ptr); /*! * モンスターにより照明が消されている地形か否かを判定する。 / Is this grid "darkened" by monster?