OSDN Git Service

Fix select_floor_music().
[hengband/hengband.git] / src / init1.c
index cff1c4f..b3c2309 100644 (file)
@@ -1,34 +1,29 @@
-/* File: init1.c */
-
-/*
- * Copyright (c) 1997 Ben Harrison
- *
+/*!
+ * @file init1.c
+ * @brief ¥²¡¼¥à¥Ç¡¼¥¿½é´ü²½1 / Initialization (part 1) -BEN-
+ * @date 2014/01/28
+ * @author
+ * <pre>
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
  * This software may be copied and distributed for educational, research,
  * and not for profit purposes provided that this copyright and statement
  * are included in all such copies.  Other copyrights may also apply.
- */
-
-/* Purpose: Initialization (part 1) -BEN- */
-
-#include "angband.h"
-
-
-/*
+ * 2014 Deskull rearranged comment for Doxygen.\n
+ * </pre>
+ * @details
+ * <pre>
  * This file is used to initialize various variables and arrays for the
  * Angband game.  Note the use of "fd_read()" and "fd_write()" to bypass
  * the common limitation of "read()" and "write()" to only 32767 bytes
  * at a time.
- *
  * Several of the arrays for Angband are built from "template" files in
  * the "lib/file" directory, from which quick-load binary "image" files
  * are constructed whenever they are not present in the "lib/data"
  * directory, or if those files become obsolete, if we are allowed.
- *
  * Warning -- the "ascii" file parsers use a minor hack to collect the
  * name and text information in a single pass.  Thus, the game will not
  * be able to load any template file with more than 20K of names or 60K
  * of text, even though technically, up to 64K should be legal.
- *
  * Note that if "ALLOW_TEMPLATES" is not defined, then a lot of the code
  * in this file is compiled out, and the game will not run unless valid
  * "binary template files" already exist in "lib/data".  Thus, one can
  * "*.raw" files in "lib/data", and then quit, and recompile without
  * defining ALLOW_TEMPLATES, which will both save 20K and prevent people
  * from changing the ascii template files in potentially dangerous ways.
- *
  * The code could actually be removed and placed into a "stand-alone"
  * program, but that feels a little silly, especially considering some
  * of the platforms that we currently support.
+ * </pre>
  */
 
+#include "angband.h"
+
+
+
 #ifdef ALLOW_TEMPLATES
 
 #include "init.h"
@@ -49,7 +48,8 @@
 
 /*** Helper arrays for parsing ascii template files ***/
 
-/*
+/*!
+ * ¥â¥ó¥¹¥¿¡¼¤ÎÂÇ·â¼êÃʥȡ¼¥¯¥ó¤ÎÄêµÁ /
  * Monster Blow Methods
  */
 static cptr r_info_blow_method[] =
@@ -84,7 +84,8 @@ static cptr r_info_blow_method[] =
 };
 
 
-/*
+/*!
+ * ¥â¥ó¥¹¥¿¡¼¤ÎÂÇ·â°À­¥È¡¼¥¯¥ó¤ÎÄêµÁ /
  * Monster Blow Effects
  */
 static cptr r_info_blow_effect[] =
@@ -128,8 +129,8 @@ static cptr r_info_blow_effect[] =
        NULL
 };
 
-
-/*
+/*!
+ * ÃÏ·Á°À­¥È¡¼¥¯¥ó¤ÎÄêµÁ /
  * Feature info flags
  */
 static cptr f_info_flags[] =
@@ -253,7 +254,8 @@ static cptr f_info_flags[] =
 };
 
 
-/*
+/*!
+ * ¥â¥ó¥¹¥¿¡¼ÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ1 /
  * Monster race flags
  */
 static cptr r_info_flags1[] =
@@ -292,7 +294,8 @@ static cptr r_info_flags1[] =
        "XXX3"
 };
 
-/*
+/*!
+ * ¥â¥ó¥¹¥¿¡¼ÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ2 /
  * Monster race flags
  */
 static cptr r_info_flags2[] =
@@ -331,7 +334,8 @@ static cptr r_info_flags2[] =
        "QUANTUM"
 };
 
-/*
+/*!
+ * ¥â¥ó¥¹¥¿¡¼ÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ3 /
  * Monster race flags
  */
 static cptr r_info_flags3[] =
@@ -370,7 +374,8 @@ static cptr r_info_flags3[] =
        "NO_SLEEP"
 };
 
-/*
+/*!
+ * ¥â¥ó¥¹¥¿¡¼ÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ4 /
  * Monster race flags
  */
 static cptr r_info_flags4[] =
