3 * @brief ゲームデータ初期化2 / Initialization (part 2) -BEN-
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
11 * 2014 Deskull rearranged comment for Doxygen.\n
15 * This file is used to initialize various variables and arrays for the
16 * Angband game. Note the use of "fd_read()" and "fd_write()" to bypass
17 * the common limitation of "read()" and "write()" to only 32767 bytes
19 * Several of the arrays for Angband are built from "template" files in
20 * the "lib/file" directory, from which quick-load binary "image" files
21 * are constructed whenever they are not present in the "lib/data"
22 * directory, or if those files become obsolete, if we are allowed.
23 * Warning -- the "ascii" file parsers use a minor hack to collect the
24 * name and text information in a single pass. Thus, the game will not
25 * be able to load any template file with more than 20K of names or 60K
26 * of text, even though technically, up to 64K should be legal.
27 * The "init1.c" file is used only to parse the ascii template files,
28 * to create the binary image files. If you include the binary image
29 * files instead of the ascii template files, then you can undefine
30 * "ALLOW_TEMPLATES", saving about 20K by removing "init1.c". Note
31 * that the binary image files are extremely system dependant.
43 #ifdef CHECK_MODIFICATION_TIME
44 #include <sys/types.h>
46 #endif /* CHECK_MODIFICATION_TIME */
49 static void put_title(void);
52 * @brief 各データファイルを読み取るためのパスを取得する
53 * Find the default paths to all of our important sub-directories.
54 * @param path パス保管先の文字列
58 * The purpose of each sub-directory is described in "variable.c".
59 * All of the sub-directories should, by default, be located inside
60 * the main "lib" directory, whose location is very system dependant.
61 * This function takes a writable buffer, initially containing the
62 * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
63 * or a system dependant string, for example, ":lib:". The buffer
64 * must be large enough to contain at least 32 more characters.
65 * Various command line options may allow some of the important
66 * directories to be changed to user-specified directories, most
67 * importantly, the "info" and "user" and "save" directories,
68 * but this is done after this function, see "main.c".
69 * In general, the initial path should end in the appropriate "PATH_SEP"
70 * string. All of the "sub-directory" paths (created below or supplied
71 * by the user) will NOT end in the "PATH_SEP" string, see the special
72 * "path_build()" function in "util.c" for more information.
73 * Mega-Hack -- support fat raw files under NEXTSTEP, using special
74 * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
75 * requiring the directories to be created by hand by the user.
76 * Hack -- first we free all the strings, since this is known
77 * to succeed even if the strings have not been allocated yet,
78 * as long as the variables start out as "NULL". This allows
79 * this function to be called multiple times, for example, to
80 * try several base "path" values until a good one is found.
83 void init_file_paths(char *path)
87 #ifdef PRIVATE_USER_PATH
89 #endif /* PRIVATE_USER_PATH */
91 /*** Free everything ***/
93 /* Free the main path */
94 string_free(ANGBAND_DIR);
96 /* Free the sub-paths */
97 string_free(ANGBAND_DIR_APEX);
98 string_free(ANGBAND_DIR_BONE);
99 string_free(ANGBAND_DIR_DATA);
100 string_free(ANGBAND_DIR_EDIT);
101 string_free(ANGBAND_DIR_SCRIPT);
102 string_free(ANGBAND_DIR_FILE);
103 string_free(ANGBAND_DIR_HELP);
104 string_free(ANGBAND_DIR_INFO);
105 string_free(ANGBAND_DIR_SAVE);
106 string_free(ANGBAND_DIR_USER);
107 string_free(ANGBAND_DIR_XTRA);
110 /*** Prepare the "path" ***/
112 /* Hack -- save the main directory */
113 ANGBAND_DIR = string_make(path);
115 /* Prepare to append to the Base Path */
116 tail = path + strlen(path);
118 /*** Build the sub-directory names ***/
120 /* Build a path name */
121 strcpy(tail, "apex");
122 ANGBAND_DIR_APEX = string_make(path);
124 /* Build a path name */
125 strcpy(tail, "bone");
126 ANGBAND_DIR_BONE = string_make(path);
128 /* Build a path name */
129 strcpy(tail, "data");
130 ANGBAND_DIR_DATA = string_make(path);
132 /* Build a path name */
133 strcpy(tail, "edit");
134 ANGBAND_DIR_EDIT = string_make(path);
136 /* Build a path name */
137 strcpy(tail, "script");
138 ANGBAND_DIR_SCRIPT = string_make(path);
140 /* Build a path name */
141 strcpy(tail, "file");
142 ANGBAND_DIR_FILE = string_make(path);
144 /* Build a path name */
145 strcpy(tail, "help");
146 ANGBAND_DIR_HELP = string_make(path);
148 /* Build a path name */
149 strcpy(tail, "info");
150 ANGBAND_DIR_INFO = string_make(path);
152 /* Build a path name */
153 strcpy(tail, "pref");
154 ANGBAND_DIR_PREF = string_make(path);
156 /* Build a path name */
157 strcpy(tail, "save");
158 ANGBAND_DIR_SAVE = string_make(path);
160 #ifdef PRIVATE_USER_PATH
162 /* Build the path to the user specific directory */
163 path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
165 /* Build a relative path name */
166 ANGBAND_DIR_USER = string_make(buf);
168 #else /* PRIVATE_USER_PATH */
170 /* Build a path name */
171 strcpy(tail, "user");
172 ANGBAND_DIR_USER = string_make(path);
174 #endif /* PRIVATE_USER_PATH */
176 /* Build a path name */
177 strcpy(tail, "xtra");
178 ANGBAND_DIR_XTRA = string_make(path);
183 /* Allow "fat binary" usage with NeXT */
204 /* Use special directory */
207 /* Forget the old path name */
208 string_free(ANGBAND_DIR_DATA);
210 /* Build a new path name */
211 sprintf(tail, "data-%s", next);
212 ANGBAND_DIR_DATA = string_make(path);
222 #ifdef ALLOW_TEMPLATES
226 * Hack -- help give useful error messages
228 int error_idx; /*!< データ読み込み/初期化時に汎用的にエラーコードを保存するグローバル変数 */
229 int error_line; /*!< データ読み込み/初期化時に汎用的にエラー行数を保存するグローバル変数 */
233 * エラーメッセージの名称定義 / Standard error message text
235 concptr err_str[PARSE_ERROR_MAX] =
252 "missing record header",
253 "non-sequential records",
254 "invalid flag specification",
255 "undefined directive",
257 "coordinates out of bounds",
259 "undefined terrain tag",
265 #endif /* ALLOW_TEMPLATES */
271 header v_head; /*!< Vault情報のヘッダ構造体 */
272 header f_head; /*!< 地形情報のヘッダ構造体 */
273 header k_head; /*!< ペースアイテム情報のヘッダ構造体 */
274 header a_head; /*!< 固定アーティファクト情報のヘッダ構造体 */
275 header e_head; /*!< アイテムエゴ情報のヘッダ構造体 */
276 header r_head; /*!< モンスター種族情報のヘッダ構造体 */
277 header d_head; /*!< ダンジョン情報のヘッダ構造体 */
278 header s_head; /*!< プレイヤー職業技能情報のヘッダ構造体 */
279 header m_head; /*!< プレイヤー職業魔法情報のヘッダ構造体 */
281 #ifdef CHECK_MODIFICATION_TIME
284 * @brief テキストファイルとrawファイルの更新時刻を比較する
285 * Find the default paths to all of our important sub-directories.
286 * @param fd ファイルディスクリプタ
287 * @param template_file ファイル名
288 * @return テキストの方が新しいか、rawファイルがなく更新の必要がある場合-1、更新の必要がない場合0。
290 static errr check_modification_date(int fd, concptr template_file)
294 struct stat txt_stat, raw_stat;
296 /* Build the filename */
297 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, template_file);
299 /* Access stats on text file */
300 if (stat(buf, &txt_stat))
302 /* No text file - continue */
305 /* Access stats on raw file */
306 else if (fstat(fd, &raw_stat))
312 /* Ensure text file is not newer than raw file */
313 else if (txt_stat.st_mtime > raw_stat.st_mtime)
315 /* Reprocess text file */
322 #endif /* CHECK_MODIFICATION_TIME */
326 /*** Initialize from binary image files ***/
330 * @brief rawファイルからのデータの読み取り処理
331 * Initialize the "*_info" array, by parsing a binary "image" file
332 * @param fd ファイルディスクリプタ
333 * @param head rawファイルのヘッダ
336 static errr init_info_raw(int fd, header *head)
340 /* Read and Verify the header */
341 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
342 (test.v_major != head->v_major) ||
343 (test.v_minor != head->v_minor) ||
344 (test.v_patch != head->v_patch) ||
345 (test.info_num != head->info_num) ||
346 (test.info_len != head->info_len) ||
347 (test.head_size != head->head_size) ||
348 (test.info_size != head->info_size))
355 /* Accept the header */
359 /* Allocate the "*_info" array */
360 C_MAKE(head->info_ptr, head->info_size, char);
362 /* Read the "*_info" array */
363 fd_read(fd, head->info_ptr, head->info_size);
368 /* Allocate the "*_name" array */
369 C_MAKE(head->name_ptr, head->name_size, char);
371 /* Read the "*_name" array */
372 fd_read(fd, head->name_ptr, head->name_size);
378 /* Allocate the "*_text" array */
379 C_MAKE(head->text_ptr, head->text_size, char);
381 /* Read the "*_text" array */
382 fd_read(fd, head->text_ptr, head->text_size);
388 /* Allocate the "*_tag" array */
389 C_MAKE(head->tag_ptr, head->tag_size, char);
391 /* Read the "*_tag" array */
392 fd_read(fd, head->tag_ptr, head->tag_size);
404 * Initialize the header of an *_info.raw file.
405 * @param head rawファイルのヘッダ
410 static void init_header(header *head, IDX num, int len)
412 /* Save the "version" */
413 head->v_major = FAKE_VER_MAJOR;
414 head->v_minor = FAKE_VER_MINOR;
415 head->v_patch = FAKE_VER_PATCH;
418 /* Save the "record" information */
419 head->info_num = (IDX)num;
420 head->info_len = len;
422 /* Save the size of "*_head" and "*_info" */
423 head->head_size = sizeof(header);
424 head->info_size = head->info_num * head->info_len;
430 * Initialize the "*_info" array
431 * @param filename ファイル名(拡張子txt/raw)
432 * @param head 処理に用いるヘッダ構造体
433 * @param info データ保管先の構造体ポインタ
434 * @param name 名称用可変文字列の保管先
435 * @param text テキスト用可変文字列の保管先
436 * @param tag タグ用可変文字列の保管先
439 * Note that we let each entry have a unique "name" and "text" string,
440 * even if the string happens to be empty (everyone has a unique '\0').
442 static errr init_info(concptr filename, header *head,
443 void **info, char **name, char **text, char **tag)
447 BIT_FLAGS mode = 0644;
457 #ifdef ALLOW_TEMPLATES
459 /*** Load the binary image file ***/
461 /* Build the filename */
462 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
465 /* Attempt to open the "raw" file */
466 fd = fd_open(buf, O_RDONLY);
468 /* Process existing "raw" file */
471 #ifdef CHECK_MODIFICATION_TIME
473 err = check_modification_date(fd, format("%s.txt", filename));
475 #endif /* CHECK_MODIFICATION_TIME */
477 /* Attempt to parse the "raw" file */
479 err = init_info_raw(fd, head);
486 /* Do we have to parse the *.txt file? */
489 /*** Make the fake arrays ***/
491 /* Allocate the "*_info" array */
492 C_MAKE(head->info_ptr, head->info_size, char);
494 /* Hack -- make "fake" arrays */
495 if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
496 if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
497 if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
499 if (info) (*info) = head->info_ptr;
500 if (name) (*name) = head->name_ptr;
501 if (text) (*text) = head->text_ptr;
502 if (tag) (*tag) = head->tag_ptr;
504 /*** Load the ascii template file ***/
506 /* Build the filename */
508 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
511 fp = my_fopen(buf, "r");
514 if (!fp) quit(format(_("'%s.txt'ファイルをオープンできません。", "Cannot open '%s.txt' file."), filename));
517 err = init_info_txt(fp, buf, head, head->parse_info_txt);
529 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "未知の");
531 msg_format("'%s.txt'ファイルの %d 行目にエラー。", filename, error_line);
532 msg_format("レコード %d は '%s' エラーがあります。", error_idx, oops);
533 msg_format("構文 '%s'。", buf);
537 quit(format("'%s.txt'ファイルにエラー", filename));
540 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
542 msg_format("Error %d at line %d of '%s.txt'.", err, error_line, filename);
543 msg_format("Record %d contains a '%s' error.", error_idx, oops);
544 msg_format("Parsing '%s'.", buf);
548 quit(format("Error in '%s.txt' file.", filename));
554 /*** Make final retouch on fake tags ***/
558 (*head->retouch)(head);
562 /*** Dump the binary image file ***/
564 /* File type is "DATA" */
565 FILE_TYPE(FILE_TYPE_DATA);
567 /* Build the filename */
568 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
571 /* Grab permissions */
574 /* Kill the old file */
577 /* Attempt to create the raw file */
578 fd = fd_make(buf, mode);
580 /* Drop permissions */
583 /* Dump to the file */
587 fd_write(fd, (concptr)(head), head->head_size);
589 /* Dump the "*_info" array */
590 fd_write(fd, head->info_ptr, head->info_size);
592 /* Dump the "*_name" array */
593 fd_write(fd, head->name_ptr, head->name_size);
595 /* Dump the "*_text" array */
596 fd_write(fd, head->text_ptr, head->text_size);
598 /* Dump the "*_tag" array */
599 fd_write(fd, head->tag_ptr, head->tag_size);
606 /*** Kill the fake arrays ***/
608 /* Free the "*_info" array */
609 C_KILL(head->info_ptr, head->info_size, char);
611 /* Hack -- Free the "fake" arrays */
612 if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char);
613 if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char);
614 if (tag) C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char);
616 #endif /* ALLOW_TEMPLATES */
619 /*** Load the binary image file ***/
621 /* Build the filename */
622 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
624 /* Attempt to open the "raw" file */
625 fd = fd_open(buf, O_RDONLY);
627 /* Process existing "raw" file */
628 if (fd < 0) quit(format(_("'%s_j.raw'ファイルをロードできません。", "Cannot load '%s.raw' file."), filename));
630 /* Attempt to parse the "raw" file */
631 err = init_info_raw(fd, head);
637 if (err) quit(format(_("'%s_j.raw'ファイルを解析できません。", "Cannot parse '%s.raw' file."), filename));
639 #ifdef ALLOW_TEMPLATES
643 if (info) (*info) = head->info_ptr;
644 if (name) (*name) = head->name_ptr;
645 if (text) (*text) = head->text_ptr;
646 if (tag) (*tag) = head->tag_ptr;
654 * @brief 地形情報読み込みのメインルーチン /
655 * Initialize the "f_info" array
658 static errr init_f_info(void)
660 /* Init the header */
661 init_header(&f_head, max_f_idx, sizeof(feature_type));
663 #ifdef ALLOW_TEMPLATES
665 /* Save a pointer to the parsing function */
666 f_head.parse_info_txt = parse_f_info;
668 /* Save a pointer to the retouch fake tags */
669 f_head.retouch = retouch_f_info;
671 #endif /* ALLOW_TEMPLATES */
673 return init_info("f_info", &f_head,
674 (void*)&f_info, &f_name, NULL, &f_tag);
679 * @brief ベースアイテム情報読み込みのメインルーチン /
680 * Initialize the "k_info" array
683 static errr init_k_info(void)
685 /* Init the header */
686 init_header(&k_head, max_k_idx, sizeof(object_kind));
688 #ifdef ALLOW_TEMPLATES
690 /* Save a pointer to the parsing function */
691 k_head.parse_info_txt = parse_k_info;
693 #endif /* ALLOW_TEMPLATES */
695 return init_info("k_info", &k_head,
696 (void*)&k_info, &k_name, &k_text, NULL);
702 * @brief 固定アーティファクト情報読み込みのメインルーチン /
703 * Initialize the "a_info" array
706 static errr init_a_info(void)
708 /* Init the header */
709 init_header(&a_head, max_a_idx, sizeof(artifact_type));
711 #ifdef ALLOW_TEMPLATES
713 /* Save a pointer to the parsing function */
714 a_head.parse_info_txt = parse_a_info;
716 #endif /* ALLOW_TEMPLATES */
718 return init_info("a_info", &a_head,
719 (void*)&a_info, &a_name, &a_text, NULL);
725 * @brief 固定アーティファクト情報読み込みのメインルーチン /
726 * Initialize the "e_info" array
729 static errr init_e_info(void)
731 /* Init the header */
732 init_header(&e_head, max_e_idx, sizeof(ego_item_type));
734 #ifdef ALLOW_TEMPLATES
736 /* Save a pointer to the parsing function */
737 e_head.parse_info_txt = parse_e_info;
739 #endif /* ALLOW_TEMPLATES */
741 return init_info("e_info", &e_head,
742 (void*)&e_info, &e_name, &e_text, NULL);
748 * @brief モンスター種族情報読み込みのメインルーチン /
749 * Initialize the "r_info" array
752 static errr init_r_info(void)
754 /* Init the header */
755 init_header(&r_head, max_r_idx, sizeof(monster_race));
757 #ifdef ALLOW_TEMPLATES
759 /* Save a pointer to the parsing function */
760 r_head.parse_info_txt = parse_r_info;
762 #endif /* ALLOW_TEMPLATES */
764 return init_info("r_info", &r_head,
765 (void*)&r_info, &r_name, &r_text, NULL);
771 * @brief ダンジョン情報読み込みのメインルーチン /
772 * Initialize the "d_info" array
775 static errr init_d_info(void)
777 /* Init the header */
778 init_header(&d_head, max_d_idx, sizeof(dungeon_type));
780 #ifdef ALLOW_TEMPLATES
782 /* Save a pointer to the parsing function */
783 d_head.parse_info_txt = parse_d_info;
785 #endif /* ALLOW_TEMPLATES */
787 return init_info("d_info", &d_head,
788 (void*)&d_info, &d_name, &d_text, NULL);
793 * @brief Vault情報読み込みのメインルーチン /
794 * Initialize the "v_info" array
797 * Note that we let each entry have a unique "name" and "text" string,
798 * even if the string happens to be empty (everyone has a unique '\0').
800 errr init_v_info(void)
802 /* Init the header */
803 init_header(&v_head, max_v_idx, sizeof(vault_type));
805 #ifdef ALLOW_TEMPLATES
807 /* Save a pointer to the parsing function */
808 v_head.parse_info_txt = parse_v_info;
810 #endif /* ALLOW_TEMPLATES */
812 return init_info("v_info", &v_head,
813 (void*)&v_info, &v_name, &v_text, NULL);
818 * @brief 職業技能情報読み込みのメインルーチン /
819 * Initialize the "s_info" array
822 static errr init_s_info(void)
824 /* Init the header */
825 init_header(&s_head, MAX_CLASS, sizeof(skill_table));
827 #ifdef ALLOW_TEMPLATES
829 /* Save a pointer to the parsing function */
830 s_head.parse_info_txt = parse_s_info;
832 #endif /* ALLOW_TEMPLATES */
834 return init_info("s_info", &s_head,
835 (void*)&s_info, NULL, NULL, NULL);
840 * @brief 職業魔法情報読み込みのメインルーチン /
841 * Initialize the "m_info" array
844 static errr init_m_info(void)
846 /* Init the header */
847 init_header(&m_head, MAX_CLASS, sizeof(player_magic));
849 #ifdef ALLOW_TEMPLATES
851 /* Save a pointer to the parsing function */
852 m_head.parse_info_txt = parse_m_info;
854 #endif /* ALLOW_TEMPLATES */
856 return init_info("m_info", &m_head,
857 (void*)&m_info, NULL, NULL, NULL);
865 * @brief 基本情報読み込みのメインルーチン /
866 * Initialize misc. values
869 static errr init_misc(void)
871 /* Initialize the values */
872 process_dungeon_file("misc.txt", 0, 0, 0, 0);
879 * @brief 町情報読み込みのメインルーチン /
880 * Initialize town array
883 static errr init_towns(void)
887 /*** Prepare the Towns ***/
889 /* Allocate the towns */
890 C_MAKE(town, max_towns, town_type);
892 for (i = 1; i < max_towns; i++)
894 /*** Prepare the Stores ***/
896 /* Allocate the stores */
897 C_MAKE(town[i].store, MAX_STORES, store_type);
899 /* Fill in each store */
900 for (j = 0; j < MAX_STORES; j++)
902 /* Access the store */
903 store_type *st_ptr = &town[i].store[j];
905 if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME)) continue;
907 /* Assume full stock */
910 * 我が家が 20 ページまで使える隠し機能のための準備。
911 * オプションが有効でもそうでなくても一応スペース
916 st_ptr->stock_size = (STORE_INVEN_MAX * 10);
918 else if (j == STORE_MUSEUM)
920 st_ptr->stock_size = (STORE_INVEN_MAX * 50);
924 st_ptr->stock_size = STORE_INVEN_MAX;
926 /* Allocate the stock */
927 C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type);
929 /* No table for the black market or home */
930 if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM)) continue;
932 /* Assume full table */
933 st_ptr->table_size = STORE_CHOICES;
935 /* Allocate the stock */
936 C_MAKE(st_ptr->table, st_ptr->table_size, s16b);
938 /* Scan the choices */
939 for (k = 0; k < STORE_CHOICES; k++)
941 KIND_OBJECT_IDX k_idx;
943 /* Extract the tval/sval codes */
944 int tv = store_table[j][k][0];
945 int sv = store_table[j][k][1];
948 for (k_idx = 1; k_idx < max_k_idx; k_idx++)
950 object_kind *k_ptr = &k_info[k_idx];
953 if ((k_ptr->tval == tv) && (k_ptr->sval == sv)) break;
957 if (k_idx == max_k_idx) continue;
959 /* Add that item index to the table */
960 st_ptr->table[st_ptr->table_num++] = k_idx;
969 * @brief 店情報初期化のメインルーチン /
970 * Initialize buildings
973 errr init_buildings(void)
977 for (i = 0; i < MAX_BLDG; i++)
979 building[i].name[0] = '\0';
980 building[i].owner_name[0] = '\0';
981 building[i].owner_race[0] = '\0';
983 for (j = 0; j < 8; j++)
985 building[i].act_names[j][0] = '\0';
986 building[i].member_costs[j] = 0;
987 building[i].other_costs[j] = 0;
988 building[i].letters[j] = 0;
989 building[i].actions[j] = 0;
990 building[i].action_restr[j] = 0;
993 for (j = 0; j < MAX_CLASS; j++)
995 building[i].member_class[j] = 0;
998 for (j = 0; j < MAX_RACES; j++)
1000 building[i].member_race[j] = 0;
1003 for (j = 0; j < MAX_MAGIC+1; j++)
1005 building[i].member_realm[j] = 0;
1014 * @brief クエスト情報初期化のメインルーチン /
1015 * Initialize quest array
1018 static errr init_quests(void)
1022 /*** Prepare the quests ***/
1024 /* Allocate the quests */
1025 C_MAKE(quest, max_q_idx, quest_type);
1027 /* Set all quest to "untaken" */
1028 for (i = 0; i < max_q_idx; i++)
1030 quest[i].status = QUEST_STATUS_UNTAKEN;
1036 /*! 地形タグ情報から地形IDを得られなかった場合にTRUEを返すグローバル変数 */
1037 static bool feat_tag_is_not_found = FALSE;
1040 * @brief 地形タグからIDを得る /
1041 * Initialize quest array
1044 s16b f_tag_to_index_in_init(concptr str)
1046 FEAT_IDX feat = f_tag_to_index(str);
1048 if (feat < 0) feat_tag_is_not_found = TRUE;
1055 * @brief 地形の汎用定義をタグを通じて取得する /
1056 * Initialize feature variables
1059 static errr init_feat_variables(void)
1064 feat_none = f_tag_to_index_in_init("NONE");
1067 feat_floor = f_tag_to_index_in_init("FLOOR");
1070 feat_glyph = f_tag_to_index_in_init("GLYPH");
1071 feat_explosive_rune = f_tag_to_index_in_init("EXPLOSIVE_RUNE");
1072 feat_mirror = f_tag_to_index_in_init("MIRROR");
1075 feat_door[DOOR_DOOR].open = f_tag_to_index_in_init("OPEN_DOOR");
1076 feat_door[DOOR_DOOR].broken = f_tag_to_index_in_init("BROKEN_DOOR");
1077 feat_door[DOOR_DOOR].closed = f_tag_to_index_in_init("CLOSED_DOOR");
1080 for (i = 1; i < MAX_LJ_DOORS; i++)
1082 s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
1083 if (door < 0) break;
1084 feat_door[DOOR_DOOR].locked[i - 1] = door;
1086 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1087 feat_door[DOOR_DOOR].num_locked = i - 1;
1090 for (i = 0; i < MAX_LJ_DOORS; i++)
1092 s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
1093 if (door < 0) break;
1094 feat_door[DOOR_DOOR].jammed[i] = door;
1096 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1097 feat_door[DOOR_DOOR].num_jammed = i;
1100 feat_door[DOOR_GLASS_DOOR].open = f_tag_to_index_in_init("OPEN_GLASS_DOOR");
1101 feat_door[DOOR_GLASS_DOOR].broken = f_tag_to_index_in_init("BROKEN_GLASS_DOOR");
1102 feat_door[DOOR_GLASS_DOOR].closed = f_tag_to_index_in_init("CLOSED_GLASS_DOOR");
1104 /* Locked glass doors */
1105 for (i = 1; i < MAX_LJ_DOORS; i++)
1107 s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
1108 if (door < 0) break;
1109 feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door;
1111 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1112 feat_door[DOOR_GLASS_DOOR].num_locked = i - 1;
1114 /* Jammed glass doors */
1115 for (i = 0; i < MAX_LJ_DOORS; i++)
1117 s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
1118 if (door < 0) break;
1119 feat_door[DOOR_GLASS_DOOR].jammed[i] = door;
1121 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1122 feat_door[DOOR_GLASS_DOOR].num_jammed = i;
1125 feat_door[DOOR_CURTAIN].open = f_tag_to_index_in_init("OPEN_CURTAIN");
1126 feat_door[DOOR_CURTAIN].broken = feat_door[DOOR_CURTAIN].open;
1127 feat_door[DOOR_CURTAIN].closed = f_tag_to_index_in_init("CLOSED_CURTAIN");
1128 feat_door[DOOR_CURTAIN].locked[0] = feat_door[DOOR_CURTAIN].closed;
1129 feat_door[DOOR_CURTAIN].num_locked = 1;
1130 feat_door[DOOR_CURTAIN].jammed[0] = feat_door[DOOR_CURTAIN].closed;
1131 feat_door[DOOR_CURTAIN].num_jammed = 1;
1134 feat_up_stair = f_tag_to_index_in_init("UP_STAIR");
1135 feat_down_stair = f_tag_to_index_in_init("DOWN_STAIR");
1136 feat_entrance = f_tag_to_index_in_init("ENTRANCE");
1139 init_normal_traps();
1142 feat_trap_open = f_tag_to_index_in_init("TRAP_OPEN");
1143 feat_trap_armageddon = f_tag_to_index_in_init("TRAP_ARMAGEDDON");
1144 feat_trap_piranha = f_tag_to_index_in_init("TRAP_PIRANHA");
1147 feat_rubble = f_tag_to_index_in_init("RUBBLE");
1150 feat_magma_vein = f_tag_to_index_in_init("MAGMA_VEIN");
1151 feat_quartz_vein = f_tag_to_index_in_init("QUARTZ_VEIN");
1154 feat_granite = f_tag_to_index_in_init("GRANITE");
1155 feat_permanent = f_tag_to_index_in_init("PERMANENT");
1158 feat_glass_floor = f_tag_to_index_in_init("GLASS_FLOOR");
1161 feat_glass_wall = f_tag_to_index_in_init("GLASS_WALL");
1162 feat_permanent_glass_wall = f_tag_to_index_in_init("PERMANENT_GLASS_WALL");
1165 feat_pattern_start = f_tag_to_index_in_init("PATTERN_START");
1166 feat_pattern_1 = f_tag_to_index_in_init("PATTERN_1");
1167 feat_pattern_2 = f_tag_to_index_in_init("PATTERN_2");
1168 feat_pattern_3 = f_tag_to_index_in_init("PATTERN_3");
1169 feat_pattern_4 = f_tag_to_index_in_init("PATTERN_4");
1170 feat_pattern_end = f_tag_to_index_in_init("PATTERN_END");
1171 feat_pattern_old = f_tag_to_index_in_init("PATTERN_OLD");
1172 feat_pattern_exit = f_tag_to_index_in_init("PATTERN_EXIT");
1173 feat_pattern_corrupted = f_tag_to_index_in_init("PATTERN_CORRUPTED");
1176 feat_black_market = f_tag_to_index_in_init("BLACK_MARKET");
1177 feat_town = f_tag_to_index_in_init("TOWN");
1180 feat_deep_water = f_tag_to_index_in_init("DEEP_WATER");
1181 feat_shallow_water = f_tag_to_index_in_init("SHALLOW_WATER");
1182 feat_deep_lava = f_tag_to_index_in_init("DEEP_LAVA");
1183 feat_shallow_lava = f_tag_to_index_in_init("SHALLOW_LAVA");
1184 feat_heavy_cold_zone = f_tag_to_index_in_init("HEAVY_COLD_ZONE");
1185 feat_cold_zone = f_tag_to_index_in_init("COLD_ZONE");
1186 feat_heavy_electrical_zone = f_tag_to_index_in_init("HEAVY_ELECTRICAL_ZONE");
1187 feat_electrical_zone = f_tag_to_index_in_init("ELECTRICAL_ZONE");
1188 feat_deep_acid_puddle = f_tag_to_index_in_init("DEEP_ACID_PUDDLE");
1189 feat_shallow_acid_puddle = f_tag_to_index_in_init("SHALLOW_ACID_PUDDLE");
1190 feat_deep_poisonous_puddle = f_tag_to_index_in_init("DEEP_POISONOUS_PUDDLE");
1191 feat_shallow_poisonous_puddle = f_tag_to_index_in_init("SHALLOW_POISONOUS_PUDDLE");
1192 feat_dirt = f_tag_to_index_in_init("DIRT");
1193 feat_grass = f_tag_to_index_in_init("GRASS");
1194 feat_flower = f_tag_to_index_in_init("FLOWER");
1195 feat_brake = f_tag_to_index_in_init("BRAKE");
1196 feat_tree = f_tag_to_index_in_init("TREE");
1197 feat_mountain = f_tag_to_index_in_init("MOUNTAIN");
1198 feat_swamp = f_tag_to_index_in_init("SWAMP");
1200 /* Unknown grid (not detected) */
1201 feat_undetected = f_tag_to_index_in_init("UNDETECTED");
1203 /* Wilderness terrains */
1204 init_wilderness_terrains();
1206 return feat_tag_is_not_found ? PARSE_ERROR_UNDEFINED_TERRAIN_TAG : 0;
1211 * @brief その他の初期情報更新 /
1212 * Initialize some other arrays
1215 static errr init_other(void)
1220 /*** Prepare the "dungeon" information ***/
1222 /* Allocate and Wipe the object list */
1223 C_MAKE(o_list, max_o_idx, object_type);
1225 /* Allocate and Wipe the monster list */
1226 C_MAKE(m_list, max_m_idx, monster_type);
1228 /* Allocate and Wipe the monster process list */
1229 for (i = 0; i < MAX_MTIMED; i++)
1231 C_MAKE(mproc_list[i], max_m_idx, s16b);
1234 /* Allocate and Wipe the max dungeon level */
1235 C_MAKE(max_dlv, max_d_idx, DEPTH);
1237 /* Allocate and wipe each line of the cave */
1238 for (i = 0; i < MAX_HGT; i++)
1240 /* Allocate one row of the cave */
1241 C_MAKE(cave[i], MAX_WID, cave_type);
1245 /*** Prepare the various "bizarre" arrays ***/
1247 /* Macro variables */
1248 C_MAKE(macro__pat, MACRO_MAX, concptr);
1249 C_MAKE(macro__act, MACRO_MAX, concptr);
1250 C_MAKE(macro__cmd, MACRO_MAX, bool);
1252 /* Macro action buffer */
1253 C_MAKE(macro__buf, 1024, char);
1255 /* Quark variables */
1258 /* Message variables */
1259 C_MAKE(message__ptr, MESSAGE_MAX, u32b);
1260 C_MAKE(message__buf, MESSAGE_BUF, char);
1262 /* Hack -- No messages yet */
1263 message__tail = MESSAGE_BUF;
1266 /*** Prepare the Player inventory ***/
1269 C_MAKE(inventory, INVEN_TOTAL, object_type);
1272 /*** Prepare the options ***/
1274 /* Scan the options */
1275 for (i = 0; option_info[i].o_desc; i++)
1277 int os = option_info[i].o_set;
1278 int ob = option_info[i].o_bit;
1280 /* Set the "default" options */
1281 if (option_info[i].o_var)
1284 option_mask[os] |= (1L << ob);
1287 if (option_info[i].o_norm)
1290 option_flag[os] |= (1L << ob);
1297 option_flag[os] &= ~(1L << ob);
1302 /* Analyze the windows */
1303 for (n = 0; n < 8; n++)
1305 /* Analyze the options */
1306 for (i = 0; i < 32; i++)
1309 if (window_flag_desc[i])
1312 window_mask[n] |= (1L << i);
1318 * Set the "default" window flags
1319 * Window 1 : Display messages
1320 * Window 2 : Display inven/equip
1322 window_flag[1] = 1L << A_MAX;
1323 window_flag[2] = 1L << 0;
1326 /*** Pre-allocate space for the "format()" buffer ***/
1328 /* Hack -- Just call the "format()" function */
1329 (void)format("%s (%s).", "Mr.Hoge", MAINTAINER);
1338 * @brief オブジェクト配列を初期化する /
1339 * Initialize some other arrays
1342 static errr init_object_alloc(void)
1347 s16b num[MAX_DEPTH];
1348 s16b aux[MAX_DEPTH];
1351 /*** Analyze object allocation info ***/
1353 /* Clear the "aux" array */
1354 (void)C_WIPE(&aux, MAX_DEPTH, s16b);
1356 /* Clear the "num" array */
1357 (void)C_WIPE(&num, MAX_DEPTH, s16b);
1359 /* Free the old "alloc_kind_table" (if it exists) */
1360 if (alloc_kind_table)
1362 C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
1365 /* Size of "alloc_kind_table" */
1366 alloc_kind_size = 0;
1368 /* Scan the objects */
1369 for (i = 1; i < max_k_idx; i++)
1373 /* Scan allocation pairs */
1374 for (j = 0; j < 4; j++)
1376 /* Count the "legal" entries */
1377 if (k_ptr->chance[j])
1379 /* Count the entries */
1382 /* Group by level */
1383 num[k_ptr->locale[j]]++;
1388 /* Collect the level indexes */
1389 for (i = 1; i < MAX_DEPTH; i++)
1391 /* Group by level */
1396 if (!num[0]) quit(_("町のアイテムがない!", "No town objects!"));
1398 /*** Initialize object allocation info ***/
1400 /* Allocate the alloc_kind_table */
1401 C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
1403 /* Access the table entry */
1404 table = alloc_kind_table;
1406 /* Scan the objects */
1407 for (i = 1; i < max_k_idx; i++)
1411 /* Scan allocation pairs */
1412 for (j = 0; j < 4; j++)
1414 /* Count the "legal" entries */
1415 if (k_ptr->chance[j])
1419 /* Extract the base level */
1420 x = k_ptr->locale[j];
1422 /* Extract the base probability */
1423 p = (100 / k_ptr->chance[j]);
1425 /* Skip entries preceding our locale */
1426 y = (x > 0) ? num[x-1] : 0;
1428 /* Skip previous entries at this locale */
1431 /* Load the entry */
1432 table[z].index = (KIND_OBJECT_IDX)i;
1433 table[z].level = (DEPTH)x;
1434 table[z].prob1 = (PROB)p;
1435 table[z].prob2 = (PROB)p;
1436 table[z].prob3 = (PROB)p;
1438 /* Another entry complete for this locale */
1450 * @brief モンスター配列と生成テーブルを初期化する /
1451 * Initialize some other arrays
1454 static errr init_alloc(void)
1457 monster_race *r_ptr;
1463 /* Allocate the "r_info" array */
1464 C_MAKE(elements, max_r_idx, tag_type);
1466 /* Scan the monsters */
1467 for (i = 1; i < max_r_idx; i++)
1469 elements[i].tag = r_info[i].level;
1470 elements[i].index = i;
1473 tag_sort(elements, max_r_idx);
1475 /*** Initialize monster allocation info ***/
1477 /* Size of "alloc_race_table" */
1478 alloc_race_size = max_r_idx;
1480 /* Allocate the alloc_race_table */
1481 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1483 /* Scan the monsters */
1484 for (i = 1; i < max_r_idx; i++)
1486 /* Get the i'th race */
1487 r_ptr = &r_info[elements[i].index];
1489 /* Count valid pairs */
1494 /* Extract the base level */
1497 /* Extract the base probability */
1498 p = (100 / r_ptr->rarity);
1500 /* Load the entry */
1501 alloc_race_table[i].index = (KIND_OBJECT_IDX)elements[i].index;
1502 alloc_race_table[i].level = (DEPTH)x;
1503 alloc_race_table[i].prob1 = (PROB)p;
1504 alloc_race_table[i].prob2 = (PROB)p;
1505 alloc_race_table[i].prob3 = (PROB)p;
1509 /* Free the "r_info" array */
1510 C_KILL(elements, max_r_idx, tag_type);
1512 #else /* SORT_R_INFO */
1516 s16b num[MAX_DEPTH];
1517 s16b aux[MAX_DEPTH];
1519 /*** Analyze monster allocation info ***/
1521 /* Clear the "aux" array */
1522 C_WIPE(&aux, MAX_DEPTH, s16b);
1524 /* Clear the "num" array */
1525 C_WIPE(&num, MAX_DEPTH, s16b);
1527 /* Size of "alloc_race_table" */
1528 alloc_race_size = 0;
1530 /* Scan the monsters */
1531 for (i = 1; i < max_r_idx; i++)
1533 /* Get the i'th race */
1536 /* Legal monsters */
1539 /* Count the entries */
1542 /* Group by level */
1543 num[r_ptr->level]++;
1547 /* Collect the level indexes */
1548 for (i = 1; i < MAX_DEPTH; i++)
1550 /* Group by level */
1555 if (!num[0]) quit(_("町のモンスターがない!", "No town monsters!"));
1557 /*** Initialize monster allocation info ***/
1559 /* Allocate the alloc_race_table */
1560 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1562 /* Access the table entry */
1563 table = alloc_race_table;
1565 /* Scan the monsters */
1566 for (i = 1; i < max_r_idx; i++)
1568 /* Get the i'th race */
1571 /* Count valid pairs */
1576 /* Extract the base level */
1579 /* Extract the base probability */
1580 p = (100 / r_ptr->rarity);
1582 /* Skip entries preceding our locale */
1583 y = (x > 0) ? num[x-1] : 0;
1585 /* Skip previous entries at this locale */
1588 /* Load the entry */
1595 /* Another entry complete for this locale */
1600 #endif /* SORT_R_INFO */
1602 /* Init the "alloc_kind_table" */
1603 (void)init_object_alloc();
1612 * @brief 画面左下にシステムメッセージを表示する /
1613 * Hack -- take notes on line 23
1616 static void note(concptr str)
1618 Term_erase(0, 23, 255);
1619 Term_putstr(20, 23, -1, TERM_WHITE, str);
1626 * @brief 全ゲームデータ読み込みのサブルーチン /
1627 * Hack -- Explain a broken "lib" folder and quit (see below).
1631 * This function is "messy" because various things
1632 * may or may not be initialized, but the "plog()" and "quit()"
1633 * functions are "supposed" to work under any conditions.
1636 static void init_angband_aux(concptr why)
1643 plog("'lib'ディレクトリが存在しないか壊れているようです。");
1646 plog("ひょっとするとアーカイブが正しく解凍されていないのかもしれません。");
1649 plog("該当する'README'ファイルを読んで確認してみて下さい。");
1651 /* Quit with error */
1655 plog("The 'lib' directory is probably missing or broken.");
1658 plog("Perhaps the archive was not extracted correctly.");
1661 plog("See the 'README' file for more information.");
1663 /* Quit with error */
1664 quit("Fatal Error.");
1671 * @brief 全ゲームデータ読み込みのメインルーチン /
1672 * Hack -- main Angband initialization entry point
1676 * This function is "messy" because various things
1677 * may or may not be initialized, but the "plog()" and "quit()"
1678 * functions are "supposed" to work under any conditions.
1679 * Verify some files, display the "news.txt" file, create
1680 * the high score file, initialize all internal arrays, and
1681 * load the basic "user pref files".
1682 * Be very careful to keep track of the order in which things
1683 * are initialized, in particular, the only thing *known* to
1684 * be available when this function is called is the "z-term.c"
1685 * package, and that may not be fully initialized until the
1686 * end of this function, when the default "user pref files"
1687 * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
1688 * Note that this function attempts to verify the "news" file,
1689 * and the game aborts (cleanly) on failure, since without the
1690 * "news" file, it is likely that the "lib" folder has not been
1691 * correctly located. Otherwise, the news file is displayed for
1693 * Note that this function attempts to verify (or create) the
1694 * "high score" file, and the game aborts (cleanly) on failure,
1695 * since one of the most common "extraction" failures involves
1696 * failing to extract all sub-directories (even empty ones), such
1697 * as by failing to use the "-d" option of "pkunzip", or failing
1698 * to use the "save empty directories" option with "Compact Pro".
1699 * This error will often be caught by the "high score" creation
1700 * code below, since the "lib/apex" directory, being empty in the
1701 * standard distributions, is most likely to be "lost", making it
1702 * impossible to create the high score file.
1703 * Note that various things are initialized by this function,
1704 * including everything that was once done by "init_some_arrays".
1705 * This initialization involves the parsing of special files
1706 * in the "lib/data" and sometimes the "lib/edit" directories.
1707 * Note that the "template" files are initialized first, since they
1708 * often contain errors. This means that macros and message recall
1709 * and things like that are not available until after they are done.
1710 * We load the default "user pref files" here in case any "color"
1711 * changes are needed before character creation.
1712 * Note that the "graf-xxx.prf" file must be loaded separately,
1713 * if needed, in the first (?) pass through "TERM_XTRA_REACT".
1716 void init_angband(void)
1720 BIT_FLAGS mode = 0664;
1727 /*** Verify the "news" file ***/
1729 /* Build the filename */
1730 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1732 /* Attempt to open the file */
1733 fd = fd_open(buf, O_RDONLY);
1740 sprintf(why, _("'%s'ファイルにアクセスできません!", "Cannot access the '%s' file!"), buf);
1742 /* Crash and burn */
1743 init_angband_aux(why);
1750 /*** Display the "news" file ***/
1753 /* Build the filename */
1754 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1756 /* Open the News file */
1757 fp = my_fopen(buf, "r");
1764 /* Dump the file to the screen */
1765 while (0 == my_fgets(fp, buf, sizeof(buf)))
1767 /* Display and advance */
1768 Term_putstr(0, i++, -1, TERM_WHITE, buf);
1779 /*** Verify (or create) the "high score" file ***/
1781 /* Build the filename */
1782 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
1784 /* Attempt to open the high score file */
1785 fd = fd_open(buf, O_RDONLY);
1790 /* File type is "DATA" */
1791 FILE_TYPE(FILE_TYPE_DATA);
1793 /* Grab permissions */
1796 /* Create a new high score file */
1797 fd = fd_make(buf, mode);
1799 /* Drop permissions */
1807 sprintf(why, _("'%s'ファイルを作成できません!", "Cannot create the '%s' file!"), buf);
1809 /* Crash and burn */
1810 init_angband_aux(why);
1819 /*** Initialize some arrays ***/
1821 /* Initialize misc. values */
1822 note(_("[変数を初期化しています...(その他)", "[Initializing values... (misc)]"));
1823 if (init_misc()) quit(_("その他の変数を初期化できません", "Cannot initialize misc. values"));
1825 /* Initialize feature info */
1827 note("[データの初期化中... (地形)]");
1828 if (init_f_info()) quit("地形初期化不能");
1829 if (init_feat_variables()) quit("地形初期化不能");
1831 note("[Initializing arrays... (features)]");
1832 if (init_f_info()) quit("Cannot initialize features");
1833 if (init_feat_variables()) quit("Cannot initialize features");
1837 /* Initialize object info */
1838 note(_("[データの初期化中... (アイテム)]", "[Initializing arrays... (objects)]"));
1839 if (init_k_info()) quit(_("アイテム初期化不能", "Cannot initialize objects"));
1842 /* Initialize artifact info */
1843 note(_("[データの初期化中... (伝説のアイテム)]", "[Initializing arrays... (artifacts)]"));
1844 if (init_a_info()) quit(_("伝説のアイテム初期化不能", "Cannot initialize artifacts"));
1847 /* Initialize ego-item info */
1848 note(_("[データの初期化中... (名のあるアイテム)]", "[Initializing arrays... (ego-items)]"));
1849 if (init_e_info()) quit(_("名のあるアイテム初期化不能", "Cannot initialize ego-items"));
1852 /* Initialize monster info */
1853 note(_("[データの初期化中... (モンスター)]", "[Initializing arrays... (monsters)]"));
1854 if (init_r_info()) quit(_("モンスター初期化不能", "Cannot initialize monsters"));
1857 /* Initialize dungeon info */
1858 note(_("[データの初期化中... (ダンジョン)]", "[Initializing arrays... (dungeon)]"));
1859 if (init_d_info()) quit(_("ダンジョン初期化不能", "Cannot initialize dungeon"));
1862 for (i = 1; i < max_d_idx; i++)
1863 if (d_info[i].final_guardian)
1864 r_info[d_info[i].final_guardian].flags7 |= RF7_GUARDIAN;
1867 /* Initialize magic info */
1868 note(_("[データの初期化中... (魔法)]", "[Initializing arrays... (magic)]"));
1869 if (init_m_info()) quit(_("魔法初期化不能", "Cannot initialize magic"));
1871 /* Initialize weapon_exp info */
1872 note(_("[データの初期化中... (熟練度)]", "[Initializing arrays... (skill)]"));
1873 if (init_s_info()) quit(_("熟練度初期化不能", "Cannot initialize skill"));
1875 /* Initialize wilderness array */
1876 note(_("[配列を初期化しています... (荒野)]", "[Initializing arrays... (wilderness)]"));
1878 if (init_wilderness()) quit(_("荒野を初期化できません", "Cannot initialize wilderness"));
1881 /* Initialize town array */
1882 note(_("[配列を初期化しています... (街)]", "[Initializing arrays... (towns)]"));
1883 if (init_towns()) quit(_("街を初期化できません", "Cannot initialize towns"));
1886 /* Initialize building array */
1887 note(_("[配列を初期化しています... (建物)]", "[Initializing arrays... (buildings)]"));
1888 if (init_buildings()) quit(_("建物を初期化できません", "Cannot initialize buildings"));
1891 /* Initialize quest array */
1892 note(_("[配列を初期化しています... (クエスト)]", "[Initializing arrays... (quests)]"));
1893 if (init_quests()) quit(_("クエストを初期化できません", "Cannot initialize quests"));
1895 /* Initialize vault info */
1896 if (init_v_info()) quit(_("vault 初期化不能", "Cannot initialize vaults"));
1898 /* Initialize some other arrays */
1899 note(_("[データの初期化中... (その他)]", "[Initializing arrays... (other)]"));
1900 if (init_other()) quit(_("その他のデータ初期化不能", "Cannot initialize other stuff"));
1903 /* Initialize some other arrays */
1904 note(_("[データの初期化中... (アロケーション)]", "[Initializing arrays... (alloc)]"));
1905 if (init_alloc()) quit(_("アロケーション・スタッフ初期化不能", "Cannot initialize alloc stuff"));
1909 /*** Load default user pref files ***/
1911 /* Initialize feature info */
1912 note(_("[ユーザー設定ファイルを初期化しています...]", "[Initializing user pref files...]"));
1914 /* Access the "basic" pref file */
1915 strcpy(buf, "pref.prf");
1917 /* Process that file */
1918 process_pref_file(buf);
1920 /* Access the "basic" system pref file */
1921 sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
1923 /* Process that file */
1924 process_pref_file(buf);
1926 note(_("[初期化終了]", "[Initialization complete]"));
1933 static void put_title(void)
1938 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,
1940 sprintf(title, _("変愚蛮怒 %d.%d.%d(%s)", "Hengband %d.%d.%d(%s)"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH,
1942 IS_STABLE_VERSION ? _("安定版", "Stable") : _("開発版", "Developing"));
1943 col = (80 - strlen(title)) / 2;
1944 col = col < 0 ? 0 : col;
1945 prt(title, VER_INFO_ROW, col);
1949 * @brief サムチェック情報を出力 / Get check sum in string form
1950 * @return サムチェック情報の文字列
1952 concptr get_check_sum(void)
1954 return format("%02x%02x%02x%02x%02x%02x%02x%02x%02x",