OSDN Git Service

[Refactor] #38997 place_outer_perm_grid() を削除し、place_grid() に統合 / Removed place_outer...
[hengband/hengband.git] / src / rooms-pitnest.c
index 8290444..6f4d43b 100644 (file)
-#include "angband.h"\r
-#include "grid.h"\r
-#include "generate.h"\r
-#include "rooms.h"\r
-#include "rooms-pitnest.h"\r
-#include "monster-hook.h"\r
-\r
-\r
-\r
-#define NUM_NEST_MON_TYPE 64 /*!<nest\82Ì\8eí\95Ê\90\94 */\r
-\r
-/*! pit/nest\8c^\8fî\95ñ\82Ìtypedef */\r
-typedef struct vault_aux_type vault_aux_type;\r
-\r
-/*! pit/nest\8c^\8fî\95ñ\82Ì\8d\\91¢\91Ì\92è\8b` */\r
-struct vault_aux_type\r
-{\r
-       cptr name;\r
-       bool(*hook_func)(MONRACE_IDX r_idx);\r
-       void(*prep_func)(void);\r
-       int level;\r
-       int chance;\r
-};\r
-\r
-/*! nest\82ÌID\92è\8b` /  Nest types code */\r
-#define NEST_TYPE_CLONE        0\r
-#define NEST_TYPE_JELLY        1\r
-#define NEST_TYPE_SYMBOL_GOOD  2\r
-#define NEST_TYPE_SYMBOL_EVIL  3\r
-#define NEST_TYPE_MIMIC        4\r
-#define NEST_TYPE_LOVECRAFTIAN 5\r
-#define NEST_TYPE_KENNEL       6\r
-#define NEST_TYPE_ANIMAL       7\r
-#define NEST_TYPE_CHAPEL       8\r
-#define NEST_TYPE_UNDEAD       9\r
-\r
-/*! pit\82ÌID\92è\8b` / Pit types code */\r
-#define PIT_TYPE_ORC           0\r
-#define PIT_TYPE_TROLL         1\r
-#define PIT_TYPE_GIANT         2\r
-#define PIT_TYPE_LOVECRAFTIAN  3\r
-#define PIT_TYPE_SYMBOL_GOOD   4\r
-#define PIT_TYPE_SYMBOL_EVIL   5\r
-#define PIT_TYPE_CHAPEL        6\r
-#define PIT_TYPE_DRAGON        7\r
-#define PIT_TYPE_DEMON         8\r
-#define PIT_TYPE_DARK_ELF      9\r
-\r
-\r
-\r
-\r
-\r
-\r
-/*! \92Ê\8fípit\90\90¬\8e\9e\82Ì\83\82\83\93\83X\83^\81[\82Ì\8d\\90¬\8fð\8c\8fID / Race index for "monster pit (clone)" */\r
-static int vault_aux_race;\r
-\r
-/*! \92P\88ê\83V\83\93\83{\83\8bpit\90\90¬\8e\9e\82Ì\8ew\92è\83V\83\93\83{\83\8b / Race index for "monster pit (symbol clone)" */\r
-static char vault_aux_char;\r
-\r
-/*! \83u\83\8c\83X\91®\90«\82É\8aî\82Ã\82­\83h\83\89\83S\83\93pit\90\90¬\8e\9e\8fð\8c\8f\83}\83X\83N / Breath mask for "monster pit (dragon)" */\r
-static u32b vault_aux_dragon_mask4;\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ªVault\90\90¬\82Ì\8dÅ\92á\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper monster selection function\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return Vault\90\90¬\82Ì\8dÅ\92á\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_simple(MONRACE_IDX r_idx)\r
-{\r
-       /* Okay */\r
-       return (vault_monster_okay(r_idx));\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\83[\83\8a\81[nest\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster nest (jelly)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_jelly(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       if ((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW)) return (FALSE);\r
-\r
-       /* Also decline evil jellies (like death molds and shoggoths) */\r
-       if (r_ptr->flags3 & (RF3_EVIL)) return (FALSE);\r
-\r
-       /* Require icky thing, jelly, mold, or mushroom */\r
-       if (!my_strchr("ijm,", r_ptr->d_char)) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\93®\95¨nest\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster nest (animal)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_animal(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       /* Require "animal" flag */\r
-       if (!(r_ptr->flags3 & (RF3_ANIMAL))) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\83A\83\93\83f\83b\83hnest\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster nest (undead)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_undead(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       /* Require Undead */\r
-       if (!(r_ptr->flags3 & (RF3_UNDEAD))) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\90¹\93°nest\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster nest (chapel)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_chapel_g(MONRACE_IDX r_idx)\r
-{\r
-       static int chapel_list[] = {\r
-               MON_NOV_PRIEST, MON_NOV_PALADIN, MON_NOV_PRIEST_G, MON_NOV_PALADIN_G,\r
-               MON_PRIEST, MON_JADE_MONK, MON_IVORY_MONK, MON_ULTRA_PALADIN,\r
-               MON_EBONY_MONK, MON_W_KNIGHT, MON_KNI_TEMPLAR, MON_PALADIN,\r
-               MON_TOPAZ_MONK, 0 };\r
-\r
-       int i;\r
-\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       if (r_ptr->flags3 & (RF3_EVIL)) return (FALSE);\r
-       if ((r_idx == MON_A_GOLD) || (r_idx == MON_A_SILVER)) return (FALSE);\r
-\r
-       /* Require "priest" or Angel */\r
-\r
-       if (r_ptr->d_char == 'A') return TRUE;\r
-\r
-       for (i = 0; chapel_list[i]; i++)\r
-               if (r_idx == chapel_list[i]) return TRUE;\r
-\r
-       return FALSE;\r
-}\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\8c¢\8f¬\89®nest\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster nest (kennel)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_kennel(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       /* Require a Zephyr Hound or a dog */\r
-       if (!my_strchr("CZ", r_ptr->d_char)) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\83~\83~\83b\83Nnest\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster nest (mimic)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_mimic(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       /* Require mimic */\r
-       if (!my_strchr("!$&(/=?[\\|", r_ptr->d_char)) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\92P\88ê\83N\83\8d\81[\83\93nest\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster nest (clone)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_clone(MONRACE_IDX r_idx)\r
-{\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       return (r_idx == vault_aux_race);\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\8e×\88«\91®\90«\83V\83\93\83{\83\8b\83N\83\8d\81[\83\93nest\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster nest (symbol clone)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_symbol_e(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       if ((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW)) return (FALSE);\r
-\r
-       if (r_ptr->flags3 & (RF3_GOOD)) return (FALSE);\r
-\r
-       /* Decline incorrect symbol */\r
-       if (r_ptr->d_char != vault_aux_char) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\91P\97Ç\91®\90«\83V\83\93\83{\83\8b\83N\83\8d\81[\83\93nest\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster nest (symbol clone)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_symbol_g(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       if ((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW)) return (FALSE);\r
-\r
-       if (r_ptr->flags3 & (RF3_EVIL)) return (FALSE);\r
-\r
-       /* Decline incorrect symbol */\r
-       if (r_ptr->d_char != vault_aux_char) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\83I\81[\83Npit\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster pit (orc)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_orc(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       /* Require orc */\r
-       if (!(r_ptr->flags3 & RF3_ORC)) return (FALSE);\r
-\r
-       /* Decline undead */\r
-       if (r_ptr->flags3 & RF3_UNDEAD) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\83g\83\8d\83\8bpit\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster pit (troll)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_troll(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       /* Require troll */\r
-       if (!(r_ptr->flags3 & RF3_TROLL)) return (FALSE);\r
-\r
-       /* Decline undead */\r
-       if (r_ptr->flags3 & RF3_UNDEAD) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\8b\90\90lpit\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster pit (giant)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_giant(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       /* Require giant */\r
-       if (!(r_ptr->flags3 & RF3_GIANT)) return (FALSE);\r
-\r
-       if (r_ptr->flags3 & RF3_GOOD) return (FALSE);\r
-\r
-       /* Decline undead */\r
-       if (r_ptr->flags3 & RF3_UNDEAD) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\83h\83\89\83S\83\93pit\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster pit (dragon)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_dragon(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       /* Require dragon */\r
-       if (!(r_ptr->flags3 & RF3_DRAGON)) return (FALSE);\r
-\r
-       /* Hack -- Require correct "breath attack" */\r
-       if (r_ptr->flags4 != vault_aux_dragon_mask4) return (FALSE);\r
-\r
-       /* Decline undead */\r
-       if (r_ptr->flags3 & RF3_UNDEAD) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\88«\96\82pit\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster pit (demon)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_demon(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       if ((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW)) return (FALSE);\r
-\r
-       /* Require demon */\r
-       if (!(r_ptr->flags3 & RF3_DEMON)) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\8b\8bCpit\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster pit (lovecraftian)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_cthulhu(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       if ((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW)) return (FALSE);\r
-\r
-       /* Require eldritch horror */\r
-       if (!(r_ptr->flags2 & (RF2_ELDRITCH_HORROR))) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-\r
-/*!\r
-* @brief pit/nest\82Ì\8aî\8f\80\82Æ\82È\82é\92P\8eí\83\82\83\93\83X\83^\81[\82ð\8c\88\82ß\82é /\r
-* @return \82È\82µ\r
-*/\r
-static void vault_prep_clone(void)\r
-{\r
-       /* Apply the monster restriction */\r
-       get_mon_num_prep(vault_aux_simple, NULL);\r
-\r
-       /* Pick a race to clone */\r
-       vault_aux_race = get_mon_num(dun_level + 10);\r
-\r
-       /* Remove the monster restriction */\r
-       get_mon_num_prep(NULL, NULL);\r
-}\r
-\r
-\r
-/*!\r
-* @brief pit/nest\82Ì\8aî\8f\80\82Æ\82È\82é\83\82\83\93\83X\83^\81[\83V\83\93\83{\83\8b\82ð\8c\88\82ß\82é /\r
-* @return \82È\82µ\r
-*/\r
-static void vault_prep_symbol(void)\r
-{\r
-       MONRACE_IDX r_idx;\r
-\r
-       /* Apply the monster restriction */\r
-       get_mon_num_prep(vault_aux_simple, NULL);\r
-\r
-       /* Pick a race to clone */\r
-       r_idx = get_mon_num(dun_level + 10);\r
-\r
-       /* Remove the monster restriction */\r
-       get_mon_num_prep(NULL, NULL);\r
-\r
-       /* Extract the symbol */\r
-       vault_aux_char = r_info[r_idx].d_char;\r
-}\r
-\r
-/*!\r
-* @brief pit/nest\82Ì\8aî\8f\80\82Æ\82È\82é\83h\83\89\83S\83\93\82Ì\8eí\97Þ\82ð\8c\88\82ß\82é /\r
-* @return \82È\82µ\r
-*/\r
-static void vault_prep_dragon(void)\r
-{\r
-       /* Pick dragon type */\r
-       switch (randint0(6))\r
-       {\r
-               /* Black */\r
-       case 0:\r
-       {\r
-               /* Restrict dragon breath type */\r
-               vault_aux_dragon_mask4 = RF4_BR_ACID;\r
-\r
-               /* Done */\r
-               break;\r
-       }\r
-\r
-       /* Blue */\r
-       case 1:\r
-       {\r
-               /* Restrict dragon breath type */\r
-               vault_aux_dragon_mask4 = RF4_BR_ELEC;\r
-\r
-               /* Done */\r
-               break;\r
-       }\r
-\r
-       /* Red */\r
-       case 2:\r
-       {\r
-               /* Restrict dragon breath type */\r
-               vault_aux_dragon_mask4 = RF4_BR_FIRE;\r
-\r
-               /* Done */\r
-               break;\r
-       }\r
-\r
-       /* White */\r
-       case 3:\r
-       {\r
-               /* Restrict dragon breath type */\r
-               vault_aux_dragon_mask4 = RF4_BR_COLD;\r
-\r
-               /* Done */\r
-               break;\r
-       }\r
-\r
-       /* Green */\r
-       case 4:\r
-       {\r
-               /* Restrict dragon breath type */\r
-               vault_aux_dragon_mask4 = RF4_BR_POIS;\r
-\r
-               /* Done */\r
-               break;\r
-       }\r
-\r
-       /* Multi-hued */\r
-       default:\r
-       {\r
-               /* Restrict dragon breath type */\r
-               vault_aux_dragon_mask4 = (RF4_BR_ACID | RF4_BR_ELEC |\r
-                       RF4_BR_FIRE | RF4_BR_COLD |\r
-                       RF4_BR_POIS);\r
-\r
-               /* Done */\r
-               break;\r
-       }\r
-       }\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83\82\83\93\83X\83^\81[\82ª\83_\81[\83N\83G\83\8b\83tpit\82Ì\90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\82ð\95Ô\82· /\r
-* Helper function for "monster pit (dark elf)"\r
-* @param r_idx \8am\94F\82µ\82½\82¢\83\82\83\93\83X\83^\81[\8eí\91°ID\r
-* @return \90\90¬\95K\97v\8fð\8c\8f\82ð\96\9e\82½\82µ\82Ä\82¢\82é\82È\82çTRUE\82ð\95Ô\82·\81B\r
-*/\r
-static bool vault_aux_dark_elf(MONRACE_IDX r_idx)\r
-{\r
-       int i;\r
-       static int dark_elf_list[] =\r
-       {\r
-               MON_D_ELF, MON_D_ELF_MAGE, MON_D_ELF_WARRIOR, MON_D_ELF_PRIEST,\r
-               MON_D_ELF_LORD, MON_D_ELF_WARLOCK, MON_D_ELF_DRUID, MON_NIGHTBLADE,\r
-               MON_D_ELF_SORC, MON_D_ELF_SHADE, 0,\r
-       };\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return FALSE;\r
-\r
-       /* Require dark elves */\r
-       for (i = 0; dark_elf_list[i]; i++)\r
-               if (r_idx == dark_elf_list[i]) return TRUE;\r
-\r
-       /* Assume not */\r
-       return FALSE;\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83_\83\93\83W\83\87\83\93\96\88\82É\8ew\92è\82³\82ê\82½\83s\83b\83g\94z\97ñ\82ð\8aî\8f\80\82É\83\89\83\93\83_\83\80\82Èpit/nest\83^\83C\83v\82ð\8c\88\82ß\82é\r
-* @param l_ptr \91I\91ð\82³\82ê\82½pit/nest\8fî\95ñ\82ð\95Ô\82·\8eQ\8fÆ\83|\83C\83\93\83^\r
-* @param allow_flag_mask \90\90¬\82ª\8b\96\82³\82ê\82épit/nest\82Ì\83r\83b\83g\94z\97ñ\r
-* @return \91I\91ð\82³\82ê\82½pit/nest\82ÌID\81A\91I\91ð\8e¸\94s\82µ\82½\8fê\8d\87-1\82ð\95Ô\82·\81B\r
-*/\r
-static int pick_vault_type(vault_aux_type *l_ptr, s16b allow_flag_mask)\r
-{\r
-       int tmp, total, count;\r
-\r
-       vault_aux_type *n_ptr;\r
-\r
-       /* Calculate the total possibilities */\r
-       for (n_ptr = l_ptr, total = 0, count = 0; TRUE; n_ptr++, count++)\r
-       {\r
-               /* Note end */\r
-               if (!n_ptr->name) break;\r
-\r
-               /* Ignore excessive depth */\r
-               if (n_ptr->level > dun_level) continue;\r
-\r
-               /* Not matched with pit/nest flag */\r
-               if (!(allow_flag_mask & (1L << count))) continue;\r
-\r
-               /* Count this possibility */\r
-               total += n_ptr->chance * MAX_DEPTH / (MIN(dun_level, MAX_DEPTH - 1) - n_ptr->level + 5);\r
-       }\r
-\r
-       /* Pick a random type */\r
-       tmp = randint0(total);\r
-\r
-       /* Find this type */\r
-       for (n_ptr = l_ptr, total = 0, count = 0; TRUE; n_ptr++, count++)\r
-       {\r
-               /* Note end */\r
-               if (!n_ptr->name) break;\r
-\r
-               /* Ignore excessive depth */\r
-               if (n_ptr->level > dun_level) continue;\r
-\r
-               /* Not matched with pit/nest flag */\r
-               if (!(allow_flag_mask & (1L << count))) continue;\r
-\r
-               /* Count this possibility */\r
-               total += n_ptr->chance * MAX_DEPTH / (MIN(dun_level, MAX_DEPTH - 1) - n_ptr->level + 5);\r
-\r
-               /* Found the type */\r
-               if (tmp < total) break;\r
-       }\r
-\r
-       return n_ptr->name ? count : -1;\r
-}\r
-\r
-/*!\r
-* @brief \83f\83o\83b\83O\8e\9e\82É\90\90¬\82³\82ê\82½pit/nest\82Ì\8c^\82ð\8fo\97Í\82·\82é\8f\88\97\9d\r
-* @param type pit/nest\82Ì\8c^ID\r
-* @param nest TRUE\82È\82ç\82Înest\81AFALSE\82È\82ç\82Îpit\r
-* @return \83f\83o\83b\83O\95\\8e¦\95\8e\9a\97ñ\82Ì\8eQ\8fÆ\83|\83C\83\93\83^\r
-* @details\r
-* Hack -- Get the string describing subtype of pit/nest\r
-* Determined in prepare function (some pit/nest only)\r
-*/\r
-static cptr pit_subtype_string(int type, bool nest)\r
-{\r
-       static char inner_buf[256] = "";\r
-\r
-       inner_buf[0] = '\0'; /* Init string */\r
-\r
-       if (nest) /* Nests */\r
-       {\r
-               switch (type)\r
-               {\r
-               case NEST_TYPE_CLONE:\r
-                       sprintf(inner_buf, "(%s)", r_name + r_info[vault_aux_race].name);\r
-                       break;\r
-               case NEST_TYPE_SYMBOL_GOOD:\r
-               case NEST_TYPE_SYMBOL_EVIL:\r
-                       sprintf(inner_buf, "(%c)", vault_aux_char);\r
-                       break;\r
-               }\r
-       }\r
-       else /* Pits */\r
-       {\r
-               switch (type)\r
-               {\r
-               case PIT_TYPE_SYMBOL_GOOD:\r
-               case PIT_TYPE_SYMBOL_EVIL:\r
-                       sprintf(inner_buf, "(%c)", vault_aux_char);\r
-                       break;\r
-               case PIT_TYPE_DRAGON:\r
-                       switch (vault_aux_dragon_mask4)\r
-                       {\r
-#ifdef JP\r
-                       case RF4_BR_ACID: strcpy(inner_buf, "(\8e_)");   break;\r
-                       case RF4_BR_ELEC: strcpy(inner_buf, "(\88î\8dÈ)"); break;\r
-                       case RF4_BR_FIRE: strcpy(inner_buf, "(\89Î\89\8a)"); break;\r
-                       case RF4_BR_COLD: strcpy(inner_buf, "(\97â\8bC)"); break;\r
-                       case RF4_BR_POIS: strcpy(inner_buf, "(\93Å)");   break;\r
-                       case (RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | RF4_BR_COLD | RF4_BR_POIS) :\r
-                               strcpy(inner_buf, "(\96\9c\90F)"); break;\r
-                       default: strcpy(inner_buf, "(\96¢\92è\8b`)"); break;\r
-#else\r
-                       case RF4_BR_ACID: strcpy(inner_buf, "(acid)");      break;\r
-                       case RF4_BR_ELEC: strcpy(inner_buf, "(lightning)"); break;\r
-                       case RF4_BR_FIRE: strcpy(inner_buf, "(fire)");      break;\r
-                       case RF4_BR_COLD: strcpy(inner_buf, "(frost)");     break;\r
-                       case RF4_BR_POIS: strcpy(inner_buf, "(poison)");    break;\r
-                       case (RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | RF4_BR_COLD | RF4_BR_POIS) :\r
-                               strcpy(inner_buf, "(multi-hued)"); break;\r
-                       default: strcpy(inner_buf, "(undefined)"); break;\r
-#endif\r
-                       }\r
-                       break;\r
-               }\r
-       }\r
-\r
-       return inner_buf;\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-*! @brief nest\82Ì\83\82\83\93\83X\83^\81[\83\8a\83X\83g\82ð\83\\81[\83g\82·\82é\82½\82ß\82Ì\8aÖ\90\94 /\r
-*  Comp function for sorting nest monster information\r
-*  @param u \83\\81[\83g\8f\88\97\9d\91Î\8fÛ\94z\97ñ\83|\83C\83\93\83^\r
-*  @param v \96¢\8eg\97p\r
-*  @param a \94ä\8ar\91Î\8fÛ\8eQ\8fÆID1\r
-*  @param b \94ä\8ar\91Î\8fÛ\8eQ\8fÆID2\r
-*/\r
-static bool ang_sort_comp_nest_mon_info(vptr u, vptr v, int a, int b)\r
-{\r
-       nest_mon_info_type *nest_mon_info = (nest_mon_info_type *)u;\r
-       int w1 = nest_mon_info[a].r_idx;\r
-       int w2 = nest_mon_info[b].r_idx;\r
-       monster_race *r1_ptr = &r_info[w1];\r
-       monster_race *r2_ptr = &r_info[w2];\r
-       int z1, z2;\r
-\r
-       /* Unused */\r
-       (void)v;\r
-\r
-       /* Extract used info */\r
-       z1 = nest_mon_info[a].used;\r
-       z2 = nest_mon_info[b].used;\r
-\r
-       /* Compare used status */\r
-       if (z1 < z2) return FALSE;\r
-       if (z1 > z2) return TRUE;\r
-\r
-       /* Compare levels */\r
-       if (r1_ptr->level < r2_ptr->level) return TRUE;\r
-       if (r1_ptr->level > r2_ptr->level) return FALSE;\r
-\r
-       /* Compare experience */\r
-       if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;\r
-       if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;\r
-\r
-       /* Compare indexes */\r
-       return w1 <= w2;\r
-}\r
-\r
-/*!\r
-* @brief nest\82Ì\83\82\83\93\83X\83^\81[\83\8a\83X\83g\82ð\83X\83\8f\83b\83v\82·\82é\82½\82ß\82Ì\8aÖ\90\94 /\r
-* Swap function for sorting nest monster information\r
-* @param u \83X\83\8f\83b\83v\8f\88\97\9d\91Î\8fÛ\94z\97ñ\83|\83C\83\93\83^\r
-* @param v \96¢\8eg\97p\r
-* @param a \83X\83\8f\83b\83v\91Î\8fÛ\8eQ\8fÆID1\r
-* @param b \83X\83\8f\83b\83v\91Î\8fÛ\8eQ\8fÆID2\r
-*/\r
-static void ang_sort_swap_nest_mon_info(vptr u, vptr v, int a, int b)\r
-{\r
-       nest_mon_info_type *nest_mon_info = (nest_mon_info_type *)u;\r
-       nest_mon_info_type holder;\r
-\r
-       /* Unused */\r
-       (void)v;\r
-\r
-       /* Swap */\r
-       holder = nest_mon_info[a];\r
-       nest_mon_info[a] = nest_mon_info[b];\r
-       nest_mon_info[b] = holder;\r
-}\r
-\r
-\r
-\r
-/*!nest\8fî\95ñ\83e\81[\83u\83\8b*/\r
-static vault_aux_type nest_types[] =\r
-{\r
-#ifdef JP\r
-{ "\83N\83\8d\81[\83\93",     vault_aux_clone,    vault_prep_clone,   5, 3 },\r
-{ "\83[\83\8a\81[",       vault_aux_jelly,    NULL,               5, 6 },\r
-{ "\83V\83\93\83{\83\8b(\91P)", vault_aux_symbol_g, vault_prep_symbol, 25, 2 },\r
-{ "\83V\83\93\83{\83\8b(\88«)", vault_aux_symbol_e, vault_prep_symbol, 25, 2 },\r
-{ "\83~\83~\83b\83N",     vault_aux_mimic,    NULL,              30, 4 },\r
-{ "\8b\8bC",         vault_aux_cthulhu,  NULL,              70, 2 },\r
-{ "\8c¢\8f¬\89®",       vault_aux_kennel,   NULL,              45, 4 },\r
-{ "\93®\95¨\89\80",       vault_aux_animal,   NULL,              35, 5 },\r
-{ "\8b³\89ï",         vault_aux_chapel_g, NULL,              75, 4 },\r
-{ "\83A\83\93\83f\83b\83h",   vault_aux_undead,   NULL,              75, 5 },\r
-{ NULL,           NULL,               NULL,               0, 0 },\r
-#else\r
-{ "clone",        vault_aux_clone,    vault_prep_clone,   5, 3 },\r
-{ "jelly",        vault_aux_jelly,    NULL,               5, 6 },\r
-{ "symbol good",  vault_aux_symbol_g, vault_prep_symbol, 25, 2 },\r
-{ "symbol evil",  vault_aux_symbol_e, vault_prep_symbol, 25, 2 },\r
-{ "mimic",        vault_aux_mimic,    NULL,              30, 4 },\r
-{ "lovecraftian", vault_aux_cthulhu,  NULL,              70, 2 },\r
-{ "kennel",       vault_aux_kennel,   NULL,              45, 4 },\r
-{ "animal",       vault_aux_animal,   NULL,              35, 5 },\r
-{ "chapel",       vault_aux_chapel_g, NULL,              75, 4 },\r
-{ "undead",       vault_aux_undead,   NULL,              75, 5 },\r
-{ NULL,           NULL,               NULL,               0, 0 },\r
-#endif\r
-};\r
-\r
-/*!pit\8fî\95ñ\83e\81[\83u\83\8b*/\r
-static vault_aux_type pit_types[] =\r
-{\r
-#ifdef JP\r
-{ "\83I\81[\83N",       vault_aux_orc,      NULL,               5, 6 },\r
-{ "\83g\83\8d\83\8b",       vault_aux_troll,    NULL,              20, 6 },\r
-{ "\83W\83\83\83C\83A\83\93\83g", vault_aux_giant,    NULL,              50, 6 },\r
-{ "\8b\8bC",         vault_aux_cthulhu,  NULL,              80, 2 },\r
-{ "\83V\83\93\83{\83\8b(\91P)", vault_aux_symbol_g, vault_prep_symbol, 70, 1 },\r
-{ "\83V\83\93\83{\83\8b(\88«)", vault_aux_symbol_e, vault_prep_symbol, 70, 1 },\r
-{ "\8b³\89ï",         vault_aux_chapel_g, NULL,              65, 2 },\r
-{ "\83h\83\89\83S\83\93",     vault_aux_dragon,   vault_prep_dragon, 70, 6 },\r
-{ "\83f\81[\83\82\83\93",     vault_aux_demon,    NULL,              80, 6 },\r
-{ "\83_\81[\83N\83G\83\8b\83t", vault_aux_dark_elf, NULL,              45, 4 },\r
-{ NULL,           NULL,               NULL,               0, 0 },\r
-#else\r
-{ "orc",          vault_aux_orc,      NULL,               5, 6 },\r
-{ "troll",        vault_aux_troll,    NULL,              20, 6 },\r
-{ "giant",        vault_aux_giant,    NULL,              50, 6 },\r
-{ "lovecraftian", vault_aux_cthulhu,  NULL,              80, 2 },\r
-{ "symbol good",  vault_aux_symbol_g, vault_prep_symbol, 70, 1 },\r
-{ "symbol evil",  vault_aux_symbol_e, vault_prep_symbol, 70, 1 },\r
-{ "chapel",       vault_aux_chapel_g, NULL,              65, 2 },\r
-{ "dragon",       vault_aux_dragon,   vault_prep_dragon, 70, 6 },\r
-{ "demon",        vault_aux_demon,    NULL,              80, 6 },\r
-{ "dark elf",     vault_aux_dark_elf, NULL,              45, 4 },\r
-{ NULL,           NULL,               NULL,               0, 0 },\r
-#endif\r
-};\r
-\r
-\r
-\r
-\r
-/*!\r
-* @brief \83^\83C\83v5\82Ì\95\94\89®\81cnest\82ð\90\90¬\82·\82é / Type 5 -- Monster nests\r
-* @return \82È\82µ\r
-* @details\r
-* A monster nest is a "big" room, with an "inner" room, containing\n\r
-* a "collection" of monsters of a given type strewn about the room.\n\r
-*\n\r
-* The monsters are chosen from a set of 64 randomly selected monster\n\r
-* races, to allow the nest creation to fail instead of having "holes".\n\r
-*\n\r
-* Note the use of the "get_mon_num_prep()" function, and the special\n\r
-* "get_mon_num_hook()" restriction function, to prepare the "monster\n\r
-* allocation table" in such a way as to optimize the selection of\n\r
-* "appropriate" non-unique monsters for the nest.\n\r
-*\n\r
-* Note that the "get_mon_num()" function may (rarely) fail, in which\n\r
-* case the nest will be empty.\n\r
-*\n\r
-* Note that "monster nests" will never contain "unique" monsters.\n\r
-*/\r
-bool build_type5(void)\r
-{\r
-       POSITION y, x, y1, x1, y2, x2, xval, yval;\r
-       int i;\r
-       nest_mon_info_type nest_mon_info[NUM_NEST_MON_TYPE];\r
-\r
-       monster_type align;\r
-\r
-       cave_type *c_ptr;\r
-\r
-       int cur_nest_type = pick_vault_type(nest_types, d_info[dungeon_type].nest);\r
-       vault_aux_type *n_ptr;\r
-\r
-       /* No type available */\r
-       if (cur_nest_type < 0) return FALSE;\r
-\r
-       n_ptr = &nest_types[cur_nest_type];\r
-\r
-       /* Process a preparation function if necessary */\r
-       if (n_ptr->prep_func) (*(n_ptr->prep_func))();\r
-\r
-       /* Prepare allocation table */\r
-       get_mon_num_prep(n_ptr->hook_func, NULL);\r
-\r
-       align.sub_align = SUB_ALIGN_NEUTRAL;\r
-\r
-       /* Pick some monster types */\r
-       for (i = 0; i < NUM_NEST_MON_TYPE; i++)\r
-       {\r
-               MONRACE_IDX r_idx = 0;\r
-               int attempts = 100;\r
-               monster_race *r_ptr = NULL;\r
-\r
-               while (attempts--)\r
-               {\r
-                       /* Get a (hard) monster type */\r
-                       r_idx = get_mon_num(dun_level + 11);\r
-                       r_ptr = &r_info[r_idx];\r
-\r
-                       /* Decline incorrect alignment */\r
-                       if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;\r
-\r
-                       /* Accept this monster */\r
-                       break;\r
-               }\r
-\r
-               /* Notice failure */\r
-               if (!r_idx || !attempts) return FALSE;\r
-\r
-               /* Note the alignment */\r
-               if (r_ptr->flags3 & RF3_EVIL) align.sub_align |= SUB_ALIGN_EVIL;\r
-               if (r_ptr->flags3 & RF3_GOOD) align.sub_align |= SUB_ALIGN_GOOD;\r
-\r
-               nest_mon_info[i].r_idx = (s16b)r_idx;\r
-               nest_mon_info[i].used = FALSE;\r
-       }\r
-\r
-       /* Find and reserve some space in the dungeon.  Get center of room. */\r
-       if (!find_space(&yval, &xval, 11, 25)) return FALSE;\r
-\r
-       /* Large room */\r
-       y1 = yval - 4;\r
-       y2 = yval + 4;\r
-       x1 = xval - 11;\r
-       x2 = xval + 11;\r
-\r
-       /* Place the floor area */\r
-       for (y = y1 - 1; y <= y2 + 1; y++)\r
-       {\r
-               for (x = x1 - 1; x <= x2 + 1; x++)\r
-               {\r
-                       c_ptr = &cave[y][x];\r
-                       place_floor_grid(c_ptr);\r
-                       c_ptr->info |= (CAVE_ROOM);\r
-               }\r
-       }\r
-\r
-       /* Place the outer walls */\r
-       for (y = y1 - 1; y <= y2 + 1; y++)\r
-       {\r
-               c_ptr = &cave[y][x1 - 1];\r
-               place_outer_grid(c_ptr);\r
-               c_ptr = &cave[y][x2 + 1];\r
-               place_outer_grid(c_ptr);\r
-       }\r
-       for (x = x1 - 1; x <= x2 + 1; x++)\r
-       {\r
-               c_ptr = &cave[y1 - 1][x];\r
-               place_outer_grid(c_ptr);\r
-               c_ptr = &cave[y2 + 1][x];\r
-               place_outer_grid(c_ptr);\r
-       }\r
-\r
-\r
-       /* Advance to the center room */\r
-       y1 = y1 + 2;\r
-       y2 = y2 - 2;\r
-       x1 = x1 + 2;\r
-       x2 = x2 - 2;\r
-\r
-       /* The inner walls */\r
-       for (y = y1 - 1; y <= y2 + 1; y++)\r
-       {\r
-               c_ptr = &cave[y][x1 - 1];\r
-               place_inner_grid(c_ptr);\r
-               c_ptr = &cave[y][x2 + 1];\r
-               place_inner_grid(c_ptr);\r
-       }\r
-\r
-       for (x = x1 - 1; x <= x2 + 1; x++)\r
-       {\r
-               c_ptr = &cave[y1 - 1][x];\r
-               place_inner_grid(c_ptr);\r
-               c_ptr = &cave[y2 + 1][x];\r
-               place_inner_grid(c_ptr);\r
-       }\r
-       for (y = y1; y <= y2; y++)\r
-       {\r
-               for (x = x1; x <= x2; x++)\r
-               {\r
-                       add_cave_info(y, x, CAVE_ICKY);\r
-               }\r
-       }\r
-\r
-       /* Place a secret door */\r
-       switch (randint1(4))\r
-       {\r
-       case 1: place_secret_door(y1 - 1, xval, DOOR_DEFAULT); break;\r
-       case 2: place_secret_door(y2 + 1, xval, DOOR_DEFAULT); break;\r
-       case 3: place_secret_door(yval, x1 - 1, DOOR_DEFAULT); break;\r
-       case 4: place_secret_door(yval, x2 + 1, DOOR_DEFAULT); break;\r
-       }\r
-\r
-       msg_format_wizard(CHEAT_DUNGEON, _("\83\82\83\93\83X\83^\81[\95\94\89®(nest)(%s%s)\82ð\90\90¬\82µ\82Ü\82·\81B", "Monster nest (%s%s)"), n_ptr->name, pit_subtype_string(cur_nest_type, TRUE));\r
-\r
-       /* Place some monsters */\r
-       for (y = yval - 2; y <= yval + 2; y++)\r
-       {\r
-               for (x = xval - 9; x <= xval + 9; x++)\r
-               {\r
-                       MONRACE_IDX r_idx;\r
-\r
-                       i = randint0(NUM_NEST_MON_TYPE);\r
-                       r_idx = nest_mon_info[i].r_idx;\r
-\r
-                       /* Place that "random" monster (no groups) */\r
-                       (void)place_monster_aux(0, y, x, r_idx, 0L);\r
-\r
-                       nest_mon_info[i].used = TRUE;\r
-               }\r
-       }\r
-\r
-       if (cheat_room)\r
-       {\r
-               ang_sort_comp = ang_sort_comp_nest_mon_info;\r
-               ang_sort_swap = ang_sort_swap_nest_mon_info;\r
-               ang_sort(nest_mon_info, NULL, NUM_NEST_MON_TYPE);\r
-\r
-               /* Dump the entries (prevent multi-printing) */\r
-               for (i = 0; i < NUM_NEST_MON_TYPE; i++)\r
-               {\r
-                       if (!nest_mon_info[i].used) break;\r
-                       for (; i < NUM_NEST_MON_TYPE - 1; i++)\r
-                       {\r
-                               if (nest_mon_info[i].r_idx != nest_mon_info[i + 1].r_idx) break;\r
-                               if (!nest_mon_info[i + 1].used) break;\r
-                       }\r
-                       msg_format_wizard(CHEAT_DUNGEON, "Nest\8d\\90¬\83\82\83\93\83X\83^\81[No.%d:%s", i, r_name + r_info[nest_mon_info[i].r_idx].name);\r
-               }\r
-       }\r
-\r
-       return TRUE;\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83^\83C\83v6\82Ì\95\94\89®\81cpit\82ð\90\90¬\82·\82é / Type 6 -- Monster pits\r
-* @return \82È\82µ\r
-* @details\r
-* A monster pit is a "big" room, with an "inner" room, containing\n\r
-* a "collection" of monsters of a given type organized in the room.\n\r
-*\n\r
-* The inside room in a monster pit appears as shown below, where the\n\r
-* actual monsters in each location depend on the type of the pit\n\r
-*\n\r
-*   XXXXXXXXXXXXXXXXXXXXX\n\r
-*   X0000000000000000000X\n\r
-*   X0112233455543322110X\n\r
-*   X0112233467643322110X\n\r
-*   X0112233455543322110X\n\r
-*   X0000000000000000000X\n\r
-*   XXXXXXXXXXXXXXXXXXXXX\n\r
-*\n\r
-* Note that the monsters in the pit are now chosen by using "get_mon_num()"\n\r
-* to request 16 "appropriate" monsters, sorting them by level, and using\n\r
-* the "even" entries in this sorted list for the contents of the pit.\n\r
-*\n\r
-* Hack -- all of the "dragons" in a "dragon" pit must be the same "color",\n\r
-* which is handled by requiring a specific "breath" attack for all of the\n\r
-* dragons.  This may include "multi-hued" breath.  Note that "wyrms" may\n\r
-* be present in many of the dragon pits, if they have the proper breath.\n\r
-*\n\r
-* Note the use of the "get_mon_num_prep()" function, and the special\n\r
-* "get_mon_num_hook()" restriction function, to prepare the "monster\n\r
-* allocation table" in such a way as to optimize the selection of\n\r
-* "appropriate" non-unique monsters for the pit.\n\r
-*\n\r
-* Note that the "get_mon_num()" function may (rarely) fail, in which case\n\r
-* the pit will be empty.\n\r
-*\n\r
-* Note that "monster pits" will never contain "unique" monsters.\n\r
-*/\r
-bool build_type6(void)\r
-{\r
-       POSITION y, x, y1, x1, y2, x2, xval, yval;\r
-       int i, j;\r
-\r
-       MONRACE_IDX what[16];\r
-\r
-       monster_type align;\r
-\r
-       cave_type *c_ptr;\r
-\r
-       int cur_pit_type = pick_vault_type(pit_types, d_info[dungeon_type].pit);\r
-       vault_aux_type *n_ptr;\r
-\r
-       /* No type available */\r
-       if (cur_pit_type < 0) return FALSE;\r
-\r
-       n_ptr = &pit_types[cur_pit_type];\r
-\r
-       /* Process a preparation function if necessary */\r
-       if (n_ptr->prep_func) (*(n_ptr->prep_func))();\r
-\r
-       /* Prepare allocation table */\r
-       get_mon_num_prep(n_ptr->hook_func, NULL);\r
-\r
-       align.sub_align = SUB_ALIGN_NEUTRAL;\r
-\r
-       /* Pick some monster types */\r
-       for (i = 0; i < 16; i++)\r
-       {\r
-               MONRACE_IDX r_idx = 0;\r
-               int attempts = 100;\r
-               monster_race *r_ptr = NULL;\r
-\r
-               while (attempts--)\r
-               {\r
-                       /* Get a (hard) monster type */\r
-                       r_idx = get_mon_num(dun_level + 11);\r
-                       r_ptr = &r_info[r_idx];\r
-\r
-                       /* Decline incorrect alignment */\r
-                       if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;\r
-\r
-                       /* Accept this monster */\r
-                       break;\r
-               }\r
-\r
-               /* Notice failure */\r
-               if (!r_idx || !attempts) return FALSE;\r
-\r
-               /* Note the alignment */\r
-               if (r_ptr->flags3 & RF3_EVIL) align.sub_align |= SUB_ALIGN_EVIL;\r
-               if (r_ptr->flags3 & RF3_GOOD) align.sub_align |= SUB_ALIGN_GOOD;\r
-\r
-               what[i] = r_idx;\r
-       }\r
-\r
-       /* Find and reserve some space in the dungeon.  Get center of room. */\r
-       if (!find_space(&yval, &xval, 11, 25)) return FALSE;\r
-\r
-       /* Large room */\r
-       y1 = yval - 4;\r
-       y2 = yval + 4;\r
-       x1 = xval - 11;\r
-       x2 = xval + 11;\r
-\r
-       /* Place the floor area */\r
-       for (y = y1 - 1; y <= y2 + 1; y++)\r
-       {\r
-               for (x = x1 - 1; x <= x2 + 1; x++)\r
-               {\r
-                       c_ptr = &cave[y][x];\r
-                       place_floor_grid(c_ptr);\r
-                       c_ptr->info |= (CAVE_ROOM);\r
-               }\r
-       }\r
-\r
-       /* Place the outer walls */\r
-       for (y = y1 - 1; y <= y2 + 1; y++)\r
-       {\r
-               c_ptr = &cave[y][x1 - 1];\r
-               place_outer_grid(c_ptr);\r
-               c_ptr = &cave[y][x2 + 1];\r
-               place_outer_grid(c_ptr);\r
-       }\r
-       for (x = x1 - 1; x <= x2 + 1; x++)\r
-       {\r
-               c_ptr = &cave[y1 - 1][x];\r
-               place_outer_grid(c_ptr);\r
-               c_ptr = &cave[y2 + 1][x];\r
-               place_outer_grid(c_ptr);\r
-       }\r
-\r
-       /* Advance to the center room */\r
-       y1 = y1 + 2;\r
-       y2 = y2 - 2;\r
-       x1 = x1 + 2;\r
-       x2 = x2 - 2;\r
-\r
-       /* The inner walls */\r
-       for (y = y1 - 1; y <= y2 + 1; y++)\r
-       {\r
-               c_ptr = &cave[y][x1 - 1];\r
-               place_inner_grid(c_ptr);\r
-               c_ptr = &cave[y][x2 + 1];\r
-               place_inner_grid(c_ptr);\r
-       }\r
-       for (x = x1 - 1; x <= x2 + 1; x++)\r
-       {\r
-               c_ptr = &cave[y1 - 1][x];\r
-               place_inner_grid(c_ptr);\r
-               c_ptr = &cave[y2 + 1][x];\r
-               place_inner_grid(c_ptr);\r
-       }\r
-       for (y = y1; y <= y2; y++)\r
-       {\r
-               for (x = x1; x <= x2; x++)\r
-               {\r
-                       add_cave_info(y, x, CAVE_ICKY);\r
-               }\r
-       }\r
-\r
-       /* Place a secret door */\r
-       switch (randint1(4))\r
-       {\r
-       case 1: place_secret_door(y1 - 1, xval, DOOR_DEFAULT); break;\r
-       case 2: place_secret_door(y2 + 1, xval, DOOR_DEFAULT); break;\r
-       case 3: place_secret_door(yval, x1 - 1, DOOR_DEFAULT); break;\r
-       case 4: place_secret_door(yval, x2 + 1, DOOR_DEFAULT); break;\r
-       }\r
-\r
-       /* Sort the entries */\r
-       for (i = 0; i < 16 - 1; i++)\r
-       {\r
-               /* Sort the entries */\r
-               for (j = 0; j < 16 - 1; j++)\r
-               {\r
-                       int i1 = j;\r
-                       int i2 = j + 1;\r
-\r
-                       int p1 = r_info[what[i1]].level;\r
-                       int p2 = r_info[what[i2]].level;\r
-\r
-                       /* Bubble */\r
-                       if (p1 > p2)\r
-                       {\r
-                               MONRACE_IDX tmp = what[i1];\r
-                               what[i1] = what[i2];\r
-                               what[i2] = tmp;\r
-                       }\r
-               }\r
-       }\r
-\r
-       msg_format_wizard(CHEAT_DUNGEON, _("\83\82\83\93\83X\83^\81[\95\94\89®(pit)(%s%s)\82ð\90\90¬\82µ\82Ü\82·\81B", "Monster pit (%s%s)"), n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));\r
-\r
-       /* Select the entries */\r
-       for (i = 0; i < 8; i++)\r
-       {\r
-               /* Every other entry */\r
-               what[i] = what[i * 2];\r
-               msg_format_wizard(CHEAT_DUNGEON, _("Nest\8d\\90¬\83\82\83\93\83X\83^\81[\91I\91ðNo.%d:%s", "Nest Monster Select No.%d:%s"), i, r_name + r_info[what[i]].name);\r
-       }\r
-\r
-       /* Top and bottom rows */\r
-       for (x = xval - 9; x <= xval + 9; x++)\r
-       {\r
-               place_monster_aux(0, yval - 2, x, what[0], PM_NO_KAGE);\r
-               place_monster_aux(0, yval + 2, x, what[0], PM_NO_KAGE);\r
-       }\r
-\r
-       /* Middle columns */\r
-       for (y = yval - 1; y <= yval + 1; y++)\r
-       {\r
-               place_monster_aux(0, y, xval - 9, what[0], PM_NO_KAGE);\r
-               place_monster_aux(0, y, xval + 9, what[0], PM_NO_KAGE);\r
-\r
-               place_monster_aux(0, y, xval - 8, what[1], PM_NO_KAGE);\r
-               place_monster_aux(0, y, xval + 8, what[1], PM_NO_KAGE);\r
-\r
-               place_monster_aux(0, y, xval - 7, what[1], PM_NO_KAGE);\r
-               place_monster_aux(0, y, xval + 7, what[1], PM_NO_KAGE);\r
-\r
-               place_monster_aux(0, y, xval - 6, what[2], PM_NO_KAGE);\r
-               place_monster_aux(0, y, xval + 6, what[2], PM_NO_KAGE);\r
-\r
-               place_monster_aux(0, y, xval - 5, what[2], PM_NO_KAGE);\r
-               place_monster_aux(0, y, xval + 5, what[2], PM_NO_KAGE);\r
-\r
-               place_monster_aux(0, y, xval - 4, what[3], PM_NO_KAGE);\r
-               place_monster_aux(0, y, xval + 4, what[3], PM_NO_KAGE);\r
-\r
-               place_monster_aux(0, y, xval - 3, what[3], PM_NO_KAGE);\r
-               place_monster_aux(0, y, xval + 3, what[3], PM_NO_KAGE);\r
-\r
-               place_monster_aux(0, y, xval - 2, what[4], PM_NO_KAGE);\r
-               place_monster_aux(0, y, xval + 2, what[4], PM_NO_KAGE);\r
-       }\r
-\r
-       /* Above/Below the center monster */\r
-       for (x = xval - 1; x <= xval + 1; x++)\r
-       {\r
-               place_monster_aux(0, yval + 1, x, what[5], PM_NO_KAGE);\r
-               place_monster_aux(0, yval - 1, x, what[5], PM_NO_KAGE);\r
-       }\r
-\r
-       /* Next to the center monster */\r
-       place_monster_aux(0, yval, xval + 1, what[6], PM_NO_KAGE);\r
-       place_monster_aux(0, yval, xval - 1, what[6], PM_NO_KAGE);\r
-\r
-       /* Center monster */\r
-       place_monster_aux(0, yval, xval, what[7], PM_NO_KAGE);\r
-\r
-       return TRUE;\r
-}\r
-\r
-\r
-\r
-/*\r
-* Helper function for "trapped monster pit"\r
-*/\r
-static bool vault_aux_trapped_pit(MONRACE_IDX r_idx)\r
-{\r
-       monster_race *r_ptr = &r_info[r_idx];\r
-\r
-       /* Validate the monster */\r
-       if (!vault_monster_okay(r_idx)) return (FALSE);\r
-\r
-       /* No wall passing monster */\r
-       if (r_ptr->flags2 & (RF2_PASS_WALL | RF2_KILL_WALL)) return (FALSE);\r
-\r
-       /* Okay */\r
-       return (TRUE);\r
-}\r
-\r
-\r
-/*!\r
-* @brief \83^\83C\83v13\82Ì\95\94\89®\81c\83g\83\89\83b\83vpit\82Ì\90\90¬ / Type 13 -- Trapped monster pits\r
-* @return \82È\82µ\r
-* @details\r
-* A trapped monster pit is a "big" room with a straight corridor in\n\r
-* which wall opening traps are placed, and with two "inner" rooms\n\r
-* containing a "collection" of monsters of a given type organized in\n\r
-* the room.\n\r
-*\n\r
-* The trapped monster pit appears as shown below, where the actual\n\r
-* monsters in each location depend on the type of the pit\n\r
-*\n\r
-*  XXXXXXXXXXXXXXXXXXXXXXXXX\n\r
-*  X                       X\n\r
-*  XXXXXXXXXXXXXXXXXXXXXXX X\n\r
-*  XXXXX001123454321100XXX X\n\r
-*  XXX0012234567654322100X X\n\r
-*  XXXXXXXXXXXXXXXXXXXXXXX X\n\r
-*  X           ^           X\n\r
-*  X XXXXXXXXXXXXXXXXXXXXXXX\n\r
-*  X X0012234567654322100XXX\n\r
-*  X XXX001123454321100XXXXX\n\r
-*  X XXXXXXXXXXXXXXXXXXXXXXX\n\r
-*  X                       X\n\r
-*  XXXXXXXXXXXXXXXXXXXXXXXXX\n\r
-*\n\r
-* Note that the monsters in the pit are now chosen by using "get_mon_num()"\n\r
-* to request 16 "appropriate" monsters, sorting them by level, and using\n\r
-* the "even" entries in this sorted list for the contents of the pit.\n\r
-*\n\r
-* Hack -- all of the "dragons" in a "dragon" pit must be the same "color",\n\r
-* which is handled by requiring a specific "breath" attack for all of the\n\r
-* dragons.  This may include "multi-hued" breath.  Note that "wyrms" may\n\r
-* be present in many of the dragon pits, if they have the proper breath.\n\r
-*\n\r
-* Note the use of the "get_mon_num_prep()" function, and the special\n\r
-* "get_mon_num_hook()" restriction function, to prepare the "monster\n\r
-* allocation table" in such a way as to optimize the selection of\n\r
-* "appropriate" non-unique monsters for the pit.\n\r
-*\n\r
-* Note that the "get_mon_num()" function may (rarely) fail, in which case\n\r
-* the pit will be empty.\n\r
-*\n\r
-* Note that "monster pits" will never contain "unique" monsters.\n\r
-*/\r
-bool build_type13(void)\r
-{\r
-       static int placing[][3] = {\r
-               { -2, -9, 0 },{ -2, -8, 0 },{ -3, -7, 0 },{ -3, -6, 0 },\r
-               { +2, -9, 0 },{ +2, -8, 0 },{ +3, -7, 0 },{ +3, -6, 0 },\r
-               { -2, +9, 0 },{ -2, +8, 0 },{ -3, +7, 0 },{ -3, +6, 0 },\r
-               { +2, +9, 0 },{ +2, +8, 0 },{ +3, +7, 0 },{ +3, +6, 0 },\r
-               { -2, -7, 1 },{ -3, -5, 1 },{ -3, -4, 1 },\r
-               { +2, -7, 1 },{ +3, -5, 1 },{ +3, -4, 1 },\r
-               { -2, +7, 1 },{ -3, +5, 1 },{ -3, +4, 1 },\r
-               { +2, +7, 1 },{ +3, +5, 1 },{ +3, +4, 1 },\r
-               { -2, -6, 2 },{ -2, -5, 2 },{ -3, -3, 2 },\r
-               { +2, -6, 2 },{ +2, -5, 2 },{ +3, -3, 2 },\r
-               { -2, +6, 2 },{ -2, +5, 2 },{ -3, +3, 2 },\r
-               { +2, +6, 2 },{ +2, +5, 2 },{ +3, +3, 2 },\r
-               { -2, -4, 3 },{ -3, -2, 3 },\r
-               { +2, -4, 3 },{ +3, -2, 3 },\r
-               { -2, +4, 3 },{ -3, +2, 3 },\r
-               { +2, +4, 3 },{ +3, +2, 3 },\r
-               { -2, -3, 4 },{ -3, -1, 4 },\r
-               { +2, -3, 4 },{ +3, -1, 4 },\r
-               { -2, +3, 4 },{ -3, +1, 4 },\r
-               { +2, +3, 4 },{ +3, +1, 4 },\r
-               { -2, -2, 5 },{ -3, 0, 5 },{ -2, +2, 5 },\r
-               { +2, -2, 5 },{ +3, 0, 5 },{ +2, +2, 5 },\r
-               { -2, -1, 6 },{ -2, +1, 6 },\r
-               { +2, -1, 6 },{ +2, +1, 6 },\r
-               { -2, 0, 7 },{ +2, 0, 7 },\r
-               { 0, 0, -1 }\r
-       };\r
-\r
-       POSITION y, x, y1, x1, y2, x2, xval, yval;\r
-       int i, j;\r
-\r
-       MONRACE_IDX what[16];\r
-\r
-       monster_type align;\r
-\r
-       cave_type *c_ptr;\r
-\r
-       int cur_pit_type = pick_vault_type(pit_types, d_info[dungeon_type].pit);\r
-       vault_aux_type *n_ptr;\r
-\r
-       /* Only in Angband */\r
-       if (dungeon_type != DUNGEON_ANGBAND) return FALSE;\r
-\r
-       /* No type available */\r
-       if (cur_pit_type < 0) return FALSE;\r
-\r
-       n_ptr = &pit_types[cur_pit_type];\r
-\r
-       /* Process a preparation function if necessary */\r
-       if (n_ptr->prep_func) (*(n_ptr->prep_func))();\r
-\r
-       /* Prepare allocation table */\r
-       get_mon_num_prep(n_ptr->hook_func, vault_aux_trapped_pit);\r
-\r
-       align.sub_align = SUB_ALIGN_NEUTRAL;\r
-\r
-       /* Pick some monster types */\r
-       for (i = 0; i < 16; i++)\r
-       {\r
-               MONRACE_IDX r_idx = 0;\r
-               int attempts = 100;\r
-               monster_race *r_ptr = NULL;\r
-\r
-               while (attempts--)\r
-               {\r
-                       /* Get a (hard) monster type */\r
-                       r_idx = get_mon_num(dun_level + 0);\r
-                       r_ptr = &r_info[r_idx];\r
-\r
-                       /* Decline incorrect alignment */\r
-                       if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;\r
-\r
-                       /* Accept this monster */\r
-                       break;\r
-               }\r
-\r
-               /* Notice failure */\r
-               if (!r_idx || !attempts) return FALSE;\r
-\r
-               /* Note the alignment */\r
-               if (r_ptr->flags3 & RF3_EVIL) align.sub_align |= SUB_ALIGN_EVIL;\r
-               if (r_ptr->flags3 & RF3_GOOD) align.sub_align |= SUB_ALIGN_GOOD;\r
-\r
-               what[i] = r_idx;\r
-       }\r
-\r
-       /* Find and reserve some space in the dungeon.  Get center of room. */\r
-       if (!find_space(&yval, &xval, 13, 25)) return FALSE;\r
-\r
-       /* Large room */\r
-       y1 = yval - 5;\r
-       y2 = yval + 5;\r
-       x1 = xval - 11;\r
-       x2 = xval + 11;\r
-\r
-       /* Fill with inner walls */\r
-       for (y = y1 - 1; y <= y2 + 1; y++)\r
-       {\r
-               for (x = x1 - 1; x <= x2 + 1; x++)\r
-               {\r
-                       c_ptr = &cave[y][x];\r
-                       place_inner_grid(c_ptr);\r
-                       c_ptr->info |= (CAVE_ROOM);\r
-               }\r
-       }\r
-\r
-       /* Place the floor area 1 */\r
-       for (x = x1 + 3; x <= x2 - 3; x++)\r
-       {\r
-               c_ptr = &cave[yval - 2][x];\r
-               place_floor_grid(c_ptr);\r
-               add_cave_info(yval - 2, x, CAVE_ICKY);\r
-\r
-               c_ptr = &cave[yval + 2][x];\r
-               place_floor_grid(c_ptr);\r
-               add_cave_info(yval + 2, x, CAVE_ICKY);\r
-       }\r
-\r
-       /* Place the floor area 2 */\r
-       for (x = x1 + 5; x <= x2 - 5; x++)\r
-       {\r
-               c_ptr = &cave[yval - 3][x];\r
-               place_floor_grid(c_ptr);\r
-               add_cave_info(yval - 3, x, CAVE_ICKY);\r
-\r
-               c_ptr = &cave[yval + 3][x];\r
-               place_floor_grid(c_ptr);\r
-               add_cave_info(yval + 3, x, CAVE_ICKY);\r
-       }\r
-\r
-       /* Corridor */\r
-       for (x = x1; x <= x2; x++)\r
-       {\r
-               c_ptr = &cave[yval][x];\r
-               place_floor_grid(c_ptr);\r
-               c_ptr = &cave[y1][x];\r
-               place_floor_grid(c_ptr);\r
-               c_ptr = &cave[y2][x];\r
-               place_floor_grid(c_ptr);\r
-       }\r
-\r
-       /* Place the outer walls */\r
-       for (y = y1 - 1; y <= y2 + 1; y++)\r
-       {\r
-               c_ptr = &cave[y][x1 - 1];\r
-               place_outer_grid(c_ptr);\r
-               c_ptr = &cave[y][x2 + 1];\r
-               place_outer_grid(c_ptr);\r
-       }\r
-       for (x = x1 - 1; x <= x2 + 1; x++)\r
-       {\r
-               c_ptr = &cave[y1 - 1][x];\r
-               place_outer_grid(c_ptr);\r
-               c_ptr = &cave[y2 + 1][x];\r
-               place_outer_grid(c_ptr);\r
-       }\r
-\r
-       /* Random corridor */\r
-       if (one_in_(2))\r
-       {\r
-               for (y = y1; y <= yval; y++)\r
-               {\r
-                       place_floor_bold(y, x2);\r
-                       place_solid_bold(y, x1 - 1);\r
-               }\r
-               for (y = yval; y <= y2 + 1; y++)\r
-               {\r
-                       place_floor_bold(y, x1);\r
-                       place_solid_bold(y, x2 + 1);\r
-               }\r
-       }\r
-       else\r
-       {\r
-               for (y = yval; y <= y2 + 1; y++)\r
-               {\r
-                       place_floor_bold(y, x1);\r
-                       place_solid_bold(y, x2 + 1);\r
-               }\r
-               for (y = y1; y <= yval; y++)\r
-               {\r
-                       place_floor_bold(y, x2);\r
-                       place_solid_bold(y, x1 - 1);\r
-               }\r
-       }\r
-\r
-       /* Place the wall open trap */\r
-       cave[yval][xval].mimic = cave[yval][xval].feat;\r
-       cave[yval][xval].feat = feat_trap_open;\r
-\r
-       /* Sort the entries */\r
-       for (i = 0; i < 16 - 1; i++)\r
-       {\r
-               /* Sort the entries */\r
-               for (j = 0; j < 16 - 1; j++)\r
-               {\r
-                       int i1 = j;\r
-                       int i2 = j + 1;\r
-\r
-                       int p1 = r_info[what[i1]].level;\r
-                       int p2 = r_info[what[i2]].level;\r
-\r
-                       /* Bubble */\r
-                       if (p1 > p2)\r
-                       {\r
-                               MONRACE_IDX tmp = what[i1];\r
-                               what[i1] = what[i2];\r
-                               what[i2] = tmp;\r
-                       }\r
-               }\r
-       }\r
-\r
-       msg_format_wizard(CHEAT_DUNGEON, _("%s%s\82Ìã©\83s\83b\83g\82ª\90\90¬\82³\82ê\82Ü\82µ\82½\81B", "Trapped monster pit (%s%s)"),\r
-               n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));\r
-\r
-       /* Select the entries */\r
-       for (i = 0; i < 8; i++)\r
-       {\r
-               /* Every other entry */\r
-               what[i] = what[i * 2];\r
-\r
-               if (cheat_hear)\r
-               {\r
-                       /* Message */\r
-                       msg_print(r_name + r_info[what[i]].name);\r
-               }\r
-       }\r
-\r
-       for (i = 0; placing[i][2] >= 0; i++)\r
-       {\r
-               y = yval + placing[i][0];\r
-               x = xval + placing[i][1];\r
-               place_monster_aux(0, y, x, what[placing[i][2]], PM_NO_KAGE);\r
-       }\r
-\r
-       return TRUE;\r
-}\r
-\r
+#include "angband.h"
+#include "util.h"
+
+#include "grid.h"
+#include "floor-generate.h"
+#include "rooms.h"
+#include "rooms-pitnest.h"
+#include "monster.h"
+#include "monsterrace-hook.h"
+#include "sort.h"
+#include "floor.h"
+#include "feature.h"
+#include "dungeon.h"
+
+
+
+#define NUM_NEST_MON_TYPE 64 /*!<nestの種別数 */
+
+/*! pit/nest型情報のtypedef */
+typedef struct vault_aux_type vault_aux_type;
+
+/*! pit/nest型情報の構造体定義 */
+struct vault_aux_type
+{
+       concptr name;
+       bool(*hook_func)(MONRACE_IDX r_idx);
+       void(*prep_func)(player_type *player_ptr);
+       DEPTH level;
+       int chance;
+};
+
+/*! nestのID定義 /  Nest types code */
+#define NEST_TYPE_CLONE        0
+#define NEST_TYPE_JELLY        1
+#define NEST_TYPE_SYMBOL_GOOD  2
+#define NEST_TYPE_SYMBOL_EVIL  3
+#define NEST_TYPE_MIMIC        4
+#define NEST_TYPE_LOVECRAFTIAN 5
+#define NEST_TYPE_KENNEL       6
+#define NEST_TYPE_ANIMAL       7
+#define NEST_TYPE_CHAPEL       8
+#define NEST_TYPE_UNDEAD       9
+
+/*! pitのID定義 / Pit types code */
+#define PIT_TYPE_ORC           0
+#define PIT_TYPE_TROLL         1
+#define PIT_TYPE_GIANT         2
+#define PIT_TYPE_LOVECRAFTIAN  3
+#define PIT_TYPE_SYMBOL_GOOD   4
+#define PIT_TYPE_SYMBOL_EVIL   5
+#define PIT_TYPE_CHAPEL        6
+#define PIT_TYPE_DRAGON        7
+#define PIT_TYPE_DEMON         8
+#define PIT_TYPE_DARK_ELF      9
+
+
+/*!
+* @brief ダンジョン毎に指定されたピット配列を基準にランダムなpit/nestタイプを決める
+* @param l_ptr 選択されたpit/nest情報を返す参照ポインタ
+* @param allow_flag_mask 生成が許されるpit/nestのビット配列
+* @return 選択されたpit/nestのID、選択失敗した場合-1を返す。
+*/
+static int pick_vault_type(floor_type *floor_ptr, vault_aux_type *l_ptr, BIT_FLAGS16 allow_flag_mask)
+{
+       int tmp, total, count;
+
+       vault_aux_type *n_ptr;
+
+       /* Calculate the total possibilities */
+       for (n_ptr = l_ptr, total = 0, count = 0; TRUE; n_ptr++, count++)
+       {
+               /* Note end */
+               if (!n_ptr->name) break;
+
+               /* Ignore excessive depth */
+               if (n_ptr->level > floor_ptr->dun_level) continue;
+
+               /* Not matched with pit/nest flag */
+               if (!(allow_flag_mask & (1L << count))) continue;
+
+               /* Count this possibility */
+               total += n_ptr->chance * MAX_DEPTH / (MIN(floor_ptr->dun_level, MAX_DEPTH - 1) - n_ptr->level + 5);
+       }
+
+       /* Pick a random type */
+       tmp = randint0(total);
+
+       /* Find this type */
+       for (n_ptr = l_ptr, total = 0, count = 0; TRUE; n_ptr++, count++)
+       {
+               /* Note end */
+               if (!n_ptr->name) break;
+
+               /* Ignore excessive depth */
+               if (n_ptr->level > floor_ptr->dun_level) continue;
+
+               /* Not matched with pit/nest flag */
+               if (!(allow_flag_mask & (1L << count))) continue;
+
+               /* Count this possibility */
+               total += n_ptr->chance * MAX_DEPTH / (MIN(floor_ptr->dun_level, MAX_DEPTH - 1) - n_ptr->level + 5);
+
+               /* Found the type */
+               if (tmp < total) break;
+       }
+
+       return n_ptr->name ? count : -1;
+}
+
+/*!
+* @brief デバッグ時に生成されたpit/nestの型を出力する処理
+* @param type pit/nestの型ID
+* @param nest TRUEならばnest、FALSEならばpit
+* @return デバッグ表示文字列の参照ポインタ
+* @details
+* Hack -- Get the string describing subtype of pit/nest
+* Determined in prepare function (some pit/nest only)
+*/
+static concptr pit_subtype_string(int type, bool nest)
+{
+       static char inner_buf[256] = "";
+
+       inner_buf[0] = '\0'; /* Init string */
+
+       if (nest) /* Nests */
+       {
+               switch (type)
+               {
+               case NEST_TYPE_CLONE:
+                       sprintf(inner_buf, "(%s)", r_name + r_info[vault_aux_race].name);
+                       break;
+               case NEST_TYPE_SYMBOL_GOOD:
+               case NEST_TYPE_SYMBOL_EVIL:
+                       sprintf(inner_buf, "(%c)", vault_aux_char);
+                       break;
+               }
+       }
+       else /* Pits */
+       {
+               switch (type)
+               {
+               case PIT_TYPE_SYMBOL_GOOD:
+               case PIT_TYPE_SYMBOL_EVIL:
+                       sprintf(inner_buf, "(%c)", vault_aux_char);
+                       break;
+               case PIT_TYPE_DRAGON:
+                       switch (vault_aux_dragon_mask4)
+                       {
+                       case RF4_BR_ACID: strcpy(inner_buf, _("(酸)", "(acid)"));   break;
+                       case RF4_BR_ELEC: strcpy(inner_buf, _("(稲妻)", "(lightning)")); break;
+                       case RF4_BR_FIRE: strcpy(inner_buf, _("(火炎)", "(fire)")); break;
+                       case RF4_BR_COLD: strcpy(inner_buf, _("(冷気)", "(frost)")); break;
+                       case RF4_BR_POIS: strcpy(inner_buf, _("(毒)", "(poison)"));   break;
+                       case (RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | RF4_BR_COLD | RF4_BR_POIS) :
+                               strcpy(inner_buf, _("(万色)", "(multi-hued)")); break;
+                       default: strcpy(inner_buf, _("(未定義)", "(undefined)")); break;
+                       }
+                       break;
+               }
+       }
+
+       return inner_buf;
+}
+
+/*
+*! @brief nestのモンスターリストをソートするための関数 /
+*  Comp function for sorting nest monster information
+*  @param u ソート処理対象配列ポインタ
+*  @param v 未使用
+*  @param a 比較対象参照ID1
+*  @param b 比較対象参照ID2
+*  TODO: to sort.c
+*/
+static bool ang_sort_comp_nest_mon_info(vptr u, vptr v, int a, int b)
+{
+       nest_mon_info_type *nest_mon_info = (nest_mon_info_type *)u;
+       MONSTER_IDX w1 = nest_mon_info[a].r_idx;
+       MONSTER_IDX w2 = nest_mon_info[b].r_idx;
+       monster_race *r1_ptr = &r_info[w1];
+       monster_race *r2_ptr = &r_info[w2];
+       int z1, z2;
+
+       /* Unused */
+       (void)v;
+
+       /* Extract used info */
+       z1 = nest_mon_info[a].used;
+       z2 = nest_mon_info[b].used;
+
+       /* Compare used status */
+       if (z1 < z2) return FALSE;
+       if (z1 > z2) return TRUE;
+
+       /* Compare levels */
+       if (r1_ptr->level < r2_ptr->level) return TRUE;
+       if (r1_ptr->level > r2_ptr->level) return FALSE;
+
+       /* Compare experience */
+       if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
+       if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
+
+       /* Compare indexes */
+       return w1 <= w2;
+}
+
+/*!
+* @brief nestのモンスターリストをスワップするための関数 /
+* Swap function for sorting nest monster information
+* @param u スワップ処理対象配列ポインタ
+* @param v 未使用
+* @param a スワップ対象参照ID1
+* @param b スワップ対象参照ID2
+* TODO: to sort.c
+*/
+static void ang_sort_swap_nest_mon_info(vptr u, vptr v, int a, int b)
+{
+       nest_mon_info_type *nest_mon_info = (nest_mon_info_type *)u;
+       nest_mon_info_type holder;
+
+       /* Unused */
+       (void)v;
+
+       /* Swap */
+       holder = nest_mon_info[a];
+       nest_mon_info[a] = nest_mon_info[b];
+       nest_mon_info[b] = holder;
+}
+
+
+
+/*!nest情報テーブル*/
+static vault_aux_type nest_types[] =
+{
+       { _("クローン", "clone"),      vault_aux_clone,    vault_prep_clone,   5, 3 },
+       { _("ゼリー", "jelly"),        vault_aux_jelly,    NULL,               5, 6 },
+       { _("シンボル(善)", "symbol good"), vault_aux_symbol_g, vault_prep_symbol, 25, 2 },
+       { _("シンボル(悪)", "symbol evil"), vault_aux_symbol_e, vault_prep_symbol, 25, 2 },
+       { _("ミミック", "mimic"),      vault_aux_mimic,    NULL,              30, 4 },
+       { _("狂気", "lovecraftian"),   vault_aux_cthulhu,  NULL,              70, 2 },
+       { _("犬小屋", "kennel"),       vault_aux_kennel,   NULL,              45, 4 },
+       { _("動物園", "animal"),       vault_aux_animal,   NULL,              35, 5 },
+       { _("教会", "chapel"),         vault_aux_chapel_g, NULL,              75, 4 },
+       { _("アンデッド", "undead"),   vault_aux_undead,   NULL,              75, 5 },
+       { NULL,           NULL,               NULL,               0, 0 },
+};
+
+/*!pit情報テーブル*/
+static vault_aux_type pit_types[] =
+{
+       { _("オーク", "orc"),            vault_aux_orc,      NULL,               5, 6 },
+       { _("トロル", "troll"),          vault_aux_troll,    NULL,              20, 6 },
+       { _("巨人", "giant"),    vault_aux_giant,    NULL,              50, 6 },
+       { _("狂気", "lovecraftian"),     vault_aux_cthulhu,  NULL,              80, 2 },
+       { _("シンボル(善)", "symbol good"), vault_aux_symbol_g, vault_prep_symbol, 70, 1 },
+       { _("シンボル(悪)", "symbol evil"), vault_aux_symbol_e, vault_prep_symbol, 70, 1 },
+       { _("教会", "chapel"),           vault_aux_chapel_g, NULL,              65, 2 },
+       { _("ドラゴン", "dragon"),       vault_aux_dragon,   vault_prep_dragon, 70, 6 },
+       { _("デーモン", "demon"),        vault_aux_demon,    NULL,              80, 6 },
+       { _("ダークエルフ", "dark elf"), vault_aux_dark_elf, NULL,              45, 4 },
+       { NULL,           NULL,               NULL,               0, 0 },
+};
+
+
+
+
+/*!
+* @brief タイプ5の部屋…nestを生成する / Type 5 -- Monster nests
+* @param player_ptr プレーヤーへの参照ポインタ
+* @return なし
+* @details
+* A monster nest is a "big" room, with an "inner" room, containing\n
+* a "collection" of monsters of a given type strewn about the room.\n
+*\n
+* The monsters are chosen from a set of 64 randomly selected monster\n
+* races, to allow the nest creation to fail instead of having "holes".\n
+*\n
+* Note the use of the "get_mon_num_prep()" function, and the special\n
+* "get_mon_num_hook()" restriction function, to prepare the "monster\n
+* allocation table" in such a way as to optimize the selection of\n
+* "appropriate" non-unique monsters for the nest.\n
+*\n
+* Note that the "get_mon_num()" function may (rarely) fail, in which\n
+* case the nest will be empty.\n
+*\n
+* Note that "monster nests" will never contain "unique" monsters.\n
+*/
+bool build_type5(player_type *player_ptr)
+{
+       POSITION y, x, y1, x1, y2, x2, xval, yval;
+       int i;
+       nest_mon_info_type nest_mon_info[NUM_NEST_MON_TYPE];
+
+       monster_type align;
+
+       grid_type *g_ptr;
+
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
+       int cur_nest_type = pick_vault_type(floor_ptr, nest_types, d_info[floor_ptr->dungeon_idx].nest);
+       vault_aux_type *n_ptr;
+
+       /* No type available */
+       if (cur_nest_type < 0) return FALSE;
+
+       n_ptr = &nest_types[cur_nest_type];
+
+       /* Process a preparation function if necessary */
+       if (n_ptr->prep_func) (*(n_ptr->prep_func))(player_ptr);
+       get_mon_num_prep(player_ptr, n_ptr->hook_func, NULL);
+
+       align.sub_align = SUB_ALIGN_NEUTRAL;
+
+       /* Pick some monster types */
+       for (i = 0; i < NUM_NEST_MON_TYPE; i++)
+       {
+               MONRACE_IDX r_idx = 0;
+               int attempts = 100;
+               monster_race *r_ptr = NULL;
+
+               while (attempts--)
+               {
+                       /* Get a (hard) monster type */
+                       r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11);
+                       r_ptr = &r_info[r_idx];
+
+                       /* Decline incorrect alignment */
+                       if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;
+
+                       /* Accept this monster */
+                       break;
+               }
+
+               /* Notice failure */
+               if (!r_idx || !attempts) return FALSE;
+
+               /* Note the alignment */
+               if (r_ptr->flags3 & RF3_EVIL) align.sub_align |= SUB_ALIGN_EVIL;
+               if (r_ptr->flags3 & RF3_GOOD) align.sub_align |= SUB_ALIGN_GOOD;
+
+               nest_mon_info[i].r_idx = (s16b)r_idx;
+               nest_mon_info[i].used = FALSE;
+       }
+
+       /* Find and reserve some space in the dungeon.  Get center of room. */
+       if (!find_space(floor_ptr, &yval, &xval, 11, 25)) return FALSE;
+
+       /* Large room */
+       y1 = yval - 4;
+       y2 = yval + 4;
+       x1 = xval - 11;
+       x2 = xval + 11;
+
+       /* Place the floor area */
+       for (y = y1 - 1; y <= y2 + 1; y++)
+       {
+               for (x = x1 - 1; x <= x2 + 1; x++)
+               {
+                       g_ptr = &floor_ptr->grid_array[y][x];
+                       place_grid(g_ptr, floor);
+                       g_ptr->info |= (CAVE_ROOM);
+               }
+       }
+
+       /* Place the outer walls */
+       for (y = y1 - 1; y <= y2 + 1; y++)
+       {
+               g_ptr = &floor_ptr->grid_array[y][x1 - 1];
+               place_grid(g_ptr, outer);
+               g_ptr = &floor_ptr->grid_array[y][x2 + 1];
+               place_grid(g_ptr, outer);
+       }
+       for (x = x1 - 1; x <= x2 + 1; x++)
+       {
+               g_ptr = &floor_ptr->grid_array[y1 - 1][x];
+               place_grid(g_ptr, outer);
+               g_ptr = &floor_ptr->grid_array[y2 + 1][x];
+               place_grid(g_ptr, outer);
+       }
+
+
+       /* Advance to the center room */
+       y1 = y1 + 2;
+       y2 = y2 - 2;
+       x1 = x1 + 2;
+       x2 = x2 - 2;
+
+       /* The inner walls */
+       for (y = y1 - 1; y <= y2 + 1; y++)
+       {
+               g_ptr = &floor_ptr->grid_array[y][x1 - 1];
+               place_grid(g_ptr, inner);
+               g_ptr = &floor_ptr->grid_array[y][x2 + 1];
+               place_grid(g_ptr, inner);
+       }
+
+       for (x = x1 - 1; x <= x2 + 1; x++)
+       {
+               g_ptr = &floor_ptr->grid_array[y1 - 1][x];
+               place_grid(g_ptr, inner);
+               g_ptr = &floor_ptr->grid_array[y2 + 1][x];
+               place_grid(g_ptr, inner);
+       }
+       for (y = y1; y <= y2; y++)
+       {
+               for (x = x1; x <= x2; x++)
+               {
+                       add_cave_info(floor_ptr, y, x, CAVE_ICKY);
+               }
+       }
+
+       /* Place a secret door */
+       switch (randint1(4))
+       {
+       case 1: place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
+       case 2: place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
+       case 3: place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
+       case 4: place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
+       }
+
+       msg_format_wizard(CHEAT_DUNGEON, _("モンスター部屋(nest)(%s%s)を生成します。", "Monster nest (%s%s)"), n_ptr->name, pit_subtype_string(cur_nest_type, TRUE));
+
+       /* Place some monsters */
+       for (y = yval - 2; y <= yval + 2; y++)
+       {
+               for (x = xval - 9; x <= xval + 9; x++)
+               {
+                       MONRACE_IDX r_idx;
+
+                       i = randint0(NUM_NEST_MON_TYPE);
+                       r_idx = nest_mon_info[i].r_idx;
+
+                       /* Place that "random" monster (no groups) */
+                       (void)place_monster_aux(player_ptr, 0, y, x, r_idx, 0L);
+
+                       nest_mon_info[i].used = TRUE;
+               }
+       }
+
+       if (cheat_room)
+       {
+               ang_sort(nest_mon_info, NULL, NUM_NEST_MON_TYPE, ang_sort_comp_nest_mon_info, ang_sort_swap_nest_mon_info);
+
+               /* Dump the entries (prevent multi-printing) */
+               for (i = 0; i < NUM_NEST_MON_TYPE; i++)
+               {
+                       if (!nest_mon_info[i].used) break;
+                       for (; i < NUM_NEST_MON_TYPE - 1; i++)
+                       {
+                               if (nest_mon_info[i].r_idx != nest_mon_info[i + 1].r_idx) break;
+                               if (!nest_mon_info[i + 1].used) break;
+                       }
+                       msg_format_wizard(CHEAT_DUNGEON, "Nest構成モンスターNo.%d:%s", i, r_name + r_info[nest_mon_info[i].r_idx].name);
+               }
+       }
+
+       return TRUE;
+}
+
+
+/*!
+* @brief タイプ6の部屋…pitを生成する / Type 6 -- Monster pits
+* @return なし
+* @details
+* A monster pit is a "big" room, with an "inner" room, containing\n
+* a "collection" of monsters of a given type organized in the room.\n
+*\n
+* The inside room in a monster pit appears as shown below, where the\n
+* actual monsters in each location depend on the type of the pit\n
+*\n
+*   XXXXXXXXXXXXXXXXXXXXX\n
+*   X0000000000000000000X\n
+*   X0112233455543322110X\n
+*   X0112233467643322110X\n
+*   X0112233455543322110X\n
+*   X0000000000000000000X\n
+*   XXXXXXXXXXXXXXXXXXXXX\n
+*\n
+* Note that the monsters in the pit are now chosen by using "get_mon_num()"\n
+* to request 16 "appropriate" monsters, sorting them by level, and using\n
+* the "even" entries in this sorted list for the contents of the pit.\n
+*\n
+* Hack -- all of the "dragons" in a "dragon" pit must be the same "color",\n
+* which is handled by requiring a specific "breath" attack for all of the\n
+* dragons.  This may include "multi-hued" breath.  Note that "wyrms" may\n
+* be present in many of the dragon pits, if they have the proper breath.\n
+*\n
+* Note the use of the "get_mon_num_prep()" function, and the special\n
+* "get_mon_num_hook()" restriction function, to prepare the "monster\n
+* allocation table" in such a way as to optimize the selection of\n
+* "appropriate" non-unique monsters for the pit.\n
+*\n
+* Note that the "get_mon_num()" function may (rarely) fail, in which case\n
+* the pit will be empty.\n
+*\n
+* Note that "monster pits" will never contain "unique" monsters.\n
+*/
+bool build_type6(player_type *player_ptr)
+{
+       POSITION y, x, y1, x1, y2, x2, xval, yval;
+       int i, j;
+
+       MONRACE_IDX what[16];
+
+       monster_type align;
+
+       grid_type *g_ptr;
+
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
+       int cur_pit_type = pick_vault_type(floor_ptr, pit_types, d_info[floor_ptr->dungeon_idx].pit);
+       vault_aux_type *n_ptr;
+
+       /* No type available */
+       if (cur_pit_type < 0) return FALSE;
+
+       n_ptr = &pit_types[cur_pit_type];
+
+       /* Process a preparation function if necessary */
+       if (n_ptr->prep_func) (*(n_ptr->prep_func))(player_ptr);
+       get_mon_num_prep(player_ptr, n_ptr->hook_func, NULL);
+
+       align.sub_align = SUB_ALIGN_NEUTRAL;
+
+       /* Pick some monster types */
+       for (i = 0; i < 16; i++)
+       {
+               MONRACE_IDX r_idx = 0;
+               int attempts = 100;
+               monster_race *r_ptr = NULL;
+
+               while (attempts--)
+               {
+                       /* Get a (hard) monster type */
+                       r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11);
+                       r_ptr = &r_info[r_idx];
+
+                       /* Decline incorrect alignment */
+                       if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;
+
+                       /* Accept this monster */
+                       break;
+               }
+
+               /* Notice failure */
+               if (!r_idx || !attempts) return FALSE;
+
+               /* Note the alignment */
+               if (r_ptr->flags3 & RF3_EVIL) align.sub_align |= SUB_ALIGN_EVIL;
+               if (r_ptr->flags3 & RF3_GOOD) align.sub_align |= SUB_ALIGN_GOOD;
+
+               what[i] = r_idx;
+       }
+
+       /* Find and reserve some space in the dungeon.  Get center of room. */
+       if (!find_space(floor_ptr, &yval, &xval, 11, 25)) return FALSE;
+
+       /* Large room */
+       y1 = yval - 4;
+       y2 = yval + 4;
+       x1 = xval - 11;
+       x2 = xval + 11;
+
+       /* Place the floor area */
+       for (y = y1 - 1; y <= y2 + 1; y++)
+       {
+               for (x = x1 - 1; x <= x2 + 1; x++)
+               {
+                       g_ptr = &floor_ptr->grid_array[y][x];
+                       place_grid(g_ptr, floor);
+                       g_ptr->info |= (CAVE_ROOM);
+               }
+       }
+
+       /* Place the outer walls */
+       for (y = y1 - 1; y <= y2 + 1; y++)
+       {
+               g_ptr = &floor_ptr->grid_array[y][x1 - 1];
+               place_grid(g_ptr, outer);
+               g_ptr = &floor_ptr->grid_array[y][x2 + 1];
+               place_grid(g_ptr, outer);
+       }
+       for (x = x1 - 1; x <= x2 + 1; x++)
+       {
+               g_ptr = &floor_ptr->grid_array[y1 - 1][x];
+               place_grid(g_ptr, outer);
+               g_ptr = &floor_ptr->grid_array[y2 + 1][x];
+               place_grid(g_ptr, outer);
+       }
+
+       /* Advance to the center room */
+       y1 = y1 + 2;
+       y2 = y2 - 2;
+       x1 = x1 + 2;
+       x2 = x2 - 2;
+
+       /* The inner walls */
+       for (y = y1 - 1; y <= y2 + 1; y++)
+       {
+               g_ptr = &floor_ptr->grid_array[y][x1 - 1];
+               place_grid(g_ptr, inner);
+               g_ptr = &floor_ptr->grid_array[y][x2 + 1];
+               place_grid(g_ptr, inner);
+       }
+       for (x = x1 - 1; x <= x2 + 1; x++)
+       {
+               g_ptr = &floor_ptr->grid_array[y1 - 1][x];
+               place_grid(g_ptr, inner);
+               g_ptr = &floor_ptr->grid_array[y2 + 1][x];
+               place_grid(g_ptr, inner);
+       }
+       for (y = y1; y <= y2; y++)
+       {
+               for (x = x1; x <= x2; x++)
+               {
+                       add_cave_info(floor_ptr, y, x, CAVE_ICKY);
+               }
+       }
+
+       /* Place a secret door */
+       switch (randint1(4))
+       {
+       case 1: place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
+       case 2: place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
+       case 3: place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
+       case 4: place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
+       }
+
+       /* Sort the entries */
+       for (i = 0; i < 16 - 1; i++)
+       {
+               /* Sort the entries */
+               for (j = 0; j < 16 - 1; j++)
+               {
+                       int i1 = j;
+                       int i2 = j + 1;
+
+                       int p1 = r_info[what[i1]].level;
+                       int p2 = r_info[what[i2]].level;
+
+                       /* Bubble */
+                       if (p1 > p2)
+                       {
+                               MONRACE_IDX tmp = what[i1];
+                               what[i1] = what[i2];
+                               what[i2] = tmp;
+                       }
+               }
+       }
+
+       msg_format_wizard(CHEAT_DUNGEON, _("モンスター部屋(pit)(%s%s)を生成します。", "Monster pit (%s%s)"), n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
+
+       /* Select the entries */
+       for (i = 0; i < 8; i++)
+       {
+               /* Every other entry */
+               what[i] = what[i * 2];
+               msg_format_wizard(CHEAT_DUNGEON, _("Nest構成モンスター選択No.%d:%s", "Nest Monster Select No.%d:%s"), i, r_name + r_info[what[i]].name);
+       }
+
+       /* Top and bottom rows */
+       for (x = xval - 9; x <= xval + 9; x++)
+       {
+               place_monster_aux(player_ptr, 0, yval - 2, x, what[0], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, yval + 2, x, what[0], PM_NO_KAGE);
+       }
+
+       /* Middle columns */
+       for (y = yval - 1; y <= yval + 1; y++)
+       {
+               place_monster_aux(player_ptr, 0, y, xval - 9, what[0], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 9, what[0], PM_NO_KAGE);
+
+               place_monster_aux(player_ptr, 0, y, xval - 8, what[1], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 8, what[1], PM_NO_KAGE);
+
+               place_monster_aux(player_ptr, 0, y, xval - 7, what[1], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 7, what[1], PM_NO_KAGE);
+
+               place_monster_aux(player_ptr, 0, y, xval - 6, what[2], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 6, what[2], PM_NO_KAGE);
+
+               place_monster_aux(player_ptr, 0, y, xval - 5, what[2], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 5, what[2], PM_NO_KAGE);
+
+               place_monster_aux(player_ptr, 0, y, xval - 4, what[3], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 4, what[3], PM_NO_KAGE);
+
+               place_monster_aux(player_ptr, 0, y, xval - 3, what[3], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 3, what[3], PM_NO_KAGE);
+
+               place_monster_aux(player_ptr, 0, y, xval - 2, what[4], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 2, what[4], PM_NO_KAGE);
+       }
+
+       /* Above/Below the center monster */
+       for (x = xval - 1; x <= xval + 1; x++)
+       {
+               place_monster_aux(player_ptr, 0, yval + 1, x, what[5], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, yval - 1, x, what[5], PM_NO_KAGE);
+       }
+
+       /* Next to the center monster */
+       place_monster_aux(player_ptr, 0, yval, xval + 1, what[6], PM_NO_KAGE);
+       place_monster_aux(player_ptr, 0, yval, xval - 1, what[6], PM_NO_KAGE);
+
+       /* Center monster */
+       place_monster_aux(player_ptr, 0, yval, xval, what[7], PM_NO_KAGE);
+
+       return TRUE;
+}
+
+
+
+/*
+* Helper function for "trapped monster pit"
+*/
+static bool vault_aux_trapped_pit(MONRACE_IDX r_idx)
+{
+       monster_race *r_ptr = &r_info[r_idx];
+
+       if (!vault_monster_okay(r_idx)) return FALSE;
+
+       /* No wall passing monster */
+       if (r_ptr->flags2 & (RF2_PASS_WALL | RF2_KILL_WALL)) return FALSE;
+
+       return TRUE;
+}
+
+
+/*!
+* @brief タイプ13の部屋…トラップpitの生成 / Type 13 -- Trapped monster pits
+* @return なし
+* @details
+* A trapped monster pit is a "big" room with a straight corridor in\n
+* which wall opening traps are placed, and with two "inner" rooms\n
+* containing a "collection" of monsters of a given type organized in\n
+* the room.\n
+*\n
+* The trapped monster pit appears as shown below, where the actual\n
+* monsters in each location depend on the type of the pit\n
+*\n
+*  XXXXXXXXXXXXXXXXXXXXXXXXX\n
+*  X                       X\n
+*  XXXXXXXXXXXXXXXXXXXXXXX X\n
+*  XXXXX001123454321100XXX X\n
+*  XXX0012234567654322100X X\n
+*  XXXXXXXXXXXXXXXXXXXXXXX X\n
+*  X           ^           X\n
+*  X XXXXXXXXXXXXXXXXXXXXXXX\n
+*  X X0012234567654322100XXX\n
+*  X XXX001123454321100XXXXX\n
+*  X XXXXXXXXXXXXXXXXXXXXXXX\n
+*  X                       X\n
+*  XXXXXXXXXXXXXXXXXXXXXXXXX\n
+*\n
+* Note that the monsters in the pit are now chosen by using "get_mon_num()"\n
+* to request 16 "appropriate" monsters, sorting them by level, and using\n
+* the "even" entries in this sorted list for the contents of the pit.\n
+*\n
+* Hack -- all of the "dragons" in a "dragon" pit must be the same "color",\n
+* which is handled by requiring a specific "breath" attack for all of the\n
+* dragons.  This may include "multi-hued" breath.  Note that "wyrms" may\n
+* be present in many of the dragon pits, if they have the proper breath.\n
+*\n
+* Note the use of the "get_mon_num_prep()" function, and the special\n
+* "get_mon_num_hook()" restriction function, to prepare the "monster\n
+* allocation table" in such a way as to optimize the selection of\n
+* "appropriate" non-unique monsters for the pit.\n
+*\n
+* Note that the "get_mon_num()" function may (rarely) fail, in which case\n
+* the pit will be empty.\n
+*\n
+* Note that "monster pits" will never contain "unique" monsters.\n
+*/
+bool build_type13(player_type *player_ptr)
+{
+       static int placing[][3] = {
+               { -2, -9, 0 },{ -2, -8, 0 },{ -3, -7, 0 },{ -3, -6, 0 },
+               { +2, -9, 0 },{ +2, -8, 0 },{ +3, -7, 0 },{ +3, -6, 0 },
+               { -2, +9, 0 },{ -2, +8, 0 },{ -3, +7, 0 },{ -3, +6, 0 },
+               { +2, +9, 0 },{ +2, +8, 0 },{ +3, +7, 0 },{ +3, +6, 0 },
+               { -2, -7, 1 },{ -3, -5, 1 },{ -3, -4, 1 },
+               { +2, -7, 1 },{ +3, -5, 1 },{ +3, -4, 1 },
+               { -2, +7, 1 },{ -3, +5, 1 },{ -3, +4, 1 },
+               { +2, +7, 1 },{ +3, +5, 1 },{ +3, +4, 1 },
+               { -2, -6, 2 },{ -2, -5, 2 },{ -3, -3, 2 },
+               { +2, -6, 2 },{ +2, -5, 2 },{ +3, -3, 2 },
+               { -2, +6, 2 },{ -2, +5, 2 },{ -3, +3, 2 },
+               { +2, +6, 2 },{ +2, +5, 2 },{ +3, +3, 2 },
+               { -2, -4, 3 },{ -3, -2, 3 },
+               { +2, -4, 3 },{ +3, -2, 3 },
+               { -2, +4, 3 },{ -3, +2, 3 },
+               { +2, +4, 3 },{ +3, +2, 3 },
+               { -2, -3, 4 },{ -3, -1, 4 },
+               { +2, -3, 4 },{ +3, -1, 4 },
+               { -2, +3, 4 },{ -3, +1, 4 },
+               { +2, +3, 4 },{ +3, +1, 4 },
+               { -2, -2, 5 },{ -3, 0, 5 },{ -2, +2, 5 },
+               { +2, -2, 5 },{ +3, 0, 5 },{ +2, +2, 5 },
+               { -2, -1, 6 },{ -2, +1, 6 },
+               { +2, -1, 6 },{ +2, +1, 6 },
+               { -2, 0, 7 },{ +2, 0, 7 },
+               { 0, 0, -1 }
+       };
+
+       POSITION y, x, y1, x1, y2, x2, xval, yval;
+       int i, j;
+
+       MONRACE_IDX what[16];
+
+       monster_type align;
+
+       grid_type *g_ptr;
+
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
+       int cur_pit_type = pick_vault_type(floor_ptr, pit_types, d_info[floor_ptr->dungeon_idx].pit);
+       vault_aux_type *n_ptr;
+
+       /* Only in Angband */
+       if (floor_ptr->dungeon_idx != DUNGEON_ANGBAND) return FALSE;
+
+       /* No type available */
+       if (cur_pit_type < 0) return FALSE;
+
+       n_ptr = &pit_types[cur_pit_type];
+
+       /* Process a preparation function if necessary */
+       if (n_ptr->prep_func) (*(n_ptr->prep_func))(player_ptr);
+       get_mon_num_prep(player_ptr, n_ptr->hook_func, vault_aux_trapped_pit);
+
+       align.sub_align = SUB_ALIGN_NEUTRAL;
+
+       /* Pick some monster types */
+       for (i = 0; i < 16; i++)
+       {
+               MONRACE_IDX r_idx = 0;
+               int attempts = 100;
+               monster_race *r_ptr = NULL;
+
+               while (attempts--)
+               {
+                       /* Get a (hard) monster type */
+                       r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 0);
+                       r_ptr = &r_info[r_idx];
+
+                       /* Decline incorrect alignment */
+                       if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;
+
+                       /* Accept this monster */
+                       break;
+               }
+
+               /* Notice failure */
+               if (!r_idx || !attempts) return FALSE;
+
+               /* Note the alignment */
+               if (r_ptr->flags3 & RF3_EVIL) align.sub_align |= SUB_ALIGN_EVIL;
+               if (r_ptr->flags3 & RF3_GOOD) align.sub_align |= SUB_ALIGN_GOOD;
+
+               what[i] = r_idx;
+       }
+
+       /* Find and reserve some space in the dungeon.  Get center of room. */
+       if (!find_space(floor_ptr, &yval, &xval, 13, 25)) return FALSE;
+
+       /* Large room */
+       y1 = yval - 5;
+       y2 = yval + 5;
+       x1 = xval - 11;
+       x2 = xval + 11;
+
+       /* Fill with inner walls */
+       for (y = y1 - 1; y <= y2 + 1; y++)
+       {
+               for (x = x1 - 1; x <= x2 + 1; x++)
+               {
+                       g_ptr = &floor_ptr->grid_array[y][x];
+                       place_grid(g_ptr, inner);
+                       g_ptr->info |= (CAVE_ROOM);
+               }
+       }
+
+       /* Place the floor area 1 */
+       for (x = x1 + 3; x <= x2 - 3; x++)
+       {
+               g_ptr = &floor_ptr->grid_array[yval - 2][x];
+               place_grid(g_ptr, floor);
+               add_cave_info(floor_ptr, yval - 2, x, CAVE_ICKY);
+
+               g_ptr = &floor_ptr->grid_array[yval + 2][x];
+               place_grid(g_ptr, floor);
+               add_cave_info(floor_ptr, yval + 2, x, CAVE_ICKY);
+       }
+
+       /* Place the floor area 2 */
+       for (x = x1 + 5; x <= x2 - 5; x++)
+       {
+               g_ptr = &floor_ptr->grid_array[yval - 3][x];
+               place_grid(g_ptr, floor);
+               add_cave_info(floor_ptr, yval - 3, x, CAVE_ICKY);
+
+               g_ptr = &floor_ptr->grid_array[yval + 3][x];
+               place_grid(g_ptr, floor);
+               add_cave_info(floor_ptr, yval + 3, x, CAVE_ICKY);
+       }
+
+       /* Corridor */
+       for (x = x1; x <= x2; x++)
+       {
+               g_ptr = &floor_ptr->grid_array[yval][x];
+               place_grid(g_ptr, floor);
+               g_ptr = &floor_ptr->grid_array[y1][x];
+               place_grid(g_ptr, floor);
+               g_ptr = &floor_ptr->grid_array[y2][x];
+               place_grid(g_ptr, floor);
+       }
+
+       /* Place the outer walls */
+       for (y = y1 - 1; y <= y2 + 1; y++)
+       {
+               g_ptr = &floor_ptr->grid_array[y][x1 - 1];
+               place_grid(g_ptr, outer);
+               g_ptr = &floor_ptr->grid_array[y][x2 + 1];
+               place_grid(g_ptr, outer);
+       }
+       for (x = x1 - 1; x <= x2 + 1; x++)
+       {
+               g_ptr = &floor_ptr->grid_array[y1 - 1][x];
+               place_grid(g_ptr, outer);
+               g_ptr = &floor_ptr->grid_array[y2 + 1][x];
+               place_grid(g_ptr, outer);
+       }
+
+       /* Random corridor */
+       if (one_in_(2))
+       {
+               for (y = y1; y <= yval; y++)
+               {
+                       place_floor_bold(floor_ptr, y, x2);
+                       place_solid_bold(floor_ptr, y, x1 - 1);
+               }
+               for (y = yval; y <= y2 + 1; y++)
+               {
+                       place_floor_bold(floor_ptr, y, x1);
+                       place_solid_bold(floor_ptr, y, x2 + 1);
+               }
+       }
+       else
+       {
+               for (y = yval; y <= y2 + 1; y++)
+               {
+                       place_floor_bold(floor_ptr, y, x1);
+                       place_solid_bold(floor_ptr, y, x2 + 1);
+               }
+               for (y = y1; y <= yval; y++)
+               {
+                       place_floor_bold(floor_ptr, y, x2);
+                       place_solid_bold(floor_ptr, y, x1 - 1);
+               }
+       }
+
+       /* Place the wall open trap */
+       floor_ptr->grid_array[yval][xval].mimic = floor_ptr->grid_array[yval][xval].feat;
+       floor_ptr->grid_array[yval][xval].feat = feat_trap_open;
+
+       /* Sort the entries */
+       for (i = 0; i < 16 - 1; i++)
+       {
+               /* Sort the entries */
+               for (j = 0; j < 16 - 1; j++)
+               {
+                       int i1 = j;
+                       int i2 = j + 1;
+
+                       int p1 = r_info[what[i1]].level;
+                       int p2 = r_info[what[i2]].level;
+
+                       /* Bubble */
+                       if (p1 > p2)
+                       {
+                               MONRACE_IDX tmp = what[i1];
+                               what[i1] = what[i2];
+                               what[i2] = tmp;
+                       }
+               }
+       }
+
+       msg_format_wizard(CHEAT_DUNGEON, _("%s%sの罠ピットが生成されました。", "Trapped monster pit (%s%s)"),
+               n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
+
+       /* Select the entries */
+       for (i = 0; i < 8; i++)
+       {
+               /* Every other entry */
+               what[i] = what[i * 2];
+
+               if (cheat_hear)
+               {
+                       msg_print(r_name + r_info[what[i]].name);
+               }
+       }
+
+       for (i = 0; placing[i][2] >= 0; i++)
+       {
+               y = yval + placing[i][0];
+               x = xval + placing[i][1];
+               place_monster_aux(player_ptr, 0, y, x, what[placing[i][2]], PM_NO_KAGE);
+       }
+
+       return TRUE;
+}
+