@@ -409,7 +414,8 @@ static cptr r_info_flags4[] =
        "BR_DISI",
 };
 
-/*
+/*!
+ * ¥â¥ó¥¹¥¿¡¼ÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ5 /
  * Monster race flags
  */
 static cptr r_info_flags5[] =
@@ -448,7 +454,8 @@ static cptr r_info_flags5[] =
        "HOLD"
 };
 
-/*
+/*!
+ * ¥â¥ó¥¹¥¿¡¼ÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ6 /
  * Monster race flags
  */
 static cptr r_info_flags6[] =
@@ -488,7 +495,8 @@ static cptr r_info_flags6[] =
 };
 
 
-/*
+/*!
+ * ¥â¥ó¥¹¥¿¡¼ÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ7 /
  * Monster race flags
  */
 static cptr r_info_flags7[] =
@@ -507,7 +515,7 @@ static cptr r_info_flags7[] =
        "SELF_LITE_2",
        "GUARDIAN",
        "CHAMELEON",
-       "KILL_EXP",
+       "XXXX4XXX",
        "TANUKI",
        "HAS_DARK_1",
        "SELF_DARK_1",
@@ -527,7 +535,8 @@ static cptr r_info_flags7[] =
        "XXX7X31",
 };
 
-/*
+/*!
+ * ¥â¥ó¥¹¥¿¡¼ÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ8 /
  * Monster race flags
  */
 static cptr r_info_flags8[] =
@@ -567,8 +576,9 @@ static cptr r_info_flags8[] =
 };
 
 
-/*
- * Monster race flags - Drops
+/*!
+ * ¥â¥ó¥¹¥¿¡¼ÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ9 /
+ * Monster race flags
  */
 static cptr r_info_flags9[] =
 {
@@ -608,8 +618,9 @@ static cptr r_info_flags9[] =
 };
 
 
-/*
- * Monster race flags - Resistances
+/*!
+ * ¥â¥ó¥¹¥¿¡¼ÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁR(ÂÑÀ­) /
+ * Monster race flags
  */
 static cptr r_info_flagsr[] =
 {
@@ -648,7 +659,8 @@ static cptr r_info_flagsr[] =
 };
 
 
-/*
+/*!
+ * ¥ª¥Ö¥¸¥§¥¯¥È´ðËÜÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ /
  * Object flags
  */
 static cptr k_info_flags[] =
@@ -730,7 +742,7 @@ static cptr k_info_flags[] =
        "WARNING",
        "HIDE_TYPE",
        "SHOW_MODS",
-       "XXX1",
+       "SLAY_GOOD",
        "LEVITATION",
        "LITE",
        "SEE_INVIS",
@@ -750,7 +762,7 @@ static cptr k_info_flags[] =
        "BLESSED",
        "XXX3", /* Fake flag for Smith */
        "XXX4", /* Fake flag for Smith */
-       "XXX5",
+       "KILL_GOOD",
 
        "KILL_ANIMAL",
        "KILL_EVIL",
@@ -776,9 +788,32 @@ static cptr k_info_flags[] =
        "FIXED_FLAVOR",
        "ADD_L_CURSE",
        "ADD_H_CURSE",
+       "DRAIN_HP",
+       "DRAIN_MANA",
+       
+       "LITE_2",
+       "LITE_3",
+       "LITE_M1",
+       "LITE_M2",
+       "LITE_M3",
+       "LITE_FUEL",
+       
+       "CALL_ANIMAL",
+       "CALL_DEMON",
+       "CALL_DRAGON",
+       "CALL_UNDEAD",
+       "COWARDICE",
+       "LOW_MELEE",
+       "LOW_AC",
+       "LOW_MAGIC",
+       "FAST_DIGEST",
+       "SLOW_REGEN",
 };
 
-
+/*!
+ * ¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®ÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ /
+ * Object flags
+ */
 static cptr k_info_gen_flags[] =
 {
        "INSTA_ART",
@@ -798,7 +833,7 @@ static cptr k_info_gen_flags[] =
        "RANDOM_CURSE1",
        "RANDOM_CURSE2",
        "XTRA_DICE",
-       "XXX",
+       "POWERFUL",
        "XXX",
        "XXX",
        "XXX",
@@ -815,7 +850,8 @@ static cptr k_info_gen_flags[] =
        "XXX",
 };
 
-/*
+/*!
+ * ¥À¥ó¥¸¥ç¥óÆÃÀ­¥È¡¼¥¯¥ó¤ÎÄêµÁ /
  * Dungeon flags
  */
 static cptr d_info_flags1[] =
