OSDN Git Service

Extend features of tiling. (separation of Cell size and Tile size / add offset position.)
[hengband/hengband.git] / src / init2.c
index 2b18c02..3e34b1f 100644 (file)
@@ -1,83 +1,82 @@
-/* File: init2.c */
-
-/*
- * Copyright (c) 1997 Ben Harrison
- *
+/*!
+ * @file init2.c
+ * @brief ¥²¡¼¥à¥Ç¡¼¥¿½é´ü²½2 / Initialization (part 2) -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 2) -BEN- */
-
-#include "angband.h"
-
-#include "init.h"
-
-#ifndef MACINTOSH
-#ifdef CHECK_MODIFICATION_TIME
-#include <sys/types.h>
-#include <sys/stat.h>
-#endif /* CHECK_MODIFICATION_TIME */
-#endif
-
-/*
+ * 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.
- *
  * The "init1.c" file is used only to parse the ascii template files,
  * to create the binary image files.  If you include the binary image
  * files instead of the ascii template files, then you can undefine
  * "ALLOW_TEMPLATES", saving about 20K by removing "init1.c".  Note
  * that the binary image files are extremely system dependant.
+ * </pre>
  */
 
+#include "angband.h"
 
+#include "init.h"
 
-/*
+#ifndef MACINTOSH
+#ifdef CHECK_MODIFICATION_TIME
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif /* CHECK_MODIFICATION_TIME */
+#endif
+
+
+
+
+/*!
+ * @brief ³Æ¥Ç¡¼¥¿¥Õ¥¡¥¤¥ë¤òÆɤ߼è¤ë¤¿¤á¤Î¥Ñ¥¹¤ò¼èÆÀ¤¹¤ë
  * Find the default paths to all of our important sub-directories.
- *
+ * @param path ¥Ñ¥¹ÊÝ´ÉÀè¤Îʸ»úÎó
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * The purpose of each sub-directory is described in "variable.c".
- *
  * All of the sub-directories should, by default, be located inside
  * the main "lib" directory, whose location is very system dependant.
- *
  * This function takes a writable buffer, initially containing the
  * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
  * or a system dependant string, for example, ":lib:".  The buffer
  * must be large enough to contain at least 32 more characters.
- *
  * Various command line options may allow some of the important
  * directories to be changed to user-specified directories, most
  * importantly, the "info" and "user" and "save" directories,
  * but this is done after this function, see "main.c".
- *
  * In general, the initial path should end in the appropriate "PATH_SEP"
  * string.  All of the "sub-directory" paths (created below or supplied
  * by the user) will NOT end in the "PATH_SEP" string, see the special
  * "path_build()" function in "util.c" for more information.
- *
  * Mega-Hack -- support fat raw files under NEXTSTEP, using special
  * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
  * requiring the directories to be created by hand by the user.
- *
  * Hack -- first we free all the strings, since this is known
  * to succeed even if the strings have not been allocated yet,
  * as long as the variables start out as "NULL".  This allows
  * this function to be called multiple times, for example, to
  * try several base "path" values until a good one is found.
+ * </pre>
  */
 void init_file_paths(char *path)
 {
@@ -248,12 +247,12 @@ void init_file_paths(char *path)
 /*
  * Hack -- help give useful error messages
  */
-int error_idx;
-int error_line;
+int error_idx; /*!< ¥Ç¡¼¥¿Æɤ߹þ¤ß/½é´ü²½»þ¤ËÈÆÍÑŪ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÊݸ¤¹¤ë¥°¥í¡¼¥Ð¥ëÊÑ¿ô */
+int error_line; /*!< ¥Ç¡¼¥¿Æɤ߹þ¤ß/½é´ü²½»þ¤ËÈÆÍÑŪ¤Ë¥¨¥é¡¼¹Ô¿ô¤òÊݸ¤¹¤ë¥°¥í¡¼¥Ð¥ëÊÑ¿ô */
 
 
-/*
- * Standard error message text
+/*!
+ * ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤Î̾¾ÎÄêµÁ / Standard error message text
  */
 cptr err_str[PARSE_ERROR_MAX] =
 {
@@ -291,18 +290,25 @@ cptr err_str[PARSE_ERROR_MAX] =
 /*
  * File headers
  */
-header v_head;
-header f_head;
-header k_head;
-header a_head;
-header e_head;
-header r_head;
-header d_head;
-header s_head;
-header m_head;
+header v_head; /*!< Vault¾ðÊó¤Î¥Ø¥Ã¥À¹½Â¤ÂΠ*/
+header f_head; /*!< ÃÏ·Á¾ðÊó¤Î¥Ø¥Ã¥À¹½Â¤ÂΠ*/
+header k_head; /*!< ¥Ú¡¼¥¹¥¢¥¤¥Æ¥à¾ðÊó¤Î¥Ø¥Ã¥À¹½Â¤ÂΠ*/
+header a_head; /*!< ¸ÇÄꥢ¡¼¥Æ¥£¥Õ¥¡¥¯¥È¾ðÊó¤Î¥Ø¥Ã¥À¹½Â¤ÂΠ*/
+header e_head; /*!< ¥¢¥¤¥Æ¥à¥¨¥´¾ðÊó¤Î¥Ø¥Ã¥À¹½Â¤ÂΠ*/
+header r_head; /*!< ¥â¥ó¥¹¥¿¡¼¼ï²¾ðÊó¤Î¥Ø¥Ã¥À¹½Â¤ÂΠ*/
+header d_head; /*!< ¥À¥ó¥¸¥ç¥ó¾ðÊó¤Î¥Ø¥Ã¥À¹½Â¤ÂΠ*/
+header s_head; /*!< ¥×¥ì¥¤¥ä¡¼¿¦¶Èµ»Ç½¾ðÊó¤Î¥Ø¥Ã¥À¹½Â¤ÂΠ*/
+header m_head; /*!< ¥×¥ì¥¤¥ä¡¼¿¦¶ÈËâË¡¾ðÊó¤Î¥Ø¥Ã¥À¹½Â¤ÂΠ*/
 
 #ifdef CHECK_MODIFICATION_TIME
 
+/*!
+ * @brief ¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë¤Èraw¥Õ¥¡¥¤¥ë¤Î¹¹¿·»þ¹ï¤òÈæ³Ó¤¹¤ë
+ * Find the default paths to all of our important sub-directories.
+ * @param fd ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
+ * @param template_file ¥Õ¥¡¥¤¥ë̾
+ * @return ¥Æ¥­¥¹¥È¤ÎÊý¤¬¿·¤·¤¤¤«¡¢raw¥Õ¥¡¥¤¥ë¤¬¤Ê¤¯¹¹¿·¤ÎɬÍפ¬¤¢¤ë¾ì¹ç-1¡¢¹¹¿·¤ÎɬÍפ¬¤Ê¤¤¾ì¹ç0¡£
+ */
 static errr check_modification_date(int fd, cptr template_file)
 {
        char buf[1024];
@@ -342,8 +348,12 @@ static errr check_modification_date(int fd, cptr template_file)
 /*** Initialize from binary image files ***/
 
 
-/*
+/*!
+ * @brief raw¥Õ¥¡¥¤¥ë¤«¤é¤Î¥Ç¡¼¥¿¤ÎÆɤ߼è¤ê½èÍý
  * Initialize the "*_info" array, by parsing a binary "image" file
+ * @param fd ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
+ * @param head raw¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_info_raw(int fd, header *head)
 {
@@ -411,8 +421,13 @@ static errr init_info_raw(int fd, header *head)
 
 
 
-/*
+/*!
+ * @brief ¥Ø¥Ã¥À¹½Â¤ÂΤι¹¿·
  * Initialize the header of an *_info.raw file.
+ * @param head raw¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À
+ * @param num ¥Ç¡¼¥¿¿ô
+ * @param len ¥Ç¡¼¥¿¤ÎŤµ
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static void init_header(header *head, int num, int len)
 {
@@ -432,9 +447,17 @@ static void init_header(header *head, int num, int len)
 }
 
 
-/*
+/*!
+ * @brief ¥Ø¥Ã¥À¹½Â¤ÂΤι¹¿·
  * Initialize the "*_info" array
- *
+ * @param filename ¥Õ¥¡¥¤¥ë̾(³ÈÄ¥»Òtxt/raw)
+ * @param head ½èÍý¤ËÍѤ¤¤ë¥Ø¥Ã¥À¹½Â¤ÂÎ
+ * @param info ¥Ç¡¼¥¿ÊÝ´ÉÀè¤Î¹½Â¤ÂΥݥ¤¥ó¥¿
+ * @param name Ì¾¾ÎÍѲÄÊÑʸ»úÎó¤ÎÊÝ´ÉÀè
+ * @param text ¥Æ¥­¥¹¥ÈÍѲÄÊÑʸ»úÎó¤ÎÊÝ´ÉÀè
+ * @param tag ¥¿¥°ÍѲÄÊÑʸ»úÎó¤ÎÊÝ´ÉÀè
+ * @return ¥¨¥é¡¼¥³¡¼¥É
+ * @note
  * Note that we let each entry have a unique "name" and "text" string,
  * even if the string happens to be empty (everyone has a unique '\0').
  */
@@ -678,8 +701,10 @@ static errr init_info(cptr filename, header *head,
 }
 
 
-/*
+/*!
+ * @brief ÃÏ·Á¾ðÊóÆɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize the "f_info" array
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_f_info(void)
 {
@@ -701,8 +726,10 @@ static errr init_f_info(void)
 }
 
 
-/*
+/*!
+ * @brief ¥Ù¡¼¥¹¥¢¥¤¥Æ¥à¾ðÊóÆɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize the "k_info" array
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_k_info(void)
 {
@@ -722,8 +749,10 @@ static errr init_k_info(void)
 
 
 
-/*
+/*!
+ * @brief ¸ÇÄꥢ¡¼¥Æ¥£¥Õ¥¡¥¯¥È¾ðÊóÆɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize the "a_info" array
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_a_info(void)
 {
@@ -743,8 +772,10 @@ static errr init_a_info(void)
 
 
 
-/*
+/*!
+ * @brief ¸ÇÄꥢ¡¼¥Æ¥£¥Õ¥¡¥¯¥È¾ðÊóÆɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize the "e_info" array
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_e_info(void)
 {
@@ -764,8 +795,10 @@ static errr init_e_info(void)
 
 
 
-/*
+/*!
+ * @brief ¥â¥ó¥¹¥¿¡¼¼ï²¾ðÊóÆɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize the "r_info" array
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_r_info(void)
 {
@@ -785,8 +818,10 @@ static errr init_r_info(void)
 
 
 
-/*
+/*!
+ * @brief ¥À¥ó¥¸¥ç¥ó¾ðÊóÆɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize the "d_info" array
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_d_info(void)
 {
@@ -805,9 +840,11 @@ static errr init_d_info(void)
 }
 
 
-/*
+/*!
+ * @brief Vault¾ðÊóÆɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize the "v_info" array
- *
+ * @return ¥¨¥é¡¼¥³¡¼¥É
+ * @note
  * Note that we let each entry have a unique "name" and "text" string,
  * even if the string happens to be empty (everyone has a unique '\0').
  */
@@ -828,8 +865,10 @@ errr init_v_info(void)
 }
 
 
-/*
+/*!
+ * @brief ¿¦¶Èµ»Ç½¾ðÊóÆɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize the "s_info" array
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_s_info(void)
 {
@@ -848,8 +887,10 @@ static errr init_s_info(void)
 }
 
 
-/*
+/*!
+ * @brief ¿¦¶ÈËâË¡¾ðÊóÆɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize the "m_info" array
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_m_info(void)
 {
@@ -871,8 +912,8 @@ static errr init_m_info(void)
 
 /*** Initialize others ***/
 
-/*
- * Hack -- Objects sold in the stores -- by tval/sval pair.
+/*!
+ * Å¹ÊÞ¤ÇÈÎÇ䤹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤òÄêµÁ¤¹¤ë / Hack -- Objects sold in the stores -- by tval/sval pair.
  */
 static byte store_table[MAX_STORES][STORE_CHOICES][2] =
 {
@@ -1427,8 +1468,10 @@ static byte store_table[MAX_STORES][STORE_CHOICES][2] =
 };
 
 
-/*
+/*!
+ * @brief ´ðËܾðÊóÆɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize misc. values
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_misc(void)
 {
@@ -1439,8 +1482,10 @@ static errr init_misc(void)
 }
 
 
-/*
+/*!
+ * @brief Ä®¾ðÊóÆɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize town array
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_towns(void)
 {
@@ -1529,8 +1574,10 @@ static errr init_towns(void)
        return 0;
 }
 
-/*
+/*!
+ * @brief Å¹¾ðÊó½é´ü²½¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize buildings
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 errr init_buildings(void)
 {
@@ -1572,8 +1619,10 @@ errr init_buildings(void)
 }
 
 
-/*
+/*!
+ * @brief ¥¯¥¨¥¹¥È¾ðÊó½é´ü²½¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Initialize quest array
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_quests(void)
 {
@@ -1593,10 +1642,14 @@ static errr init_quests(void)
        return 0;
 }
 
-
+/*! ÃÏ·Á¥¿¥°¾ðÊ󤫤éÃÏ·ÁID¤òÆÀ¤é¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¤ËTRUE¤òÊÖ¤¹¥°¥í¡¼¥Ð¥ëÊÑ¿ô */
 static bool feat_tag_is_not_found = FALSE;
 
-
+/*!
+ * @brief ÃÏ·Á¥¿¥°¤«¤éID¤òÆÀ¤ë /
+ * Initialize quest array
+ * @return ÃÏ·ÁID
+ */
 s16b f_tag_to_index_in_init(cptr str)
 {
        s16b feat = f_tag_to_index(str);
@@ -1607,8 +1660,10 @@ s16b f_tag_to_index_in_init(cptr str)
 }
 
 
-/*
+/*!
+ * @brief ÃÏ·Á¤ÎÈÆÍÑÄêµÁ¤ò¥¿¥°¤òÄ̤¸¤Æ¼èÆÀ¤¹¤ë /
  * Initialize feature variables
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_feat_variables(void)
 {
@@ -1753,8 +1808,10 @@ static errr init_feat_variables(void)
 }
 
 
-/*
+/*!
+ * @brief ¤½¤Î¾¤Î½é´ü¾ðÊ󹹿· /
  * Initialize some other arrays
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_other(void)
 {
@@ -1878,8 +1935,10 @@ static errr init_other(void)
 }
 
 
-/*
+/*!
+ * @brief ¥ª¥Ö¥¸¥§¥¯¥ÈÇÛÎó¤ò½é´ü²½¤¹¤ë /
  * Initialize some other arrays
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_object_alloc(void)
 {
@@ -1994,8 +2053,10 @@ if (!num[0]) quit("Į
 }
 
 
-/*
+/*!
+ * @brief ¥â¥ó¥¹¥¿¡¼ÇÛÎó¤ÈÀ¸À®¥Æ¡¼¥Ö¥ë¤ò½é´ü²½¤¹¤ë /
  * Initialize some other arrays
+ * @return ¥¨¥é¡¼¥³¡¼¥É
  */
 static errr init_alloc(void)
 {
@@ -2160,8 +2221,10 @@ static errr init_alloc(void)
 
 
 
-/*
+/*!
+ * @brief ²èÌ̺¸²¼¤Ë¥·¥¹¥Æ¥à¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤¹¤ë /
  * Hack -- take notes on line 23
+ * @return ¤Ê¤·
  */
 static void note(cptr str)
 {
@@ -2172,12 +2235,16 @@ static void note(cptr str)
 
 
 
-/*
+/*!
+ * @brief Á´¥²¡¼¥à¥Ç¡¼¥¿Æɤ߹þ¤ß¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
  * Hack -- Explain a broken "lib" folder and quit (see below).
- *
+ * @return ¤Ê¤·
+ * @note
+ * <pre>
  * XXX XXX XXX This function is "messy" because various things
  * may or may not be initialized, but the "plog()" and "quit()"
  * functions are "supposed" to work under any conditions.
+ * </pre>
  */
 static void init_angband_aux(cptr why)
 {
@@ -2213,26 +2280,29 @@ static void init_angband_aux(cptr why)
 }
 
 
-/*
+/*!
+ * @brief Á´¥²¡¼¥à¥Ç¡¼¥¿Æɤ߹þ¤ß¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Hack -- main Angband initialization entry point
- *
+ * @return ¤Ê¤·
+ * @note
+ * <pre>
+ * XXX XXX XXX This function is "messy" because various things
+ * may or may not be initialized, but the "plog()" and "quit()"
+ * functions are "supposed" to work under any conditions.
  * Verify some files, display the "news.txt" file, create
  * the high score file, initialize all internal arrays, and
  * load the basic "user pref files".
- *
  * Be very careful to keep track of the order in which things
  * are initialized, in particular, the only thing *known* to
  * be available when this function is called is the "z-term.c"
  * package, and that may not be fully initialized until the
  * end of this function, when the default "user pref files"
  * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
- *
  * Note that this function attempts to verify the "news" file,
  * and the game aborts (cleanly) on failure, since without the
  * "news" file, it is likely that the "lib" folder has not been
  * correctly located.  Otherwise, the news file is displayed for
  * the user.
- *
  * Note that this function attempts to verify (or create) the
  * "high score" file, and the game aborts (cleanly) on failure,
  * since one of the most common "extraction" failures involves
@@ -2243,22 +2313,18 @@ static void init_angband_aux(cptr why)
  * code below, since the "lib/apex" directory, being empty in the
  * standard distributions, is most likely to be "lost", making it
  * impossible to create the high score file.
- *
  * Note that various things are initialized by this function,
  * including everything that was once done by "init_some_arrays".
- *
  * This initialization involves the parsing of special files
  * in the "lib/data" and sometimes the "lib/edit" directories.
- *
  * Note that the "template" files are initialized first, since they
  * often contain errors.  This means that macros and message recall
  * and things like that are not available until after they are done.
- *
  * We load the default "user pref files" here in case any "color"
  * changes are needed before character creation.
- *
  * Note that the "graf-xxx.prf" file must be loaded separately,
  * if needed, in the first (?) pass through "TERM_XTRA_REACT".
+ * </pre>
  */
 void init_angband(void)
 {
@@ -2604,8 +2670,9 @@ note("[
 
 }
 
-/*
- *  Get check sum in string form
+/*!
+ * @brief ¥µ¥à¥Á¥§¥Ã¥¯¾ðÊó¤ò½ÐÎÏ / Get check sum in string form
+ * @return ¥µ¥à¥Á¥§¥Ã¥¯¾ðÊó¤Îʸ»úÎó
  */
 cptr get_check_sum(void)
 {