OSDN Git Service

#37287 #37353 (2.2.0.89) 型の置換を継続中。 / Ongoing type replacement.
[hengband/hengband.git] / src / rooms.c
index 57e72a5..96b7c2c 100644 (file)
@@ -400,7 +400,7 @@ static bool find_space_aux(int blocks_high, int blocks_wide, int block_y, int bl
  * Return TRUE and values for the center of the room if all went well.\n
  * Otherwise, return FALSE.\n
  */
-static bool find_space(int *y, int *x, int height, int width)
+static bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width)
 {
        int candidates, pick;
        int by, bx, by1, bx1, by2, bx2;
@@ -521,8 +521,8 @@ static bool find_space(int *y, int *x, int height, int width)
  */
 static bool build_type1(void)
 {
-       int y, x, y2, x2, yval, xval;
-       int y1, x1, xsize, ysize;
+       POSITION y, x, y2, x2, yval, xval;
+       POSITION y1, x1, xsize, ysize;
 
        bool light;
 
@@ -716,9 +716,9 @@ static bool build_type1(void)
  */
 static bool build_type2(void)
 {
-       int                     y, x, xval, yval;
-       int                     y1a, x1a, y2a, x2a;
-       int                     y1b, x1b, y2b, x2b;
+       POSITION        y, x, xval, yval;
+       POSITION        y1a, x1a, y2a, x2a;
+       POSITION        y1b, x1b, y2b, x2b;
        bool            light;
        cave_type   *c_ptr;
 
@@ -840,10 +840,10 @@ static bool build_type2(void)
  */
 static bool build_type3(void)
 {
-       int                     y, x, dy, dx, wy, wx;
-       int                     y1a, x1a, y2a, x2a;
-       int                     y1b, x1b, y2b, x2b;
-       int                     yval, xval;
+       POSITION y, x, dy, dx, wy, wx;
+       POSITION y1a, x1a, y2a, x2a;
+       POSITION y1b, x1b, y2b, x2b;
+       POSITION yval, xval;
        bool            light;
        cave_type   *c_ptr;
 
@@ -1098,8 +1098,8 @@ static bool build_type3(void)
  */
 static bool build_type4(void)
 {
-       int         y, x, y1, x1;
-       int         y2, x2, tmp, yval, xval;
+       POSITION y, x, y1, x1;
+       POSITION y2, x2, tmp, yval, xval;
        bool        light;
        cave_type   *c_ptr;
 
@@ -1446,7 +1446,7 @@ static u32b vault_aux_dragon_mask4;
  * @param r_idx 確認したいモンスター種族ID
  * @return Vault生成の最低必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_simple(IDX r_idx)
+static bool vault_aux_simple(MONRACE_IDX r_idx)
 {
        /* Okay */
        return (vault_monster_okay(r_idx));
@@ -1459,7 +1459,7 @@ static bool vault_aux_simple(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_jelly(IDX r_idx)
+static bool vault_aux_jelly(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1484,7 +1484,7 @@ static bool vault_aux_jelly(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_animal(IDX r_idx)
+static bool vault_aux_animal(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1505,7 +1505,7 @@ static bool vault_aux_animal(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_undead(IDX r_idx)
+static bool vault_aux_undead(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1525,7 +1525,7 @@ static bool vault_aux_undead(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_chapel_g(IDX r_idx)
+static bool vault_aux_chapel_g(MONRACE_IDX r_idx)
 {
        static int chapel_list[] = {
                MON_NOV_PRIEST, MON_NOV_PALADIN, MON_NOV_PRIEST_G, MON_NOV_PALADIN_G, 
@@ -1559,7 +1559,7 @@ static bool vault_aux_chapel_g(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_kennel(IDX r_idx)
+static bool vault_aux_kennel(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1579,7 +1579,7 @@ static bool vault_aux_kennel(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_mimic(IDX r_idx)
+static bool vault_aux_mimic(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1599,7 +1599,7 @@ static bool vault_aux_mimic(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_clone(IDX r_idx)
+static bool vault_aux_clone(MONRACE_IDX r_idx)
 {
        /* Validate the monster */
        if (!vault_monster_okay(r_idx)) return (FALSE);
@@ -1614,7 +1614,7 @@ static bool vault_aux_clone(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_symbol_e(IDX r_idx)
+static bool vault_aux_symbol_e(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1639,7 +1639,7 @@ static bool vault_aux_symbol_e(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_symbol_g(IDX r_idx)
+static bool vault_aux_symbol_g(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1664,7 +1664,7 @@ static bool vault_aux_symbol_g(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_orc(IDX r_idx)
+static bool vault_aux_orc(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1688,7 +1688,7 @@ static bool vault_aux_orc(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_troll(IDX r_idx)
+static bool vault_aux_troll(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1712,7 +1712,7 @@ static bool vault_aux_troll(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_giant(IDX r_idx)
+static bool vault_aux_giant(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1738,7 +1738,7 @@ static bool vault_aux_giant(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_dragon(IDX r_idx)
+static bool vault_aux_dragon(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1765,7 +1765,7 @@ static bool vault_aux_dragon(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_demon(IDX r_idx)
+static bool vault_aux_demon(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1788,7 +1788,7 @@ static bool vault_aux_demon(IDX r_idx)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_cthulhu(IDX r_idx)
+static bool vault_aux_cthulhu(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -1828,7 +1828,7 @@ static void vault_prep_clone(void)
  */
 static void vault_prep_symbol(void)
 {
-       IDX r_idx;
+       MONRACE_IDX r_idx;
 
        /* Apply the monster restriction */
        get_mon_num_prep(vault_aux_simple, NULL);
@@ -1923,7 +1923,7 @@ static void vault_prep_dragon(void)
  * @param r_idx 確認したいモンスター種族ID
  * @return 生成必要条件を満たしているならTRUEを返す。
  */
-static bool vault_aux_dark_elf(IDX r_idx)
+static bool vault_aux_dark_elf(MONRACE_IDX r_idx)
 {
        int i;
        static int dark_elf_list[] =
@@ -1951,7 +1951,7 @@ typedef struct vault_aux_type vault_aux_type;
 struct vault_aux_type
 {
        cptr name;
-       bool (*hook_func)(IDX r_idx);
+       bool (*hook_func)(MONRACE_IDX r_idx);
        void (*prep_func)(void);
        int level;
        int chance;
@@ -2260,7 +2260,7 @@ static void ang_sort_swap_nest_mon_info(vptr u, vptr v, int a, int b)
  */
 static bool build_type5(void)
 {
-       int y, x, y1, x1, y2, x2, xval, yval;
+       POSITION y, x, y1, x1, y2, x2, xval, yval;
        int i;
        nest_mon_info_type nest_mon_info[NUM_NEST_MON_TYPE];
 
@@ -2287,7 +2287,8 @@ static bool build_type5(void)
        /* Pick some monster types */
        for (i = 0; i < NUM_NEST_MON_TYPE; i++)
        {
-               IDX r_idx = 0, attempts = 100;
+               MONRACE_IDX r_idx = 0;
+               int attempts = 100;
                monster_race *r_ptr = NULL;
 
                while (attempts--)
@@ -2397,7 +2398,7 @@ static bool build_type5(void)
        {
                for (x = xval - 9; x <= xval + 9; x++)
                {
-                       IDX r_idx;
+                       MONRACE_IDX r_idx;
 
                        i = randint0(NUM_NEST_MON_TYPE);
                        r_idx = nest_mon_info[i].r_idx;
@@ -2471,10 +2472,10 @@ static bool build_type5(void)
  */
 static bool build_type6(void)
 {
-       int y, x, y1, x1, y2, x2, xval, yval;
+       POSITION y, x, y1, x1, y2, x2, xval, yval;
        int i, j;
 
-       int what[16];
+       MONRACE_IDX what[16];
 
        monster_type align;
 
@@ -2499,7 +2500,8 @@ static bool build_type6(void)
        /* Pick some monster types */
        for (i = 0; i < 16; i++)
        {
-               IDX r_idx = 0, attempts = 100;
+               MONRACE_IDX r_idx = 0;
+               int attempts = 100;
                monster_race *r_ptr = NULL;
 
                while (attempts--)
@@ -2614,7 +2616,7 @@ static bool build_type6(void)
                        /* Bubble */
                        if (p1 > p2)
                        {
-                               int tmp = what[i1];
+                               MONRACE_IDX tmp = what[i1];
                                what[i1] = what[i2];
                                what[i2] = tmp;
                        }
@@ -2693,7 +2695,7 @@ static bool build_type6(void)
  * @param transno 処理ID
  * @return なし
  */
-static void coord_trans(int *x, int *y, int xoffset, int yoffset, int transno)
+static void coord_trans(POSITION *x, POSITION *y, POSITION xoffset, POSITION yoffset, int transno)
 {
        int i;
        int temp;
@@ -2738,16 +2740,13 @@ static void coord_trans(int *x, int *y, int xoffset, int yoffset, int transno)
  * @param transno 変換ID
  * @return なし
  */
-static void build_vault(int yval, int xval, int ymax, int xmax, cptr data,
-               int xoffset, int yoffset, int transno)
+static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xmax, cptr data,
+               POSITION xoffset, POSITION yoffset, int transno)
 {
-       int dx, dy, x, y, i, j;
-
+       POSITION dx, dy, x, y, i, j;
        cptr t;
-
        cave_type *c_ptr;
 
-
        /* Place dungeon features and objects */
        for (t = data, dy = 0; dy < ymax; dy++)
        {
@@ -3004,9 +3003,9 @@ static bool build_type7(void)
 {
        vault_type *v_ptr = NULL;
        int dummy;
-       int x, y;
-       int xval, yval;
-       int xoffset, yoffset;
+       POSITION x, y;
+       POSITION xval, yval;
+       POSITION xoffset, yoffset;
        int transno;
 
        /* Pick a lesser vault */
@@ -3085,8 +3084,8 @@ static bool build_type8(void)
 {
        vault_type *v_ptr;
        int dummy;
-       int xval, yval;
-       int x, y;
+       POSITION xval, yval;
+       POSITION x, y;
        int transno;
        int xoffset, yoffset;
 
@@ -3148,7 +3147,7 @@ static bool build_type8(void)
         * prevent generation of vaults with no-entrance.
         */
        /* Find and reserve some space in the dungeon.  Get center of room. */
-       if (!find_space(&yval, &xval, abs(y) + 2, abs(x) + 2)) return FALSE;
+       if (!find_space(&yval, &xval, (POSITION)(abs(y) + 2), (POSITION)(abs(x) + 2))) return FALSE;
 
 #ifdef FORCE_V_IDX
        v_ptr = &v_info[76 + randint1(3)];
@@ -3814,7 +3813,8 @@ static bool generate_fracave(int y0, int x0, int xsize, int ysize, int cutoff, b
  */
 static bool build_type9(void)
 {
-       int grd, roug, cutoff, xsize, ysize, y0, x0;
+       int grd, roug, cutoff;
+       POSITION xsize, ysize, y0, x0;
 
        bool done, light, room;
 
@@ -5453,7 +5453,7 @@ static void build_elemental_vault(int x0, int y0, int xsiz, int ysiz)
  */
 static bool build_type10(void)
 {
-       int y0, x0, xsize, ysize, vtype;
+       POSITION y0, x0, xsize, ysize, vtype;
 
        /* Get size */
        /* big enough to look good, small enough to be fairly common. */
@@ -5514,7 +5514,7 @@ static bool build_type10(void)
  */
 static bool build_type11(void)
 {
-       int rad, x, y, x0, y0;
+       POSITION rad, x, y, x0, y0;
        int light = FALSE;
 
        /* Occasional light */
@@ -5561,7 +5561,7 @@ static bool build_type11(void)
  */
 static bool build_type12(void)
 {
-       int rad, x, y, x0, y0;
+       POSITION rad, x, y, x0, y0;
        int light = FALSE;
        bool emptyflag = TRUE;
 
@@ -5651,7 +5651,7 @@ static bool build_type12(void)
 /*
  * Helper function for "trapped monster pit"
  */
-static bool vault_aux_trapped_pit(IDX r_idx)
+static bool vault_aux_trapped_pit(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -5742,10 +5742,10 @@ static bool build_type13(void)
                {0, 0, -1}
        };
 
-       int y, x, y1, x1, y2, x2, xval, yval;
+       POSITION y, x, y1, x1, y2, x2, xval, yval;
        int i, j;
 
-       int what[16];
+       MONRACE_IDX what[16];
 
        monster_type align;
 
@@ -5773,7 +5773,8 @@ static bool build_type13(void)
        /* Pick some monster types */
        for (i = 0; i < 16; i++)
        {
-               IDX r_idx = 0, attempts = 100;
+               MONRACE_IDX r_idx = 0;
+               int attempts = 100;
                monster_race *r_ptr = NULL;
 
                while (attempts--)
@@ -5917,7 +5918,7 @@ static bool build_type13(void)
                        /* Bubble */
                        if (p1 > p2)
                        {
-                               int tmp = what[i1];
+                               MONRACE_IDX tmp = what[i1];
                                what[i1] = what[i2];
                                what[i2] = tmp;
                        }
@@ -5959,8 +5960,8 @@ static bool build_type13(void)
  */
 static bool build_type14(void)
 {
-       int y, x, y2, x2, yval, xval;
-       int y1, x1, xsize, ysize;
+       POSITION y, x, y2, x2, yval, xval;
+       POSITION y1, x1, xsize, ysize;
 
        bool light;
 
@@ -6037,7 +6038,7 @@ static bool build_type14(void)
 /*
  * Helper function for "glass room"
  */
-static bool vault_aux_lite(IDX r_idx)
+static bool vault_aux_lite(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -6059,7 +6060,7 @@ static bool vault_aux_lite(IDX r_idx)
 /*
  * Helper function for "glass room"
  */
-static bool vault_aux_shards(IDX r_idx)
+static bool vault_aux_shards(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -6075,7 +6076,7 @@ static bool vault_aux_shards(IDX r_idx)
 /*
  * Hack -- determine if a template is potion
  */
-static bool kind_is_potion(int k_idx)
+static bool kind_is_potion(KIND_OBJECT_IDX k_idx)
 {
        return k_info[k_idx].tval == TV_POTION;
 }
@@ -6086,8 +6087,8 @@ static bool kind_is_potion(int k_idx)
  */
 static bool build_type15(void)
 {
-       int y, x, y2, x2, yval, xval;
-       int y1, x1, xsize, ysize;
+       POSITION y, x, y2, x2, yval, xval;
+       POSITION y1, x1, xsize, ysize;
        bool light;
 
        cave_type *c_ptr;
@@ -6153,7 +6154,7 @@ static bool build_type15(void)
                        /* Place fixed lite berathers */
                        for (dir1 = 4; dir1 < 8; dir1++)
                        {
-                               IDX r_idx = get_mon_num(dun_level);
+                               MONRACE_IDX r_idx = get_mon_num(dun_level);
 
                                y = yval + 2 * ddy_ddd[dir1];
                                x = xval + 2 * ddx_ddd[dir1];
@@ -6196,7 +6197,8 @@ static bool build_type15(void)
 
        case 2: /* 1 lite breather + random object */
                {
-                       IDX r_idx, dir1;
+                       MONRACE_IDX r_idx;
+                       DIRECTION dir1;
 
                        /* Pillars */
                        c_ptr = &cave[y1 + 1][x1 + 1];
@@ -6283,7 +6285,7 @@ static bool build_type15(void)
                        /* Place shard berathers */
                        for (dir1 = 4; dir1 < 8; dir1++)
                        {
-                               IDX r_idx = get_mon_num(dun_level);
+                               MONRACE_IDX r_idx = get_mon_num(dun_level);
 
                                y = yval + ddy_ddd[dir1];
                                x = xval + ddx_ddd[dir1];
@@ -6556,7 +6558,7 @@ static bool build_type16(void)
                STORE_ALCHEMIST, STORE_MAGIC, STORE_BLACK, STORE_BOOK,
        };
        int n = sizeof stores / sizeof (int);
-       int i, y, x, y1, x1, yval, xval;
+       POSITION i, y, x, y1, x1, yval, xval;
        int town_hgt = rand_range(MIN_TOWN_HGT, MAX_TOWN_HGT);
        int town_wid = rand_range(MIN_TOWN_WID, MAX_TOWN_WID);
        bool prevent_bm = FALSE;