@@ -832,7 +868,7 @@ static cptr d_info_flags1[] =
        "GLASS_DOOR",
        "CAVE",
        "CAVERN",
-       "XXX",
+       "ARCADE",
        "XXX",
        "XXX",
        "XXX",
@@ -855,9 +891,15 @@ static cptr d_info_flags1[] =
 };
 
 
-/*
+/*!
+ * @brief ¥Ç¡¼¥¿¤Î²ÄÊÑʸ»úÎó¾ðÊó¤ò¥Æ¥­¥¹¥È¤È¤·¤ÆÊݴɤ¹¤ë /
  * Add a text to the text-storage and store offset to it.
- *
+ * @param offset Ê¸»úÎóÊݴɥݥ¤¥ó¥¿¤«¤é¤Î¥ª¥Õ¥»¥Ã¥È
+ * @param head ¥Æ¥­¥¹¥ÈÊݴɥإåÀ¾ðÊó¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param buf ÊÝ´Éʸ»úÎó
+ * @param normal_text ¥Æ¥­¥¹¥È¤ÎÀµµ¬²½¤ò¹Ô¤¦
+ * @return
+ * Ìµ»öÊݴɤ¬¤Ç¤­¤¿¤éTRUE¤òÊÖ¤¹¡£
  * Returns FALSE when there isn't enough space available to store
  * the text.
  */
@@ -912,11 +954,16 @@ static bool add_text(u32b *offset, header *head, cptr buf, bool normal_text)
 }
 
 
-/*
+/*!
+ * @brief ¥Ç¡¼¥¿¤Î²ÄÊÑʸ»úÎó¾ðÊó¤ò̾Á°¤È¤·¤ÆÊݴɤ¹¤ë /
  * Add a name to the name-storage and return an offset to it.
- *
+ * @param offset Ê¸»úÎóÊݴɥݥ¤¥ó¥¿¤«¤é¤Î¥ª¥Õ¥»¥Ã¥È
+ * @param head ¥Æ¥­¥¹¥ÈÊݴɥإåÀ¾ðÊó¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param buf ÊÝ´Éʸ»úÎó
+ * @return
+ * Ìµ»öÊݴɤ¬¤Ç¤­¤¿¤éTRUE¤òÊÖ¤¹¡£
  * Returns FALSE when there isn't enough space available to store
- * the name.
+ * the text.
  */
 static bool add_name(u32b *offset, header *head, cptr buf)
 {
@@ -942,11 +989,16 @@ static bool add_name(u32b *offset, header *head, cptr buf)
 }
 
 
-/*
+/*!
+ * @brief ¥Ç¡¼¥¿¤Î²ÄÊÑʸ»úÎó¾ðÊó¤ò¥¿¥°¤È¤·¤ÆÊݴɤ¹¤ë /
  * Add a tag to the tag-storage and return an offset to it.
- *
+ * @param offset Ê¸»úÎóÊݴɥݥ¤¥ó¥¿¤«¤é¤Î¥ª¥Õ¥»¥Ã¥È
+ * @param head ¥Æ¥­¥¹¥ÈÊݴɥإåÀ¾ðÊó¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param buf ÊÝ´Éʸ»úÎó
+ * @return
+ * Ìµ»öÊݴɤ¬¤Ç¤­¤¿¤éTRUE¤òÊÖ¤¹¡£
  * Returns FALSE when there isn't enough space available to store
- * the name.
+ * the text.
  */
 static bool add_tag(s16b *offset, header *head, cptr buf)
 {
@@ -984,9 +1036,12 @@ static bool add_tag(s16b *offset, header *head, cptr buf)
 }
 
 
