OSDN Git Service

ダンジョンの主の配置コードを関数にまとめた. また, *破壊*等で消えた
[hengband/hengband.git] / src / generate.c
index b672561..7b9d444 100644 (file)
@@ -227,7 +227,7 @@ static void alloc_object(int set, int typ, int num)
                        if (!is_floor_grid(c_ptr) || c_ptr->o_idx || c_ptr->m_idx) continue;
 
                        /* Avoid player location */
-                       if (py == y && px == x) continue;
+                       if (player_bold(y, x)) continue;
 
                        /* Check for "room" */
                        room = (cave[y][x].info & CAVE_ROOM) ? TRUE : FALSE;
@@ -282,7 +282,7 @@ msg_print("
 
                        case ALLOC_TYP_OBJECT:
                        {
-                               place_object(y, x, FALSE, FALSE);
+                               place_object(y, x, 0L);
                                break;
                        }
                }
@@ -994,13 +994,13 @@ static bool cave_gen(void)
                cave_type *c_ptr = &cave[0][x];
 
                /* Set boundary mimic and add "solid" perma-wall */
-               c_ptr->mimic = f_info[c_ptr->feat].mimic;
+               c_ptr->mimic = bound_walls_perm ? 0 : f_info[c_ptr->feat].mimic;
                c_ptr->feat = FEAT_PERM_SOLID;
 
                c_ptr = &cave[cur_hgt - 1][x];
 
                /* Set boundary mimic and add "solid" perma-wall */
-               c_ptr->mimic = f_info[c_ptr->feat].mimic;
+               c_ptr->mimic = bound_walls_perm ? 0 : f_info[c_ptr->feat].mimic;
                c_ptr->feat = FEAT_PERM_SOLID;
        }
 
@@ -1010,13 +1010,13 @@ static bool cave_gen(void)
                cave_type *c_ptr = &cave[y][0];
 
                /* Set boundary mimic and add "solid" perma-wall */
-               c_ptr->mimic = f_info[c_ptr->feat].mimic;
+               c_ptr->mimic = bound_walls_perm ? 0 : f_info[c_ptr->feat].mimic;
                c_ptr->feat = FEAT_PERM_SOLID;
 
                c_ptr = &cave[y][cur_wid - 1];
 
                /* Set boundary mimic and add "solid" perma-wall */
-               c_ptr->mimic = f_info[c_ptr->feat].mimic;
+               c_ptr->mimic = bound_walls_perm ? 0 : f_info[c_ptr->feat].mimic;
                c_ptr->feat = FEAT_PERM_SOLID;
        }
 
@@ -1083,30 +1083,8 @@ msg_format("
                alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_GOLD, randnor(DUN_AMT_GOLD, 3));
        }
 
-       /* Put an Artifact and Artifact Guardian is requested */
-       if (d_info[dungeon_type].final_guardian && (d_info[dungeon_type].maxdepth == dun_level))
-       {
-               int oy;
-               int ox;
-               int try = 4000;
-
-               /* Find a good position */
-               while(try)
-               {
-                       /* Get a random spot */
-                       oy = randint1(cur_hgt - 4) + 2;
-                       ox = randint1(cur_wid - 4) + 2;
-
-                       /* Is it a good spot ? */
-                       if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[d_info[dungeon_type].final_guardian]))
-                       {
-                               /* Place the guardian */
-                               if (place_monster_aux(0, oy, ox, d_info[dungeon_type].final_guardian, (PM_ALLOW_GROUP | PM_NO_KAGE | PM_NO_PET))) break;
-                       }
-                       /* One less try */
-                       try--;
-               }
-       }
+       /* Put the Guardian */
+       (void)alloc_guardian();
 
        if (empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > dun_level)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
        {
@@ -1517,6 +1495,7 @@ void clear_cave(void)
        C_WIPE(m_list, m_max, monster_type);
        m_max = 1;
        m_cnt = 0;
+       precalc_cur_num_of_pet();
 
 
        /* Start with a blank cave */
@@ -1568,9 +1547,6 @@ void clear_cave(void)
 
        /* Nothing good here yet */
        rating = 0;
-
-       /* Fill the arrays of floors and walls in the good proportions */
-       set_floor_and_wall(0);
 }
 
 
@@ -1585,6 +1561,9 @@ void generate_cave(void)
 {
        int num;
 
+       /* Fill the arrays of floors and walls in the good proportions */
+       set_floor_and_wall(dungeon_type);
+
        /* Generate */
        for (num = 0; TRUE; num++)
        {
@@ -1600,14 +1579,14 @@ void generate_cave(void)
                /* Build the arena -KMW- */
                if (p_ptr->inside_arena)
                {
-                               /* Small arena */
+                       /* Small arena */
                        arena_gen();
                }
 
                /* Build the battle -KMW- */
                else if (p_ptr->inside_battle)
                {
-                               /* Small arena */
+                       /* Small arena */
                        battle_gen();
                }
 
@@ -1619,7 +1598,7 @@ void generate_cave(void)
                /* Build the town */
                else if (!dun_level)
                {
-                               /* Make the wilderness */
+                       /* Make the wilderness */
                        if (p_ptr->wild_mode) wilderness_gen_small();
                        else wilderness_gen();
                }
@@ -1711,8 +1690,8 @@ if (why) msg_format("
                wipe_m_list();
        }
 
-       /* Glow deep lava */
-       glow_deep_lava();
+       /* Glow deep lava and building entrances */
+       glow_deep_lava_and_bldg();
 
        /* Reset flag */
        p_ptr->enter_dungeon = FALSE;