X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Finit2.c;h=1a182ee5251c872590711541817efa0f545005e7;hb=a55fcffc6673dd5b7a79f87233961be0f4533b83;hp=0d050a31f2e19e7b21191f91e5251c2cb7962535;hpb=a575fc71f1654d5e2191010c749c2caf6f781cd1;p=hengband%2Fhengband.git diff --git a/src/init2.c b/src/init2.c index 0d050a31f..1a182ee52 100644 --- a/src/init2.c +++ b/src/init2.c @@ -1,83 +1,81 @@ -/* File: init2.c */ - -/* - * Copyright (c) 1997 Ben Harrison - * +/*! + * @file init2.c + * @brief ã²ã¼ã ãã¼ã¿åæå2 / Initialization (part 2) -BEN- + * @date 2014/01/28 + * @author + *
+ * 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+ * @details + *-#include -#endif /* CHECK_MODIFICATION_TIME */ -#endif - -/* + * 2014 Deskull rearranged comment for Doxygen.\n + *
* 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. + **/ +#include "angband.h" +#include "init.h" -/* +#ifndef MACINTOSH +#ifdef CHECK_MODIFICATION_TIME +#include
* 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. + **/ void init_file_paths(char *path) { @@ -114,28 +112,6 @@ void init_file_paths(char *path) /* Prepare to append to the Base Path */ tail = path + strlen(path); - -#ifdef VM - - /*** Use "flat" paths with VM/ESA ***/ - - /* Use "blank" path names */ - ANGBAND_DIR_APEX = string_make(""); - ANGBAND_DIR_BONE = string_make(""); - ANGBAND_DIR_DATA = string_make(""); - ANGBAND_DIR_EDIT = string_make(""); - ANGBAND_DIR_SCRIPT = string_make(""); - ANGBAND_DIR_FILE = string_make(""); - ANGBAND_DIR_HELP = string_make(""); - ANGBAND_DIR_INFO = string_make(""); - ANGBAND_DIR_SAVE = string_make(""); - ANGBAND_DIR_USER = string_make(""); - ANGBAND_DIR_XTRA = string_make(""); - - -#else /* VM */ - - /*** Build the sub-directory names ***/ /* Build a path name */ @@ -198,8 +174,6 @@ void init_file_paths(char *path) strcpy(tail, "xtra"); ANGBAND_DIR_XTRA = string_make(path); -#endif /* VM */ - #ifdef NeXT @@ -248,26 +222,27 @@ 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] = { NULL, #ifdef JP - "ʸˡ¥¨¥é¡¼", - "¸Å¤¤¥Õ¥¡¥¤¥ë", - "µÏ¿¥Ø¥Ã¥À¤¬¤Ê¤¤", - "ÉÔϢ³¥ì¥³¡¼¥É", - "¤ª¤«¤·¤Ê¥Õ¥é¥°Â¸ºß", - "̤ÄêµÁÌ¿Îá", - "¥á¥â¥êÉÔÂ", - "ºÂɸÈϰϳ°", - "°ú¿ôÉÔÂ", + "ææ³ã¨ã©ã¼", + "å¤ããã¡ã¤ã«", + "è¨é²ãããããªã", + "ä¸é£ç¶ã¬ã³ã¼ã", + "ããããªãã©ã°åå¨", + "æªå®ç¾©å½ä»¤", + "ã¡ã¢ãªä¸è¶³", + "座æ¨ç¯å²å¤", + "å¼æ°ä¸è¶³", + "æªå®ç¾©å°å½¢ã¿ã°", #else "parse error", "obsolete file", @@ -278,6 +253,7 @@ cptr err_str[PARSE_ERROR_MAX] = "out of memory", "coordinates out of bounds", "too few arguments", + "undefined terrain tag", #endif }; @@ -289,18 +265,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]; @@ -340,8 +323,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) { @@ -392,14 +379,30 @@ static errr init_info_raw(int fd, header *head) fd_read(fd, head->text_ptr, head->text_size); } + + if (head->tag_size) + { + /* Allocate the "*_tag" array */ + C_MAKE(head->tag_ptr, head->tag_size, char); + + /* Read the "*_tag" array */ + fd_read(fd, head->tag_ptr, head->tag_size); + } + + /* Success */ return (0); } -/* +/*! + * @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) { @@ -419,14 +422,22 @@ 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'). */ static errr init_info(cptr filename, header *head, - void **info, char **name, char **text) + void **info, char **name, char **text, char **tag) { int fd; @@ -445,11 +456,7 @@ static errr init_info(cptr filename, header *head, /*** Load the binary image file ***/ /* Build the filename */ -#ifdef JP - path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s_j.raw", filename)); -#else - path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s.raw", filename)); -#endif + path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename)); /* Attempt to open the "raw" file */ @@ -484,10 +491,12 @@ static errr init_info(cptr filename, header *head, /* Hack -- make "fake" arrays */ if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char); if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char); + if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char); if (info) (*info) = head->info_ptr; if (name) (*name) = head->name_ptr; if (text) (*text) = head->text_ptr; + if (tag) (*tag) = head->tag_ptr; /*** Load the ascii template file ***/ @@ -499,12 +508,7 @@ static errr init_info(cptr filename, header *head, fp = my_fopen(buf, "r"); /* Parse it */ -#ifdef JP - if (!fp) quit(format("'%s.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£", filename)); -#else - if (!fp) quit(format("Cannot open '%s.txt' file.", filename)); -#endif - + if (!fp) quit(format(_("'%s.txt'ãã¡ã¤ã«ããªã¼ãã³ã§ãã¾ããã", "Cannot open '%s.txt' file."), filename)); /* Parse the file */ err = init_info_txt(fp, buf, head, head->parse_info_txt); @@ -519,16 +523,16 @@ static errr init_info(cptr filename, header *head, #ifdef JP /* Error string */ - oops = ((err > 0) ? err_str[err] : "̤ÃΤÎ"); + oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "æªç¥ã®"); /* Oops */ - msg_format("'%s.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", filename, error_line); - msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops); - msg_format("¹½Ê¸ '%s'¡£", buf); + msg_format("'%s.txt'ãã¡ã¤ã«ã® %d è¡ç®ã«ã¨ã©ã¼ã", filename, error_line); + msg_format("ã¬ã³ã¼ã %d 㯠'%s' ã¨ã©ã¼ãããã¾ãã", error_idx, oops); + msg_format("æ§æ '%s'ã", buf); msg_print(NULL); /* Quit */ - quit(format("'%s.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼", filename)); + quit(format("'%s.txt'ãã¡ã¤ã«ã«ã¨ã©ã¼", filename)); #else /* Error string */ oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown"); @@ -546,17 +550,21 @@ static errr init_info(cptr filename, header *head, } + /*** Make final retouch on fake tags ***/ + + if (head->retouch) + { + (*head->retouch)(head); + } + + /*** Dump the binary image file ***/ /* File type is "DATA" */ FILE_TYPE(FILE_TYPE_DATA); /* Build the filename */ -#ifdef JP - path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s_j.raw", filename)); -#else - path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s.raw", filename)); -#endif + path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename)); /* Grab permissions */ @@ -586,6 +594,9 @@ static errr init_info(cptr filename, header *head, /* Dump the "*_text" array */ fd_write(fd, head->text_ptr, head->text_size); + /* Dump the "*_tag" array */ + fd_write(fd, head->tag_ptr, head->tag_size); + /* Close */ (void)fd_close(fd); } @@ -599,6 +610,7 @@ static errr init_info(cptr filename, header *head, /* Hack -- Free the "fake" arrays */ if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char); if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char); + if (tag) C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char); #endif /* ALLOW_TEMPLATES */ @@ -606,23 +618,13 @@ static errr init_info(cptr filename, header *head, /*** Load the binary image file ***/ /* Build the filename */ -#ifdef JP - path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s_j.raw", filename)); -#else - path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s.raw", filename)); -#endif - + path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename)); /* Attempt to open the "raw" file */ fd = fd_open(buf, O_RDONLY); /* Process existing "raw" file */ -#ifdef JP - if (fd < 0) quit(format("'%s_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£", filename)); -#else - if (fd < 0) quit(format("Cannot load '%s.raw' file.", filename)); -#endif - + if (fd < 0) quit(format(_("'%s_j.raw'ãã¡ã¤ã«ããã¼ãã§ãã¾ããã", "Cannot load '%s.raw' file."), filename)); /* Attempt to parse the "raw" file */ err = init_info_raw(fd, head); @@ -631,11 +633,7 @@ static errr init_info(cptr filename, header *head, (void)fd_close(fd); /* Error */ -#ifdef JP - if (err) quit(format("'%s_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£", filename)); -#else - if (err) quit(format("Cannot parse '%s.raw' file.", filename)); -#endif + if (err) quit(format(_("'%s_j.raw'ãã¡ã¤ã«ã解æã§ãã¾ããã", "Cannot parse '%s.raw' file."), filename)); #ifdef ALLOW_TEMPLATES } @@ -644,14 +642,17 @@ static errr init_info(cptr filename, header *head, if (info) (*info) = head->info_ptr; if (name) (*name) = head->name_ptr; if (text) (*text) = head->text_ptr; + if (tag) (*tag) = head->tag_ptr; /* Success */ return (0); } -/* +/*! + * @brief å°å½¢æ å ±èªã¿è¾¼ã¿ã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize the "f_info" array + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_f_info(void) { @@ -663,15 +664,20 @@ static errr init_f_info(void) /* Save a pointer to the parsing function */ f_head.parse_info_txt = parse_f_info; + /* Save a pointer to the retouch fake tags */ + f_head.retouch = retouch_f_info; + #endif /* ALLOW_TEMPLATES */ return init_info("f_info", &f_head, - (void*)&f_info, (void*)&f_name, NULL); + (void*)&f_info, &f_name, NULL, &f_tag); } -/* +/*! + * @brief ãã¼ã¹ã¢ã¤ãã æ å ±èªã¿è¾¼ã¿ã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize the "k_info" array + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_k_info(void) { @@ -686,13 +692,15 @@ static errr init_k_info(void) #endif /* ALLOW_TEMPLATES */ return init_info("k_info", &k_head, - (void*)&k_info, (void*)&k_name, (void*)&k_text); + (void*)&k_info, &k_name, &k_text, NULL); } -/* +/*! + * @brief åºå®ã¢ã¼ãã£ãã¡ã¯ãæ å ±èªã¿è¾¼ã¿ã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize the "a_info" array + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_a_info(void) { @@ -707,13 +715,15 @@ static errr init_a_info(void) #endif /* ALLOW_TEMPLATES */ return init_info("a_info", &a_head, - (void*)&a_info, (void*)&a_name, (void*)&a_text); + (void*)&a_info, &a_name, &a_text, NULL); } -/* +/*! + * @brief åºå®ã¢ã¼ãã£ãã¡ã¯ãæ å ±èªã¿è¾¼ã¿ã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize the "e_info" array + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_e_info(void) { @@ -728,13 +738,15 @@ static errr init_e_info(void) #endif /* ALLOW_TEMPLATES */ return init_info("e_info", &e_head, - (void*)&e_info, (void*)&e_name, (void*)&e_text); + (void*)&e_info, &e_name, &e_text, NULL); } -/* +/*! + * @brief ã¢ã³ã¹ã¿ã¼ç¨®ææ å ±èªã¿è¾¼ã¿ã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize the "r_info" array + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_r_info(void) { @@ -749,13 +761,15 @@ static errr init_r_info(void) #endif /* ALLOW_TEMPLATES */ return init_info("r_info", &r_head, - (void*)&r_info, (void*)&r_name, (void*)&r_text); + (void*)&r_info, &r_name, &r_text, NULL); } -/* +/*! + * @brief ãã³ã¸ã§ã³æ å ±èªã¿è¾¼ã¿ã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize the "d_info" array + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_d_info(void) { @@ -770,13 +784,15 @@ static errr init_d_info(void) #endif /* ALLOW_TEMPLATES */ return init_info("d_info", &d_head, - (void*)&d_info, (void*)&d_name, (void*)&d_text); + (void*)&d_info, &d_name, &d_text, NULL); } -/* +/*! + * @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'). */ @@ -793,12 +809,14 @@ errr init_v_info(void) #endif /* ALLOW_TEMPLATES */ return init_info("v_info", &v_head, - (void*)&v_info, (void*)&v_name, (void*)&v_text); + (void*)&v_info, &v_name, &v_text, NULL); } -/* +/*! + * @brief è·æ¥æè½æ å ±èªã¿è¾¼ã¿ã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize the "s_info" array + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_s_info(void) { @@ -813,12 +831,14 @@ static errr init_s_info(void) #endif /* ALLOW_TEMPLATES */ return init_info("s_info", &s_head, - (void*)&s_info, NULL, NULL); + (void*)&s_info, NULL, NULL, NULL); } -/* +/*! + * @brief è·æ¥éæ³æ å ±èªã¿è¾¼ã¿ã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize the "m_info" array + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_m_info(void) { @@ -833,15 +853,15 @@ static errr init_m_info(void) #endif /* ALLOW_TEMPLATES */ return init_info("m_info", &m_head, - (void*)&m_info, NULL, NULL); + (void*)&m_info, NULL, NULL, NULL); } /*** 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] = { @@ -1171,7 +1191,7 @@ static byte store_table[MAX_STORES][STORE_CHOICES][2] = /* Magic-User store */ { TV_RING, SV_RING_PROTECTION }, - { TV_RING, SV_RING_FEATHER_FALL }, + { TV_RING, SV_RING_LEVITATION_FALL }, { TV_RING, SV_RING_PROTECTION }, { TV_RING, SV_RING_RESIST_FIRE }, @@ -1337,10 +1357,10 @@ static byte store_table[MAX_STORES][STORE_CHOICES][2] = { TV_ARCANE_BOOK, 2 }, { TV_ARCANE_BOOK, 3 }, - { TV_ENCHANT_BOOK, 0 }, - { TV_ENCHANT_BOOK, 0 }, - { TV_ENCHANT_BOOK, 1 }, - { TV_ENCHANT_BOOK, 1 }, + { TV_CRAFT_BOOK, 0 }, + { TV_CRAFT_BOOK, 0 }, + { TV_CRAFT_BOOK, 1 }, + { TV_CRAFT_BOOK, 1 }, { TV_DAEMON_BOOK, 0 }, { TV_DAEMON_BOOK, 0 }, @@ -1351,6 +1371,11 @@ static byte store_table[MAX_STORES][STORE_CHOICES][2] = { TV_MUSIC_BOOK, 0 }, { TV_MUSIC_BOOK, 1 }, { TV_MUSIC_BOOK, 1 }, + + { TV_HEX_BOOK, 0 }, + { TV_HEX_BOOK, 0 }, + { TV_HEX_BOOK, 1 }, + { TV_HEX_BOOK, 1 }, }, { @@ -1391,8 +1416,10 @@ static byte store_table[MAX_STORES][STORE_CHOICES][2] = }; -/* +/*! + * @brief åºæ¬æ å ±èªã¿è¾¼ã¿ã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize misc. values + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_misc(void) { @@ -1403,8 +1430,10 @@ static errr init_misc(void) } -/* +/*! + * @brief çºæ å ±èªã¿è¾¼ã¿ã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize town array + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_towns(void) { @@ -1433,9 +1462,9 @@ static errr init_towns(void) /* Assume full stock */ /* - * ²æ¤¬²È¤¬ 20 ¥Ú¡¼¥¸¤Þ¤Ç»È¤¨¤ë±£¤·µ¡Ç½¤Î¤¿¤á¤Î½àÈ÷¡£ - * ¥ª¥×¥·¥ç¥ó¤¬Í¸ú¤Ç¤â¤½¤¦¤Ç¤Ê¤¯¤Æ¤â°ì±þ¥¹¥Ú¡¼¥¹ - * ¤òºî¤Ã¤Æ¤ª¤¯¡£ + * æã家ã 20 ãã¼ã¸ã¾ã§ä½¿ããé ãæ©è½ã®ããã®æºåã + * ãªãã·ã§ã³ãæå¹ã§ãããã§ãªãã¦ãä¸å¿ã¹ãã¼ã¹ + * ãä½ã£ã¦ããã */ if (j == STORE_HOME) { @@ -1466,7 +1495,7 @@ static errr init_towns(void) /* Scan the choices */ for (k = 0; k < STORE_CHOICES; k++) { - int k_idx; + KIND_OBJECT_IDX k_idx; /* Extract the tval/sval codes */ int tv = store_table[j][k][0]; @@ -1493,8 +1522,10 @@ static errr init_towns(void) return 0; } -/* +/*! + * @brief åºæ å ±åæåã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize buildings + * @return ã¨ã©ã¼ã³ã¼ã */ errr init_buildings(void) { @@ -1536,8 +1567,10 @@ errr init_buildings(void) } -/* +/*! + * @brief ã¯ã¨ã¹ãæ å ±åæåã®ã¡ã¤ã³ã«ã¼ãã³ / * Initialize quest array + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_quests(void) { @@ -1557,9 +1590,176 @@ 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); + + if (feat < 0) feat_tag_is_not_found = TRUE; + + return feat; +} + + +/*! + * @brief å°å½¢ã®æ±ç¨å®ç¾©ãã¿ã°ãéãã¦åå¾ãã / + * Initialize feature variables + * @return ã¨ã©ã¼ã³ã¼ã + */ +static errr init_feat_variables(void) +{ + FEAT_IDX i; + + /* Nothing */ + feat_none = f_tag_to_index_in_init("NONE"); + + /* Floor */ + feat_floor = f_tag_to_index_in_init("FLOOR"); + + /* Objects */ + feat_glyph = f_tag_to_index_in_init("GLYPH"); + feat_explosive_rune = f_tag_to_index_in_init("EXPLOSIVE_RUNE"); + feat_mirror = f_tag_to_index_in_init("MIRROR"); + + /* Doors */ + feat_door[DOOR_DOOR].open = f_tag_to_index_in_init("OPEN_DOOR"); + feat_door[DOOR_DOOR].broken = f_tag_to_index_in_init("BROKEN_DOOR"); + feat_door[DOOR_DOOR].closed = f_tag_to_index_in_init("CLOSED_DOOR"); + + /* Locked doors */ + for (i = 1; i < MAX_LJ_DOORS; i++) + { + s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i)); + if (door < 0) break; + feat_door[DOOR_DOOR].locked[i - 1] = door; + } + if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG; + feat_door[DOOR_DOOR].num_locked = i - 1; + + /* Jammed doors */ + for (i = 0; i < MAX_LJ_DOORS; i++) + { + s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i)); + if (door < 0) break; + feat_door[DOOR_DOOR].jammed[i] = door; + } + if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG; + feat_door[DOOR_DOOR].num_jammed = i; + + /* Glass doors */ + feat_door[DOOR_GLASS_DOOR].open = f_tag_to_index_in_init("OPEN_GLASS_DOOR"); + feat_door[DOOR_GLASS_DOOR].broken = f_tag_to_index_in_init("BROKEN_GLASS_DOOR"); + feat_door[DOOR_GLASS_DOOR].closed = f_tag_to_index_in_init("CLOSED_GLASS_DOOR"); + + /* Locked glass doors */ + for (i = 1; i < MAX_LJ_DOORS; i++) + { + s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i)); + if (door < 0) break; + feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door; + } + if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG; + feat_door[DOOR_GLASS_DOOR].num_locked = i - 1; + + /* Jammed glass doors */ + for (i = 0; i < MAX_LJ_DOORS; i++) + { + s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i)); + if (door < 0) break; + feat_door[DOOR_GLASS_DOOR].jammed[i] = door; + } + if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG; + feat_door[DOOR_GLASS_DOOR].num_jammed = i; + + /* Curtains */ + feat_door[DOOR_CURTAIN].open = f_tag_to_index_in_init("OPEN_CURTAIN"); + feat_door[DOOR_CURTAIN].broken = feat_door[DOOR_CURTAIN].open; + feat_door[DOOR_CURTAIN].closed = f_tag_to_index_in_init("CLOSED_CURTAIN"); + feat_door[DOOR_CURTAIN].locked[0] = feat_door[DOOR_CURTAIN].closed; + feat_door[DOOR_CURTAIN].num_locked = 1; + feat_door[DOOR_CURTAIN].jammed[0] = feat_door[DOOR_CURTAIN].closed; + feat_door[DOOR_CURTAIN].num_jammed = 1; + + /* Stairs */ + feat_up_stair = f_tag_to_index_in_init("UP_STAIR"); + feat_down_stair = f_tag_to_index_in_init("DOWN_STAIR"); + feat_entrance = f_tag_to_index_in_init("ENTRANCE"); + + /* Normal traps */ + init_normal_traps(); + + /* Special traps */ + feat_trap_open = f_tag_to_index_in_init("TRAP_OPEN"); + feat_trap_armageddon = f_tag_to_index_in_init("TRAP_ARMAGEDDON"); + feat_trap_piranha = f_tag_to_index_in_init("TRAP_PIRANHA"); + + /* Rubble */ + feat_rubble = f_tag_to_index_in_init("RUBBLE"); + + /* Seams */ + feat_magma_vein = f_tag_to_index_in_init("MAGMA_VEIN"); + feat_quartz_vein = f_tag_to_index_in_init("QUARTZ_VEIN"); + + /* Walls */ + feat_granite = f_tag_to_index_in_init("GRANITE"); + feat_permanent = f_tag_to_index_in_init("PERMANENT"); + + /* Glass floor */ + feat_glass_floor = f_tag_to_index_in_init("GLASS_FLOOR"); + + /* Glass walls */ + feat_glass_wall = f_tag_to_index_in_init("GLASS_WALL"); + feat_permanent_glass_wall = f_tag_to_index_in_init("PERMANENT_GLASS_WALL"); + + /* Pattern */ + feat_pattern_start = f_tag_to_index_in_init("PATTERN_START"); + feat_pattern_1 = f_tag_to_index_in_init("PATTERN_1"); + feat_pattern_2 = f_tag_to_index_in_init("PATTERN_2"); + feat_pattern_3 = f_tag_to_index_in_init("PATTERN_3"); + feat_pattern_4 = f_tag_to_index_in_init("PATTERN_4"); + feat_pattern_end = f_tag_to_index_in_init("PATTERN_END"); + feat_pattern_old = f_tag_to_index_in_init("PATTERN_OLD"); + feat_pattern_exit = f_tag_to_index_in_init("PATTERN_EXIT"); + feat_pattern_corrupted = f_tag_to_index_in_init("PATTERN_CORRUPTED"); + + /* Various */ + feat_black_market = f_tag_to_index_in_init("BLACK_MARKET"); + feat_town = f_tag_to_index_in_init("TOWN"); + + /* Terrains */ + feat_deep_water = f_tag_to_index_in_init("DEEP_WATER"); + feat_shallow_water = f_tag_to_index_in_init("SHALLOW_WATER"); + feat_deep_lava = f_tag_to_index_in_init("DEEP_LAVA"); + feat_shallow_lava = f_tag_to_index_in_init("SHALLOW_LAVA"); + feat_dirt = f_tag_to_index_in_init("DIRT"); + feat_grass = f_tag_to_index_in_init("GRASS"); + feat_flower = f_tag_to_index_in_init("FLOWER"); + feat_brake = f_tag_to_index_in_init("BRAKE"); + feat_tree = f_tag_to_index_in_init("TREE"); + feat_mountain = f_tag_to_index_in_init("MOUNTAIN"); + feat_swamp = f_tag_to_index_in_init("SWAMP"); + + /* Unknown grid (not detected) */ + feat_undetected = f_tag_to_index_in_init("UNDETECTED"); + + /* Wilderness terrains */ + init_wilderness_terrains(); + + return feat_tag_is_not_found ? PARSE_ERROR_UNDEFINED_TERRAIN_TAG : 0; +} + + +/*! + * @brief ãã®ä»ã®åææ å ±æ´æ° / * Initialize some other arrays + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_other(void) { @@ -1574,8 +1774,14 @@ static errr init_other(void) /* Allocate and Wipe the monster list */ C_MAKE(m_list, max_m_idx, monster_type); + /* Allocate and Wipe the monster process list */ + for (i = 0; i < MAX_MTIMED; i++) + { + C_MAKE(mproc_list[i], max_m_idx, s16b); + } + /* Allocate and Wipe the max dungeon level */ - C_MAKE(max_dlv, max_d_idx, s16b); + C_MAKE(max_dlv, max_d_idx, DEPTH); /* Allocate and wipe each line of the cave */ for (i = 0; i < MAX_HGT; i++) @@ -1596,10 +1802,10 @@ static errr init_other(void) C_MAKE(macro__buf, 1024, char); /* Quark variables */ - C_MAKE(quark__str, QUARK_MAX, cptr); + quark_init(); /* Message variables */ - C_MAKE(message__ptr, MESSAGE_MAX, u16b); + C_MAKE(message__ptr, MESSAGE_MAX, u32b); C_MAKE(message__buf, MESSAGE_BUF, char); /* Hack -- No messages yet */ @@ -1677,9 +1883,122 @@ static errr init_other(void) } +/*! + * @brief ãªãã¸ã§ã¯ãé åãåæåãã / + * Initialize some other arrays + * @return ã¨ã©ã¼ã³ã¼ã + */ +static errr init_object_alloc(void) +{ + int i, j; + object_kind *k_ptr; + alloc_entry *table; + s16b num[MAX_DEPTH]; + s16b aux[MAX_DEPTH]; + + + /*** Analyze object allocation info ***/ -/* + /* Clear the "aux" array */ + (void)C_WIPE(&aux, MAX_DEPTH, s16b); + + /* Clear the "num" array */ + (void)C_WIPE(&num, MAX_DEPTH, s16b); + + /* Free the old "alloc_kind_table" (if it exists) */ + if (alloc_kind_table) + { + C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry); + } + + /* Size of "alloc_kind_table" */ + alloc_kind_size = 0; + + /* Scan the objects */ + for (i = 1; i < max_k_idx; i++) + { + k_ptr = &k_info[i]; + + /* Scan allocation pairs */ + for (j = 0; j < 4; j++) + { + /* Count the "legal" entries */ + if (k_ptr->chance[j]) + { + /* Count the entries */ + alloc_kind_size++; + + /* Group by level */ + num[k_ptr->locale[j]]++; + } + } + } + + /* Collect the level indexes */ + for (i = 1; i < MAX_DEPTH; i++) + { + /* Group by level */ + num[i] += num[i-1]; + } + + /* Paranoia */ + if (!num[0]) quit(_("çºã®ã¢ã¤ãã ããªãï¼", "No town objects!")); + + /*** Initialize object allocation info ***/ + + /* Allocate the alloc_kind_table */ + C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry); + + /* Access the table entry */ + table = alloc_kind_table; + + /* Scan the objects */ + for (i = 1; i < max_k_idx; i++) + { + k_ptr = &k_info[i]; + + /* Scan allocation pairs */ + for (j = 0; j < 4; j++) + { + /* Count the "legal" entries */ + if (k_ptr->chance[j]) + { + int p, x, y, z; + + /* Extract the base level */ + x = k_ptr->locale[j]; + + /* Extract the base probability */ + p = (100 / k_ptr->chance[j]); + + /* Skip entries preceding our locale */ + y = (x > 0) ? num[x-1] : 0; + + /* Skip previous entries at this locale */ + z = y + aux[x]; + + /* Load the entry */ + table[z].index = (KIND_OBJECT_IDX)i; + table[z].level = (DEPTH)x; + table[z].prob1 = (PROB)p; + table[z].prob2 = (PROB)p; + table[z].prob3 = (PROB)p; + + /* Another entry complete for this locale */ + aux[x]++; + } + } + } + + /* Success */ + return (0); +} + + +/*! + * @brief ã¢ã³ã¹ã¿ã¼é åã¨çæãã¼ãã«ãåæåãã / * Initialize some other arrays + * @return ã¨ã©ã¼ã³ã¼ã */ static errr init_alloc(void) { @@ -1697,7 +2016,7 @@ static errr init_alloc(void) for (i = 1; i < max_r_idx; i++) { elements[i].tag = r_info[i].level; - elements[i].pointer = (void*)i; + elements[i].index = i; } tag_sort(elements, max_r_idx); @@ -1714,7 +2033,7 @@ static errr init_alloc(void) for (i = 1; i < max_r_idx; i++) { /* Get the i'th race */ - r_ptr = &r_info[(int)elements[i].pointer]; + r_ptr = &r_info[elements[i].index]; /* Count valid pairs */ if (r_ptr->rarity) @@ -1728,11 +2047,11 @@ static errr init_alloc(void) p = (100 / r_ptr->rarity); /* Load the entry */ - alloc_race_table[i].index = (int)elements[i].pointer; - alloc_race_table[i].level = x; - alloc_race_table[i].prob1 = p; - alloc_race_table[i].prob2 = p; - alloc_race_table[i].prob3 = p; + alloc_race_table[i].index = (KIND_OBJECT_IDX)elements[i].index; + alloc_race_table[i].level = (DEPTH)x; + alloc_race_table[i].prob1 = (PROB)p; + alloc_race_table[i].prob2 = (PROB)p; + alloc_race_table[i].prob3 = (PROB)p; } } @@ -1782,13 +2101,7 @@ static errr init_alloc(void) } /* Paranoia */ -#ifdef JP - if (!num[0]) quit("Ä®¤Î¥â¥ó¥¹¥¿¡¼¤¬¤Ê¤¤¡ª"); -#else - if (!num[0]) quit("No town monsters!"); -#endif - - + if (!num[0]) quit(_("çºã®ã¢ã³ã¹ã¿ã¼ããªãï¼", "No town monsters!")); /*** Initialize monster allocation info ***/ @@ -1844,8 +2157,10 @@ static errr init_alloc(void) -/* +/*! + * @brief ç»é¢å·¦ä¸ã«ã·ã¹ãã ã¡ãã»ã¼ã¸ã表示ãã / * Hack -- take notes on line 23 + * @return ãªã */ static void note(cptr str) { @@ -1856,12 +2171,16 @@ static void note(cptr str) -/* +/*! + * @brief å ¨ã²ã¼ã ãã¼ã¿èªã¿è¾¼ã¿ã®ãµãã«ã¼ãã³ / * Hack -- Explain a broken "lib" folder and quit (see below). - * + * @return ãªã + * @note + *
* 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. + **/ static void init_angband_aux(cptr why) { @@ -1870,16 +2189,16 @@ static void init_angband_aux(cptr why) #ifdef JP /* Explain */ - plog("'lib'¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Ê¤¤¤«²õ¤ì¤Æ¤¤¤ë¤è¤¦¤Ç¤¹¡£"); + plog("'lib'ãã£ã¬ã¯ããªãåå¨ããªããå£ãã¦ããããã§ãã"); /* More details */ - plog("¤Ò¤ç¤Ã¤È¤¹¤ë¤È¥¢¡¼¥«¥¤¥Ö¤¬Àµ¤·¤¯²òÅव¤ì¤Æ¤¤¤Ê¤¤¤Î¤«¤â¤·¤ì¤Þ¤»¤ó¡£"); + plog("ã²ãã£ã¨ããã¨ã¢ã¼ã«ã¤ããæ£ãã解åããã¦ããªãã®ããããã¾ããã"); /* Explain */ - plog("³ºÅö¤¹¤ë'README'¥Õ¥¡¥¤¥ë¤òÆɤó¤Ç³Îǧ¤·¤Æ¤ß¤Æ²¼¤µ¤¤¡£"); + plog("該å½ãã'README'ãã¡ã¤ã«ãèªãã§ç¢ºèªãã¦ã¿ã¦ä¸ããã"); /* Quit with error */ - quit("Ã×̿Ū¤Ê¥¨¥é¡¼¡£"); + quit("è´å½çãªã¨ã©ã¼ã"); #else /* Explain */ plog("The 'lib' directory is probably missing or broken."); @@ -1897,26 +2216,29 @@ static void init_angband_aux(cptr why) } -/* +/*! + * @brief å ¨ã²ã¼ã ãã¼ã¿èªã¿è¾¼ã¿ã®ã¡ã¤ã³ã«ã¼ãã³ / * Hack -- main Angband initialization entry point - * + * @return ãªã + * @note + *
+ * 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 @@ -1927,22 +2249,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". + **/ void init_angband(void) { @@ -1958,12 +2276,7 @@ void init_angband(void) /*** Verify the "news" file ***/ /* Build the filename */ -#ifdef JP - path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news_j.txt"); -#else - path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news.txt"); -#endif - + path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt")); /* Attempt to open the file */ fd = fd_open(buf, O_RDONLY); @@ -1974,12 +2287,7 @@ void init_angband(void) char why[1024]; /* Message */ -#ifdef JP - sprintf(why, "'%s'¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤Ç¤¤Þ¤»¤ó!", buf); -#else - sprintf(why, "Cannot access the '%s' file!", buf); -#endif - + sprintf(why, _("'%s'ãã¡ã¤ã«ã«ã¢ã¯ã»ã¹ã§ãã¾ãã!", "Cannot access the '%s' file!"), buf); /* Crash and burn */ init_angband_aux(why); @@ -1995,12 +2303,7 @@ void init_angband(void) Term_clear(); /* Build the filename */ -#ifdef JP - path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news_j.txt"); -#else - path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news.txt"); -#endif - + path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt")); /* Open the News file */ fp = my_fopen(buf, "r"); @@ -2022,7 +2325,7 @@ void init_angband(void) } /* Flush it */ - Term_fresh(); + Term_flush(); /*** Verify (or create) the "high score" file ***/ @@ -2054,12 +2357,7 @@ void init_angband(void) char why[1024]; /* Message */ -#ifdef JP - sprintf(why, "'%s'¥Õ¥¡¥¤¥ë¤òºîÀ®¤Ç¤¤Þ¤»¤ó!", buf); -#else - sprintf(why, "Cannot create the '%s' file!", buf); -#endif - + sprintf(why, _("'%s'ãã¡ã¤ã«ãä½æã§ãã¾ãã!", "Cannot create the '%s' file!"), buf); /* Crash and burn */ init_angband_aux(why); @@ -2069,81 +2367,49 @@ void init_angband(void) /* Close it */ (void)fd_close(fd); + put_title(); /*** Initialize some arrays ***/ /* Initialize misc. values */ -#ifdef JP -note("[ÊÑ¿ô¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹...(¤½¤Î¾)"); -#else - note("[Initializing values... (misc)]"); -#endif - -#ifdef JP -if (init_misc()) quit("¤½¤Î¾¤ÎÊÑ¿ô¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó"); -#else - if (init_misc()) quit("Cannot initialize misc. values"); -#endif - + note(_("[å¤æ°ãåæåãã¦ãã¾ã...(ãã®ä»)", "[Initializing values... (misc)]")); + if (init_misc()) quit(_("ãã®ä»ã®å¤æ°ãåæåã§ãã¾ãã", "Cannot initialize misc. values")); /* Initialize feature info */ #ifdef JP - note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ÃÏ·Á)]"); - if (init_f_info()) quit("ÃÏ·Á½é´ü²½ÉÔǽ"); + note("[ãã¼ã¿ã®åæåä¸... (å°å½¢)]"); + if (init_f_info()) quit("å°å½¢åæåä¸è½"); + if (init_feat_variables()) quit("å°å½¢åæåä¸è½"); #else note("[Initializing arrays... (features)]"); if (init_f_info()) quit("Cannot initialize features"); + if (init_feat_variables()) quit("Cannot initialize features"); #endif /* Initialize object info */ -#ifdef JP - note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥¢¥¤¥Æ¥à)]"); - if (init_k_info()) quit("¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ"); -#else - note("[Initializing arrays... (objects)]"); - if (init_k_info()) quit("Cannot initialize objects"); -#endif + note(_("[ãã¼ã¿ã®åæåä¸... (ã¢ã¤ãã )]", "[Initializing arrays... (objects)]")); + if (init_k_info()) quit(_("ã¢ã¤ãã åæåä¸è½", "Cannot initialize objects")); /* Initialize artifact info */ -#ifdef JP - note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ÅÁÀâ¤Î¥¢¥¤¥Æ¥à)]"); - if (init_a_info()) quit("ÅÁÀâ¤Î¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ"); -#else - note("[Initializing arrays... (artifacts)]"); - if (init_a_info()) quit("Cannot initialize artifacts"); -#endif + note(_("[ãã¼ã¿ã®åæåä¸... (ä¼èª¬ã®ã¢ã¤ãã )]", "[Initializing arrays... (artifacts)]")); + if (init_a_info()) quit(_("ä¼èª¬ã®ã¢ã¤ãã åæåä¸è½", "Cannot initialize artifacts")); /* Initialize ego-item info */ -#ifdef JP - note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à)]"); - if (init_e_info()) quit("̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ"); -#else - note("[Initializing arrays... (ego-items)]"); - if (init_e_info()) quit("Cannot initialize ego-items"); -#endif + note(_("[ãã¼ã¿ã®åæåä¸... (åã®ããã¢ã¤ãã )]", "[Initializing arrays... (ego-items)]")); + if (init_e_info()) quit(_("åã®ããã¢ã¤ãã åæåä¸è½", "Cannot initialize ego-items")); /* Initialize monster info */ -#ifdef JP - note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥â¥ó¥¹¥¿¡¼)]"); - if (init_r_info()) quit("¥â¥ó¥¹¥¿¡¼½é´ü²½ÉÔǽ"); -#else - note("[Initializing arrays... (monsters)]"); - if (init_r_info()) quit("Cannot initialize monsters"); -#endif + note(_("[ãã¼ã¿ã®åæåä¸... (ã¢ã³ã¹ã¿ã¼)]", "[Initializing arrays... (monsters)]")); + if (init_r_info()) quit(_("ã¢ã³ã¹ã¿ã¼åæåä¸è½", "Cannot initialize monsters")); /* Initialize dungeon info */ -#ifdef JP - note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥À¥ó¥¸¥ç¥ó)]"); - if (init_d_info()) quit("¥À¥ó¥¸¥ç¥ó½é´ü²½ÉÔǽ"); -#else - note("[Initializing arrays... (dungeon)]"); - if (init_d_info()) quit("Cannot initialize dungeon"); -#endif + note(_("[ãã¼ã¿ã®åæåä¸... (ãã³ã¸ã§ã³)]", "[Initializing arrays... (dungeon)]")); + if (init_d_info()) quit(_("ãã³ã¸ã§ã³åæåä¸è½", "Cannot initialize dungeon")); { int i; for (i = 1; i < max_d_idx; i++) @@ -2152,118 +2418,51 @@ if (init_misc()) quit(" } /* Initialize magic info */ -#ifdef JP - note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ËâË¡)]"); - if (init_m_info()) quit("ËâË¡½é´ü²½ÉÔǽ"); -#else - note("[Initializing arrays... (magic)]"); - if (init_m_info()) quit("Cannot initialize magic"); -#endif + note(_("[ãã¼ã¿ã®åæåä¸... (éæ³)]", "[Initializing arrays... (magic)]")); + if (init_m_info()) quit(_("éæ³åæåä¸è½", "Cannot initialize magic")); /* Initialize weapon_exp info */ -#ifdef JP - note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (½ÏÎýÅÙ)]"); - if (init_s_info()) quit("½ÏÎýÅÙ½é´ü²½ÉÔǽ"); -#else - note("[Initializing arrays... (skill)]"); - if (init_s_info()) quit("Cannot initialize skill"); -#endif + note(_("[ãã¼ã¿ã®åæåä¸... (ç練度)]", "[Initializing arrays... (skill)]")); + if (init_s_info()) quit(_("ç練度åæåä¸è½", "Cannot initialize skill")); /* Initialize wilderness array */ -#ifdef JP -note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (¹ÓÌî)]"); -#else - note("[Initializing arrays... (wilderness)]"); -#endif + note(_("[é åãåæåãã¦ãã¾ã... (èé)]", "[Initializing arrays... (wilderness)]")); -#ifdef JP -if (init_wilderness()) quit("¹ÓÌî¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó"); -#else - if (init_wilderness()) quit("Cannot initialize wilderness"); -#endif + if (init_wilderness()) quit(_("èéãåæåã§ãã¾ãã", "Cannot initialize wilderness")); /* Initialize town array */ -#ifdef JP -note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (³¹)]"); -#else - note("[Initializing arrays... (towns)]"); -#endif - -#ifdef JP -if (init_towns()) quit("³¹¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó"); -#else - if (init_towns()) quit("Cannot initialize towns"); -#endif + note(_("[é åãåæåãã¦ãã¾ã... (è¡)]", "[Initializing arrays... (towns)]")); + if (init_towns()) quit(_("è¡ãåæåã§ãã¾ãã", "Cannot initialize towns")); /* Initialize building array */ -#ifdef JP -note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (·úʪ)]"); -#else - note("[Initializing arrays... (buildings)]"); -#endif - -#ifdef JP -if (init_buildings()) quit("·úʪ¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó"); -#else - if (init_buildings()) quit("Cannot initialize buildings"); -#endif + note(_("[é åãåæåãã¦ãã¾ã... (建ç©)]", "[Initializing arrays... (buildings)]")); + if (init_buildings()) quit(_("建ç©ãåæåã§ãã¾ãã", "Cannot initialize buildings")); /* Initialize quest array */ -#ifdef JP -note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (¥¯¥¨¥¹¥È)]"); -#else - note("[Initializing arrays... (quests)]"); -#endif - -#ifdef JP -if (init_quests()) quit("¥¯¥¨¥¹¥È¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó"); -#else - if (init_quests()) quit("Cannot initialize quests"); -#endif - + note(_("[é åãåæåãã¦ãã¾ã... (ã¯ã¨ã¹ã)]", "[Initializing arrays... (quests)]")); + if (init_quests()) quit(_("ã¯ã¨ã¹ããåæåã§ãã¾ãã", "Cannot initialize quests")); /* Initialize vault info */ -#ifdef JP - if (init_v_info()) quit("vault ½é´ü²½ÉÔǽ"); -#else - if (init_v_info()) quit("Cannot initialize vaults"); -#endif - + if (init_v_info()) quit(_("vault åæåä¸è½", "Cannot initialize vaults")); /* Initialize some other arrays */ -#ifdef JP - note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¤½¤Î¾)]"); - if (init_other()) quit("¤½¤Î¾¤Î¥Ç¡¼¥¿½é´ü²½ÉÔǽ"); -#else - note("[Initializing arrays... (other)]"); - if (init_other()) quit("Cannot initialize other stuff"); -#endif + note(_("[ãã¼ã¿ã®åæåä¸... (ãã®ä»)]", "[Initializing arrays... (other)]")); + if (init_other()) quit(_("ãã®ä»ã®ãã¼ã¿åæåä¸è½", "Cannot initialize other stuff")); /* Initialize some other arrays */ -#ifdef JP - /* translation */ - note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥¢¥í¥±¡¼¥·¥ç¥ó)]"); - if (init_alloc()) quit("¥¢¥í¥±¡¼¥·¥ç¥ó¡¦¥¹¥¿¥Ã¥Õ½é´ü²½ÉÔǽ"); -#else - note("[Initializing arrays... (alloc)]"); - if (init_alloc()) quit("Cannot initialize alloc stuff"); -#endif + note(_("[ãã¼ã¿ã®åæåä¸... (ã¢ãã±ã¼ã·ã§ã³)]", "[Initializing arrays... (alloc)]")); + if (init_alloc()) quit(_("ã¢ãã±ã¼ã·ã§ã³ã»ã¹ã¿ããåæåä¸è½", "Cannot initialize alloc stuff")); /*** Load default user pref files ***/ /* Initialize feature info */ -#ifdef JP -note("[¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹...]"); -#else - note("[Initializing user pref files...]"); -#endif - + note(_("[ã¦ã¼ã¶ã¼è¨å®ãã¡ã¤ã«ãåæåãã¦ãã¾ã...]", "[Initializing user pref files...]")); /* Access the "basic" pref file */ strcpy(buf, "pref.prf"); @@ -2278,16 +2477,31 @@ note("[ process_pref_file(buf); /* Done */ -#ifdef JP - note("[½é´ü²½½ªÎ»]"); + note(_("[åæåçµäº]", "[Initialization complete]")); +} + +/*! + * @brief ã¿ã¤ãã«è¨è¿° + * @return ãªã + */ +static void put_title(void) +{ + char title[120]; + int col; +#if H_VER_EXTRA > 0 + sprintf(title, _("å¤æè®æ %d.%d.%d.%d(%s)", "Hengband %d.%d.%d.%d(%s)"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH, H_VER_EXTRA, #else - note("[Initialization complete]"); + sprintf(title, _("å¤æè®æ %d.%d.%d(%s)", "Hengband %d.%d.%d(%s)"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH, #endif - + IS_STABLE_VERSION ? _("å®å®ç", "Stable") : _("éçºç", "Developing")); + col = (80 - strlen(title)) / 2; + col = col < 0 ? 0 : col; + prt(title, VER_INFO_ROW, col); } -/* - * Get check sum in string form +/*! + * @brief ãµã ãã§ãã¯æ å ±ãåºå / Get check sum in string form + * @return ãµã ãã§ãã¯æ å ±ã®æåå */ cptr get_check_sum(void) {