-/*
+/*!
+ * @brief ¥·¥ó¥Ü¥ë1ʸ»ú¤ò¥«¥é¡¼ID¤ËÊѹ¹¤¹¤ë /
  * Convert a "color letter" into an "actual" color
  * The colors are: dwsorgbuDWvyRGBU, as shown below
+ * @param c ¥·¥ó¥Ü¥ëʸ»ú
+ * @return ¥«¥é¡¼ID
  */
 byte color_char_to_attr(char c)
 {
@@ -1019,8 +1074,14 @@ byte color_char_to_attr(char c)
 /*** Initialize from ascii template files ***/
 
 
-/*
+/*!
+ * @brief ¥Ñ¡¼¥¹´Ø¿ô¤Ë´ð¤Å¤¤¤Æ¥Ç¡¼¥¿¥Õ¥¡¥¤¥ë¤«¤é¥Ç¡¼¥¿¤òÆɤ߼è¤ë /
  * Initialize an "*_info" array, by parsing an ascii "template" file
+ * @param fp Æɤ߼è¤ê¤Ë»È¤¦¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿
+ * @param buf Æɤ߼è¤ê¤Ë»È¤¦¥Ð¥Ã¥Õ¥¡Îΰè
+ * @param head ¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @param parse_info_txt_line ¥Ñ¡¼¥¹´Ø¿ô
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 errr init_info_txt(FILE *fp, char *buf, header *head,
                   parse_info_txt_func parse_info_txt_line)
@@ -1085,8 +1146,12 @@ errr init_info_txt(FILE *fp, char *buf, header *head,
 }
 
 
-/*
+/*!
+ * @brief Vault¾ðÊó(v_info)¤Î¥Ñ¡¼¥¹´Ø¿ô /
  * Initialize the "v_info" array, by parsing an ascii "template" file
+ * @param buf ¥Æ¥­¥¹¥ÈÎó
+ * @param head ¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 errr parse_v_info(char *buf, header *head)
 {
@@ -1167,9 +1232,12 @@ errr parse_v_info(char *buf, header *head)
 }
 
 
-
-/*
+/*!
+ * @brief ¿¦¶Èµ»Ç½¾ðÊó(s_info)¤Î¥Ñ¡¼¥¹´Ø¿ô /
  * Initialize the "s_info" array, by parsing an ascii "template" file
+ * @param buf ¥Æ¥­¥¹¥ÈÎó
+ * @param head ¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 errr parse_s_info(char *buf, header *head)
 {
@@ -1249,8 +1317,12 @@ errr parse_s_info(char *buf, header *head)
 }
 
 
-/*
+/*!
+ * @brief ¿¦¶ÈËâË¡¾ðÊó(m_info)¤Î¥Ñ¡¼¥¹´Ø¿ô /
  * Initialize the "m_info" array, by parsing an ascii "template" file
+ * @param buf ¥Æ¥­¥¹¥ÈÎó
+ * @param head ¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 errr parse_m_info(char *buf, header *head)
 {
@@ -1377,8 +1449,13 @@ errr parse_m_info(char *buf, header *head)
 }
 
 
-/*
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°¤ò°ì¤ÄÆÀ¤ë(ÈÆÍÑ) /
  * Grab one flag from a textual string
+ * @param flags ¥Ó¥Ã¥È¥Õ¥é¥°¤òÄɲ乤ëÀè¤Î»²¾È¥Ý¥¤¥ó¥¿
+ * @param names ¥È¡¼¥¯¥óÄêµÁÇÛÎó
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr grab_one_flag(u32b *flags, cptr names[], cptr what)
 {
@@ -1398,8 +1475,12 @@ static errr grab_one_flag(u32b *flags, cptr names[], cptr what)
 }
 
 
-/*
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°¤ò°ì¤ÄÆÀ¤ë¡ÊÃÏ·Á¾ðÊó¸þ¤±¡Ë /
  * Grab one flag in an feature_type from a textual string
+ * @param f_ptr ÃÏ·Á¾ðÊó¤òÊݴɤ¹¤ëÀè¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr grab_one_feat_flag(feature_type *f_ptr, cptr what)
 {
@@ -1427,8 +1508,13 @@ static errr grab_one_feat_flag(feature_type *f_ptr, cptr what)
 }
 
 
-/*
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°(¥¹¥Æ¡¼¥È)¤ò°ì¤ÄÆÀ¤ë¡ÊÃÏ·Á¾ðÊó¸þ¤±2¡Ë /
  * Grab an action in an feature_type from a textual string
+ * @param f_ptr ÃÏ·Á¾ðÊó¤òÊݴɤ¹¤ëÀè¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @param count ¥¹¥Æ¡¼¥È¤ÎÊݸÀèID
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr grab_one_feat_action(feature_type *f_ptr, cptr what, int count)
 {
@@ -1456,8 +1542,12 @@ static errr grab_one_feat_action(feature_type *f_ptr, cptr what, int count)
 }
 
 
-/*
+/*!
+ * @brief ÃÏ·Á¾ðÊó(f_info)¤Î¥Ñ¡¼¥¹´Ø¿ô /
  * Initialize the "f_info" array, by parsing an ascii "template" file
+ * @param buf ¥Æ¥­¥¹¥ÈÎó
+ * @param head ¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 errr parse_f_info(char *buf, header *head)
 {
@@ -1740,8 +1830,11 @@ errr parse_f_info(char *buf, header *head)
 }
 
 
-/*
+/*!
+ * @brief ÃÏ·Á¥¿¥°¤«¤éID¤òÆÀ¤ë /
  * Convert a fake tag to a real feat index
+ * @param str ¥¿¥°Ê¸»úÎó
+ * @return ÃÏ·ÁID
  */
 s16b f_tag_to_index(cptr str)
 {
@@ -1762,8 +1855,11 @@ s16b f_tag_to_index(cptr str)
 }
 
 
-/*
+/*!
+ * @brief ÃÏ·Á¥¿¥°¤«¤éID¤òÆÀ¤ë /
  * Search for real index corresponding to this fake tag
+ * @param feat ¥¿¥°Ê¸»úÎó
+ * @return ¤Ê¤·
  */
 static void search_real_feat(s16b *feat)
 {
@@ -1792,8 +1888,11 @@ static void search_real_feat(s16b *feat)
 }
 
 
-/*
+/*!
+ * @brief ÃÏ·Á¾ðÊó¤Î³Æ¼ï¥¿¥°¤«¤éID¤ØÊÑ´¹¤·¤Æ·ë²Ì¤ò¼ý¤á¤ë /
  * Retouch fake tags of f_info
+ * @param head ¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @return ¤Ê¤·
  */
 void retouch_f_info(header *head)
 {
@@ -1814,8 +1913,12 @@ void retouch_f_info(header *head)
 }
 
 
-/*
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°¤ò°ì¤ÄÆÀ¤ë(¥Ù¡¼¥¹¥¢¥¤¥Æ¥àÍÑ) /
  * Grab one flag in an object_kind from a textual string
+ * @param k_ptr ÊÝ´ÉÀè¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥à¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr grab_one_kind_flag(object_kind *k_ptr, cptr what)
 {
@@ -1846,9 +1949,50 @@ static errr grab_one_kind_flag(object_kind *k_ptr, cptr what)
        return (1);
 }
 
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°¤ò°ì¤ÄÆÀ¤ë(ȯưǽÎÏÍÑ) /
+ * Grab one activation index flag
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @return È¯Æ°Ç½ÎÏID
+ */
+static byte grab_one_activation_flag(cptr what)
+{
+       int i;
+
+       for (i = 0; ; i++)
+       {
+               if (activation_info[i].flag == NULL) break;
+
+               if (streq(what, activation_info[i].flag))
+               {
+                       return activation_info[i].index;
+               }
+       }
+
+       i = atoi(what);
+        if (i > 0)
+        {
+                return ((byte) i);
+        }
+
+       /* Oops */
+#ifdef JP
+       msg_format("̤ÃΤÎȯư¡¦¥Õ¥é¥° '%s'¡£", what);
+#else
+       msg_format("Unknown activation flag '%s'.", what);
+#endif
+
+       /* Error */
+       return (0);
+}
+
 
-/*
+/*!
+ * @brief ¥Ù¡¼¥¹¥¢¥¤¥Æ¥à(k_info)¤Î¥Ñ¡¼¥¹´Ø¿ô /
  * Initialize the "k_info" array, by parsing an ascii "template" file
+ * @param buf ¥Æ¥­¥¹¥ÈÎó
+ * @param head ¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 errr parse_k_info(char *buf, header *head)
 {
@@ -2073,6 +2217,21 @@ errr parse_k_info(char *buf, header *head)
                k_ptr->to_a =  ta;
        }
 
+       /* Hack -- Process 'U' for activation index */
+       else if (buf[0] == 'U')
+       {
+               byte n;
+               n = grab_one_activation_flag(buf + 2);
+               if (n > 0)
+               {
+                       k_ptr->act_idx = n;
+               }
+               else
+               {
+                       return (5);
+               }
+       }
+
        /* Hack -- Process 'F' for flags */
        else if (buf[0] == 'F')
        {
@@ -2106,9 +2265,12 @@ errr parse_k_info(char *buf, header *head)
        return (0);
 }
 
-
-/*
- * Grab one flag in an artifact_type from a textual string
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°¤ò°ì¤ÄÆÀ¤ë(¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥ÈÍÑ) /
+ * Grab one activation index flag
+ * @param a_ptr ÊÝ´ÉÀè¤Î¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @return ¥¨¥é¡¼¤¬¤¢¤Ã¤¿¾ì¹ç1¡¢¥¨¥é¡¼¤¬¤Ê¤¤¾ì¹ç0¤òÊÖ¤¹
  */
 static errr grab_one_artifact_flag(artifact_type *a_ptr, cptr what)
 {
@@ -2139,43 +2301,13 @@ static errr grab_one_artifact_flag(artifact_type *a_ptr, cptr what)
        return (1);
 }
 
-/*
- * Grab one activation index flag
- */
-static byte grab_one_activation_flag(cptr what)
-{
-       int i;
-
-       for (i = 0; ; i++)
-       {
-               if (activation_info[i].flag == NULL) break;
-
-               if (streq(what, activation_info[i].flag))
-               {
-                       return activation_info[i].index;
-               }
-       }
-
-       i = atoi(what);
-        if (i > 0)
-        {
-                return ((byte) i);
-        }
-
-       /* Oops */
-#ifdef JP
-       msg_format("̤ÃΤÎȯư¡¦¥Õ¥é¥° '%s'¡£", what);
-#else
-       msg_format("Unknown activation flag '%s'.", what);
-#endif
-
-       /* Error */
-       return (0);
-}
-
 
-/*
+/*!
+ * @brief ¸ÇÄꥢ¡¼¥Æ¥£¥Õ¥¡¥¯¥È¾ðÊó(a_info)¤Î¥Ñ¡¼¥¹´Ø¿ô /
  * Initialize the "a_info" array, by parsing an ascii "template" file
+ * @param buf ¥Æ¥­¥¹¥ÈÎó
+ * @param head ¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 errr parse_a_info(char *buf, header *head)
 {
@@ -2368,8 +2500,12 @@ errr parse_a_info(char *buf, header *head)
 }
 
 
-/*
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°¤ò°ì¤ÄÆÀ¤ë(¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥ÈÍÑ) /
  * Grab one flag in a ego-item_type from a textual string
+ * @param e_ptr ÊÝ´ÉÀè¤Î¥¨¥´¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @return ¥¨¥é¡¼¤¬¤¢¤Ã¤¿¾ì¹ç1¡¢¥¨¥é¡¼¤¬¤Ê¤¤¾ì¹ç0¤òÊÖ¤¹
  */
 static bool grab_one_ego_item_flag(ego_item_type *e_ptr, cptr what)
 {
@@ -2401,10 +2537,12 @@ static bool grab_one_ego_item_flag(ego_item_type *e_ptr, cptr what)
 }
 
 
-
-
-/*
+/*!
+ * @brief ¥¢¥¤¥Æ¥à¥¨¥´¾ðÊó(e_info)¤Î¥Ñ¡¼¥¹´Ø¿ô /
  * Initialize the "e_info" array, by parsing an ascii "template" file
+ * @param buf ¥Æ¥­¥¹¥ÈÎó
+ * @param head ¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 errr parse_e_info(char *buf, header *head)
 {
@@ -2539,6 +2677,21 @@ errr parse_e_info(char *buf, header *head)
                e_ptr->max_pval = pv;
        }
 
+       /* Hack -- Process 'U' for activation index */
+       else if (buf[0] == 'U')
+       {
+               byte n;
+               n = grab_one_activation_flag(buf + 2);
+               if (n > 0)
+               {
+                       e_ptr->act_idx = n;
+               }
+               else
+               {
+                       return (5);
+               }
+       }
+
        /* Hack -- Process 'F' for flags */
        else if (buf[0] == 'F')
        {
@@ -2571,8 +2724,12 @@ errr parse_e_info(char *buf, header *head)
 }
 
 
-/*
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°¤ò°ì¤ÄÆÀ¤ë(¥â¥ó¥¹¥¿¡¼ÍÑ1) /
  * Grab one (basic) flag in a monster_race from a textual string
+ * @param r_ptr ÊÝ´ÉÀè¤Î¥â¥ó¥¹¥¿¡¼¼ï²¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr grab_one_basic_flag(monster_race *r_ptr, cptr what)
 {
@@ -2610,8 +2767,12 @@ static errr grab_one_basic_flag(monster_race *r_ptr, cptr what)
 }
 
 
-/*
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°¤ò°ì¤ÄÆÀ¤ë(¥â¥ó¥¹¥¿¡¼ÍÑ2) /
  * Grab one (spell) flag in a monster_race from a textual string
+ * @param r_ptr ÊÝ´ÉÀè¤Î¥â¥ó¥¹¥¿¡¼¼ï²¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr grab_one_spell_flag(monster_race *r_ptr, cptr what)
 {
@@ -2637,10 +2798,12 @@ static errr grab_one_spell_flag(monster_race *r_ptr, cptr what)
 }
 
 
-
-
-/*
+/*!
+ * @brief ¥â¥ó¥¹¥¿¡¼¼ï²¾ðÊó(r_info)¤Î¥Ñ¡¼¥¹´Ø¿ô /
  * Initialize the "r_info" array, by parsing an ascii "template" file
+ * @param buf ¥Æ¥­¥¹¥ÈÎó
+ * @param head ¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 errr parse_r_info(char *buf, header *head)
 {
@@ -2796,6 +2959,23 @@ errr parse_r_info(char *buf, header *head)
                r_ptr->next_r_idx = nextmon;
        }
 
+       /* Process 'R' for "Reinforcement" (up to six lines) */
+       else if (buf[0] == 'R')
+       {
+               int id, ds, dd;
+               /* Find the next empty blow slot (if any) */
+               for (i = 0; i < 6; i++) if (r_ptr->reinforce_id[i] == 0) break;
+
+               /* Oops, no more slots */
+               if (i == 6) return (1);
+
+               /* Scan for the values */
+               if (3 != sscanf(buf+2, "%d:%dd%d", &id, &dd, &ds)) return (1);
+               r_ptr->reinforce_id[i] = id;
+               r_ptr->reinforce_dd[i] = dd;
+               r_ptr->reinforce_ds[i] = ds;
+       }
+
        /* Process 'B' for "Blows" (up to four lines) */
        else if (buf[0] == 'B')
        {
@@ -2924,8 +3104,12 @@ errr parse_r_info(char *buf, header *head)
 }
 
 
-/*
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°¤ò°ì¤ÄÆÀ¤ë(¥À¥ó¥¸¥ç¥óÍÑ) /
  * Grab one flag for a dungeon type from a textual string
+ * @param d_ptr ÊÝ´ÉÀè¤Î¥À¥ó¥¸¥ç¥ó¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr grab_one_dungeon_flag(dungeon_info_type *d_ptr, cptr what)
 {
@@ -2943,8 +3127,12 @@ static errr grab_one_dungeon_flag(dungeon_info_type *d_ptr, cptr what)
        return (1);
 }
 
-/*
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°¤ò°ì¤ÄÆÀ¤ë(¥â¥ó¥¹¥¿¡¼¤Î¥À¥ó¥¸¥ç¥ó½Ð¸½¾ò·ïÍÑ1) /
  * Grab one (basic) flag in a monster_race from a textual string
+ * @param d_ptr ÊÝ´ÉÀè¤Î¥À¥ó¥¸¥ç¥ó¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr grab_one_basic_monster_flag(dungeon_info_type *d_ptr, cptr what)
 {
@@ -2980,8 +3168,12 @@ static errr grab_one_basic_monster_flag(dungeon_info_type *d_ptr, cptr what)
 }
 
 
-/*
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥È¡¼¥¯¥ó¤òÁöºº¤·¤Æ¥Õ¥é¥°¤ò°ì¤ÄÆÀ¤ë(¥â¥ó¥¹¥¿¡¼¤Î¥À¥ó¥¸¥ç¥ó½Ð¸½¾ò·ïÍÑ2) /
  * Grab one (spell) flag in a monster_race from a textual string
+ * @param d_ptr ÊÝ´ÉÀè¤Î¥À¥ó¥¸¥ç¥ó¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param what »²¾È¸µ¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr grab_one_spell_monster_flag(dungeon_info_type *d_ptr, cptr what)
 {
@@ -3005,8 +3197,12 @@ static errr grab_one_spell_monster_flag(dungeon_info_type *d_ptr, cptr what)
        return (1);
 }
 
-/*
+/*!
+ * @brief ¥À¥ó¥¸¥ç¥ó¾ðÊó(d_info)¤Î¥Ñ¡¼¥¹´Ø¿ô /
  * Initialize the "d_info" array, by parsing an ascii "template" file
+ * @param buf ¥Æ¥­¥¹¥ÈÎó
+ * @param head ¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 errr parse_d_info(char *buf, header *head)
 {
@@ -3371,8 +3567,11 @@ struct dungeon_grid
 static dungeon_grid letter[255];
 
 
-/*
+/*!
+ * @brief ÃÏ·Á¾ðÊó¤Î¡ÖF:¡×¾ðÊó¤ò¥Ñ¡¼¥¹¤¹¤ë
  * Process "F:<letter>:<terrain>:<cave_info>:<monster>:<object>:<ego>:<artifact>:<trap>:<special>" -- info for dungeon grid
+ * @param buf ²òÀÏʸ»úÎó
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr parse_line_feature(char *buf)
 {
@@ -3517,8 +3716,11 @@ static errr parse_line_feature(char *buf)
 }
 
 
-/*
+/*!
+ * @brief ÃÏ·Á¾ðÊó¤Î¡ÖB:¡×¾ðÊó¤ò¥Ñ¡¼¥¹¤¹¤ë
  * Process "B:<Index>:<Command>:..." -- Building definition
+ * @param buf ²òÀÏʸ»úÎó
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr parse_line_building(char *buf)
 {
@@ -3670,8 +3872,13 @@ static errr parse_line_building(char *buf)
 }
 
 
-/*
+/*!
+ * @brief ¥Õ¥í¥¢¤Î½êÄê¤Î¥Þ¥¹¤Ë¥ª¥Ö¥¸¥§¥¯¥È¤òÇÛÃÖ¤¹¤ë
  * Place the object j_ptr to a grid
+ * @param j_ptr ¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
+ * @param y ÇÛÃÖÀèYºÂɸ
+ * @param x ÇÛÃÖÀèXºÂɸ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static void drop_here(object_type *j_ptr, int y, int x)
 {
@@ -3703,8 +3910,17 @@ static void drop_here(object_type *j_ptr, int y, int x)
 }
 
 
-/*
+/*!
+ * @brief ¥¯¥¨¥¹¥ÈÍѸÇÄê¥À¥ó¥¸¥ç¥ó¤ò¥Õ¥í¥¢¤ËÀ¸À®¤¹¤ë
  * Parse a sub-file of the "extra info"
+ * @param buf Ê¸»úÎó
+ * @param ymin ¾ÜºÙÉÔÌÀ
+ * @param xmin ¾ÜºÙÉÔÌÀ
+ * @param ymax ¾ÜºÙÉÔÌÀ
+ * @param xmax ¾ÜºÙÉÔÌÀ
+ * @param y ¾ÜºÙÉÔÌÀ
+ * @param x ¾ÜºÙÉÔÌÀ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, int xmax, int *y, int *x)
 {
@@ -3717,7 +3933,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
        if (!buf[0]) return (0);
 
        /* Skip "blank" lines */
-       if (isspace(buf[0])) return (0);
+       if (iswspace(buf[0])) return (0);
 
        /* Skip comments */
        if (buf[0] == '#') return (0);
@@ -4187,8 +4403,12 @@ static char tmp[8];
 static cptr variant = "ZANGBAND";
 
 
-/*
+/*!
+ * @brief ¥¯¥¨¥¹¥ÈÍѸÇÄê¥À¥ó¥¸¥ç¥óÀ¸À®»þ¤Îʬ´ô½èÍý
  * Helper function for "process_dungeon_file()"
+ * @param sp
+ * @param fp
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static cptr process_dungeon_file_expr(char **sp, char *fp)
 {
@@ -4206,7 +4426,7 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
        s = (*sp);
 
        /* Skip spaces */
-       while (isspace(*s)) s++;
+       while (iswspace(*s)) s++;
 
        /* Save start */
        b = s;
@@ -4520,6 +4740,16 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
 }
 
 
+/*!
+ * @brief ¥¯¥¨¥¹¥ÈÍѸÇÄê¥À¥ó¥¸¥ç¥óÀ¸À®»þ¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
+ * Helper function for "process_dungeon_file()"
+ * @param name ¥Õ¥¡¥¤¥ë̾
+ * @param ymin ¾ÜºÙÉÔÌÀ
+ * @param xmin ¾ÜºÙÉÔÌÀ
+ * @param ymax ¾ÜºÙÉÔÌÀ
+ * @param xmax ¾ÜºÙÉÔÌÀ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
+ */
 errr process_dungeon_file(cptr name, int ymin, int xmin, int ymax, int xmax)
 {
        FILE *fp;
@@ -4556,7 +4786,7 @@ errr process_dungeon_file(cptr name, int ymin, int xmin, int ymax, int xmax)
                if (!buf[0]) continue;
 
                /* Skip "blank" lines */
-               if (isspace(buf[0])) continue;
+               if (iswspace(buf[0])) continue;
 
                /* Skip comments */
                if (buf[0] == '#') continue;
@@ -4819,7 +5049,7 @@ void write_r_info_txt(void)
                        /* Start the line */
                        sprintf(buf, "D:");
 
-                       for (bc = 0, t = buf + 2; ((bc < 60) || !isspace(desc[j])) && (j < dlen); j++, bc++, t++)
+                       for (bc = 0, t = buf + 2; ((bc < 60) || !iswspace(desc[j])) && (j < dlen); j++, bc++, t++)
                        {
                                *t = desc[j];
                        }