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.
44 #ifdef CHECK_MODIFICATION_TIME
45 #include <sys/types.h>
47 #endif /* CHECK_MODIFICATION_TIME */
50 static void put_title(void);
53 * @brief 各データファイルを読み取るためのパスを取得する
54 * Find the default paths to all of our important sub-directories.
55 * @param path パス保管先の文字列
59 * The purpose of each sub-directory is described in "variable.c".
60 * All of the sub-directories should, by default, be located inside
61 * the main "lib" directory, whose location is very system dependant.
62 * This function takes a writable buffer, initially containing the
63 * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
64 * or a system dependant string, for example, ":lib:". The buffer
65 * must be large enough to contain at least 32 more characters.
66 * Various command line options may allow some of the important
67 * directories to be changed to user-specified directories, most
68 * importantly, the "info" and "user" and "save" directories,
69 * but this is done after this function, see "main.c".
70 * In general, the initial path should end in the appropriate "PATH_SEP"
71 * string. All of the "sub-directory" paths (created below or supplied
72 * by the user) will NOT end in the "PATH_SEP" string, see the special
73 * "path_build()" function in "util.c" for more information.
74 * Mega-Hack -- support fat raw files under NEXTSTEP, using special
75 * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
76 * requiring the directories to be created by hand by the user.
77 * Hack -- first we free all the strings, since this is known
78 * to succeed even if the strings have not been allocated yet,
79 * as long as the variables start out as "NULL". This allows
80 * this function to be called multiple times, for example, to
81 * try several base "path" values until a good one is found.
84 void init_file_paths(char *path)
88 #ifdef PRIVATE_USER_PATH
90 #endif /* PRIVATE_USER_PATH */
92 /*** Free everything ***/
94 /* Free the main path */
95 string_free(ANGBAND_DIR);
97 /* Free the sub-paths */
98 string_free(ANGBAND_DIR_APEX);
99 string_free(ANGBAND_DIR_BONE);
100 string_free(ANGBAND_DIR_DATA);
101 string_free(ANGBAND_DIR_EDIT);
102 string_free(ANGBAND_DIR_SCRIPT);
103 string_free(ANGBAND_DIR_FILE);
104 string_free(ANGBAND_DIR_HELP);
105 string_free(ANGBAND_DIR_INFO);
106 string_free(ANGBAND_DIR_SAVE);
107 string_free(ANGBAND_DIR_USER);
108 string_free(ANGBAND_DIR_XTRA);
111 /*** Prepare the "path" ***/
113 /* Hack -- save the main directory */
114 ANGBAND_DIR = string_make(path);
116 /* Prepare to append to the Base Path */
117 tail = path + strlen(path);
119 /*** Build the sub-directory names ***/
121 /* Build a path name */
122 strcpy(tail, "apex");
123 ANGBAND_DIR_APEX = string_make(path);
125 /* Build a path name */
126 strcpy(tail, "bone");
127 ANGBAND_DIR_BONE = string_make(path);
129 /* Build a path name */
130 strcpy(tail, "data");
131 ANGBAND_DIR_DATA = string_make(path);
133 /* Build a path name */
134 strcpy(tail, "edit");
135 ANGBAND_DIR_EDIT = string_make(path);
137 /* Build a path name */
138 strcpy(tail, "script");
139 ANGBAND_DIR_SCRIPT = string_make(path);
141 /* Build a path name */
142 strcpy(tail, "file");
143 ANGBAND_DIR_FILE = string_make(path);
145 /* Build a path name */
146 strcpy(tail, "help");
147 ANGBAND_DIR_HELP = string_make(path);
149 /* Build a path name */
150 strcpy(tail, "info");
151 ANGBAND_DIR_INFO = string_make(path);
153 /* Build a path name */
154 strcpy(tail, "pref");
155 ANGBAND_DIR_PREF = string_make(path);
157 /* Build a path name */
158 strcpy(tail, "save");
159 ANGBAND_DIR_SAVE = string_make(path);
161 #ifdef PRIVATE_USER_PATH
163 /* Build the path to the user specific directory */
164 path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
166 /* Build a relative path name */
167 ANGBAND_DIR_USER = string_make(buf);
169 #else /* PRIVATE_USER_PATH */
171 /* Build a path name */
172 strcpy(tail, "user");
173 ANGBAND_DIR_USER = string_make(path);
175 #endif /* PRIVATE_USER_PATH */
177 /* Build a path name */
178 strcpy(tail, "xtra");
179 ANGBAND_DIR_XTRA = string_make(path);
184 /* Allow "fat binary" usage with NeXT */
205 /* Use special directory */
208 /* Forget the old path name */
209 string_free(ANGBAND_DIR_DATA);
211 /* Build a new path name */
212 sprintf(tail, "data-%s", next);
213 ANGBAND_DIR_DATA = string_make(path);
223 #ifdef ALLOW_TEMPLATES
227 * Hack -- help give useful error messages
229 int error_idx; /*!< データ読み込み/初期化時に汎用的にエラーコードを保存するグローバル変数 */
230 int error_line; /*!< データ読み込み/初期化時に汎用的にエラー行数を保存するグローバル変数 */
234 * エラーメッセージの名称定義 / Standard error message text
236 concptr err_str[PARSE_ERROR_MAX] =
253 "missing record header",
254 "non-sequential records",
255 "invalid flag specification",
256 "undefined directive",
258 "coordinates out of bounds",
260 "undefined terrain tag",
266 #endif /* ALLOW_TEMPLATES */
272 header v_head; /*!< Vault情報のヘッダ構造体 */
273 header f_head; /*!< 地形情報のヘッダ構造体 */
274 header k_head; /*!< ペースアイテム情報のヘッダ構造体 */
275 header a_head; /*!< 固定アーティファクト情報のヘッダ構造体 */
276 header e_head; /*!< アイテムエゴ情報のヘッダ構造体 */
277 header r_head; /*!< モンスター種族情報のヘッダ構造体 */
278 header d_head; /*!< ダンジョン情報のヘッダ構造体 */
279 header s_head; /*!< プレイヤー職業技能情報のヘッダ構造体 */
280 header m_head; /*!< プレイヤー職業魔法情報のヘッダ構造体 */
282 #ifdef CHECK_MODIFICATION_TIME
285 * @brief テキストファイルとrawファイルの更新時刻を比較する
286 * Find the default paths to all of our important sub-directories.
287 * @param fd ファイルディスクリプタ
288 * @param template_file ファイル名
289 * @return テキストの方が新しいか、rawファイルがなく更新の必要がある場合-1、更新の必要がない場合0。
291 static errr check_modification_date(int fd, concptr template_file)
295 struct stat txt_stat, raw_stat;
297 /* Build the filename */
298 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, template_file);
300 /* Access stats on text file */
301 if (stat(buf, &txt_stat))
303 /* No text file - continue */
306 /* Access stats on raw file */
307 else if (fstat(fd, &raw_stat))
313 /* Ensure text file is not newer than raw file */
314 else if (txt_stat.st_mtime > raw_stat.st_mtime)
316 /* Reprocess text file */
323 #endif /* CHECK_MODIFICATION_TIME */
327 /*** Initialize from binary image files ***/
331 * @brief rawファイルからのデータの読み取り処理
332 * Initialize the "*_info" array, by parsing a binary "image" file
333 * @param fd ファイルディスクリプタ
334 * @param head rawファイルのヘッダ
337 static errr init_info_raw(int fd, header *head)
341 /* Read and Verify the header */
342 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
343 (test.v_major != head->v_major) ||
344 (test.v_minor != head->v_minor) ||
345 (test.v_patch != head->v_patch) ||
346 (test.info_num != head->info_num) ||
347 (test.info_len != head->info_len) ||
348 (test.head_size != head->head_size) ||
349 (test.info_size != head->info_size))
356 /* Accept the header */
360 /* Allocate the "*_info" array */
361 C_MAKE(head->info_ptr, head->info_size, char);
363 /* Read the "*_info" array */
364 fd_read(fd, head->info_ptr, head->info_size);
369 /* Allocate the "*_name" array */
370 C_MAKE(head->name_ptr, head->name_size, char);
372 /* Read the "*_name" array */
373 fd_read(fd, head->name_ptr, head->name_size);
379 /* Allocate the "*_text" array */
380 C_MAKE(head->text_ptr, head->text_size, char);
382 /* Read the "*_text" array */
383 fd_read(fd, head->text_ptr, head->text_size);
389 /* Allocate the "*_tag" array */
390 C_MAKE(head->tag_ptr, head->tag_size, char);
392 /* Read the "*_tag" array */
393 fd_read(fd, head->tag_ptr, head->tag_size);
405 * Initialize the header of an *_info.raw file.
406 * @param head rawファイルのヘッダ
411 static void init_header(header *head, IDX num, int len)
413 /* Save the "version" */
414 head->v_major = FAKE_VER_MAJOR;
415 head->v_minor = FAKE_VER_MINOR;
416 head->v_patch = FAKE_VER_PATCH;
419 /* Save the "record" information */
420 head->info_num = (IDX)num;
421 head->info_len = len;
423 /* Save the size of "*_head" and "*_info" */
424 head->head_size = sizeof(header);
425 head->info_size = head->info_num * head->info_len;
431 * Initialize the "*_info" array
432 * @param filename ファイル名(拡張子txt/raw)
433 * @param head 処理に用いるヘッダ構造体
434 * @param info データ保管先の構造体ポインタ
435 * @param name 名称用可変文字列の保管先
436 * @param text テキスト用可変文字列の保管先
437 * @param tag タグ用可変文字列の保管先
440 * Note that we let each entry have a unique "name" and "text" string,
441 * even if the string happens to be empty (everyone has a unique '\0').
443 static errr init_info(concptr filename, header *head,
444 void **info, char **name, char **text, char **tag)
448 BIT_FLAGS mode = 0644;
458 #ifdef ALLOW_TEMPLATES
460 /*** Load the binary image file ***/
462 /* Build the filename */
463 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
466 /* Attempt to open the "raw" file */
467 fd = fd_open(buf, O_RDONLY);
469 /* Process existing "raw" file */
472 #ifdef CHECK_MODIFICATION_TIME
474 err = check_modification_date(fd, format("%s.txt", filename));
476 #endif /* CHECK_MODIFICATION_TIME */
478 /* Attempt to parse the "raw" file */
480 err = init_info_raw(fd, head);
485 /* Do we have to parse the *.txt file? */
488 /*** Make the fake arrays ***/
490 /* Allocate the "*_info" array */
491 C_MAKE(head->info_ptr, head->info_size, char);
493 /* Hack -- make "fake" arrays */
494 if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
495 if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
496 if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
498 if (info) (*info) = head->info_ptr;
499 if (name) (*name) = head->name_ptr;
500 if (text) (*text) = head->text_ptr;
501 if (tag) (*tag) = head->tag_ptr;
503 /*** Load the ascii template file ***/
505 /* Build the filename */
507 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
510 fp = my_fopen(buf, "r");
513 if (!fp) quit(format(_("'%s.txt'ファイルをオープンできません。", "Cannot open '%s.txt' file."), filename));
516 err = init_info_txt(fp, buf, head, head->parse_info_txt);
526 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "未知の");
528 msg_format("'%s.txt'ファイルの %d 行目にエラー。", filename, error_line);
529 msg_format("レコード %d は '%s' エラーがあります。", error_idx, oops);
530 msg_format("構文 '%s'。", buf);
534 quit(format("'%s.txt'ファイルにエラー", filename));
537 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
539 msg_format("Error %d at line %d of '%s.txt'.", err, error_line, filename);
540 msg_format("Record %d contains a '%s' error.", error_idx, oops);
541 msg_format("Parsing '%s'.", buf);
545 quit(format("Error in '%s.txt' file.", filename));
551 /*** Make final retouch on fake tags ***/
555 (*head->retouch)(head);
559 /*** Dump the binary image file ***/
561 /* File type is "DATA" */
562 FILE_TYPE(FILE_TYPE_DATA);
564 /* Build the filename */
565 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
568 /* Grab permissions */
571 /* Kill the old file */
574 /* Attempt to create the raw file */
575 fd = fd_make(buf, mode);
577 /* Drop permissions */
580 /* Dump to the file */
584 fd_write(fd, (concptr)(head), head->head_size);
586 /* Dump the "*_info" array */
587 fd_write(fd, head->info_ptr, head->info_size);
589 /* Dump the "*_name" array */
590 fd_write(fd, head->name_ptr, head->name_size);
592 /* Dump the "*_text" array */
593 fd_write(fd, head->text_ptr, head->text_size);
595 /* Dump the "*_tag" array */
596 fd_write(fd, head->tag_ptr, head->tag_size);
603 /*** Kill the fake arrays ***/
605 /* Free the "*_info" array */
606 C_KILL(head->info_ptr, head->info_size, char);
608 /* Hack -- Free the "fake" arrays */
609 if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char);
610 if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char);
611 if (tag) C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char);
613 #endif /* ALLOW_TEMPLATES */
616 /*** Load the binary image file ***/
618 /* Build the filename */
619 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
621 /* Attempt to open the "raw" file */
622 fd = fd_open(buf, O_RDONLY);
624 /* Process existing "raw" file */
625 if (fd < 0) quit(format(_("'%s_j.raw'ファイルをロードできません。", "Cannot load '%s.raw' file."), filename));
627 /* Attempt to parse the "raw" file */
628 err = init_info_raw(fd, head);
632 if (err) quit(format(_("'%s_j.raw'ファイルを解析できません。", "Cannot parse '%s.raw' file."), filename));
634 #ifdef ALLOW_TEMPLATES
638 if (info) (*info) = head->info_ptr;
639 if (name) (*name) = head->name_ptr;
640 if (text) (*text) = head->text_ptr;
641 if (tag) (*tag) = head->tag_ptr;
649 * @brief 地形情報読み込みのメインルーチン /
650 * Initialize the "f_info" array
653 static errr init_f_info(void)
655 /* Init the header */
656 init_header(&f_head, max_f_idx, sizeof(feature_type));
658 #ifdef ALLOW_TEMPLATES
660 /* Save a pointer to the parsing function */
661 f_head.parse_info_txt = parse_f_info;
663 /* Save a pointer to the retouch fake tags */
664 f_head.retouch = retouch_f_info;
666 #endif /* ALLOW_TEMPLATES */
668 return init_info("f_info", &f_head,
669 (void*)&f_info, &f_name, NULL, &f_tag);
674 * @brief ベースアイテム情報読み込みのメインルーチン /
675 * Initialize the "k_info" array
678 static errr init_k_info(void)
680 /* Init the header */
681 init_header(&k_head, max_k_idx, sizeof(object_kind));
683 #ifdef ALLOW_TEMPLATES
685 /* Save a pointer to the parsing function */
686 k_head.parse_info_txt = parse_k_info;
688 #endif /* ALLOW_TEMPLATES */
690 return init_info("k_info", &k_head,
691 (void*)&k_info, &k_name, &k_text, NULL);
697 * @brief 固定アーティファクト情報読み込みのメインルーチン /
698 * Initialize the "a_info" array
701 static errr init_a_info(void)
703 /* Init the header */
704 init_header(&a_head, max_a_idx, sizeof(artifact_type));
706 #ifdef ALLOW_TEMPLATES
708 /* Save a pointer to the parsing function */
709 a_head.parse_info_txt = parse_a_info;
711 #endif /* ALLOW_TEMPLATES */
713 return init_info("a_info", &a_head,
714 (void*)&a_info, &a_name, &a_text, NULL);
720 * @brief 固定アーティファクト情報読み込みのメインルーチン /
721 * Initialize the "e_info" array
724 static errr init_e_info(void)
726 /* Init the header */
727 init_header(&e_head, max_e_idx, sizeof(ego_item_type));
729 #ifdef ALLOW_TEMPLATES
731 /* Save a pointer to the parsing function */
732 e_head.parse_info_txt = parse_e_info;
734 #endif /* ALLOW_TEMPLATES */
736 return init_info("e_info", &e_head,
737 (void*)&e_info, &e_name, &e_text, NULL);
743 * @brief モンスター種族情報読み込みのメインルーチン /
744 * Initialize the "r_info" array
747 static errr init_r_info(void)
749 /* Init the header */
750 init_header(&r_head, max_r_idx, sizeof(monster_race));
752 #ifdef ALLOW_TEMPLATES
754 /* Save a pointer to the parsing function */
755 r_head.parse_info_txt = parse_r_info;
757 #endif /* ALLOW_TEMPLATES */
759 return init_info("r_info", &r_head,
760 (void*)&r_info, &r_name, &r_text, NULL);
766 * @brief ダンジョン情報読み込みのメインルーチン /
767 * Initialize the "d_info" array
770 static errr init_d_info(void)
772 /* Init the header */
773 init_header(&d_head, max_d_idx, sizeof(dungeon_type));
775 #ifdef ALLOW_TEMPLATES
777 /* Save a pointer to the parsing function */
778 d_head.parse_info_txt = parse_d_info;
780 #endif /* ALLOW_TEMPLATES */
782 return init_info("d_info", &d_head,
783 (void*)&d_info, &d_name, &d_text, NULL);
788 * @brief Vault情報読み込みのメインルーチン /
789 * Initialize the "v_info" array
792 * Note that we let each entry have a unique "name" and "text" string,
793 * even if the string happens to be empty (everyone has a unique '\0').
795 errr init_v_info(void)
797 /* Init the header */
798 init_header(&v_head, max_v_idx, sizeof(vault_type));
800 #ifdef ALLOW_TEMPLATES
802 /* Save a pointer to the parsing function */
803 v_head.parse_info_txt = parse_v_info;
805 #endif /* ALLOW_TEMPLATES */
807 return init_info("v_info", &v_head,
808 (void*)&v_info, &v_name, &v_text, NULL);
813 * @brief 職業技能情報読み込みのメインルーチン /
814 * Initialize the "s_info" array
817 static errr init_s_info(void)
819 /* Init the header */
820 init_header(&s_head, MAX_CLASS, sizeof(skill_table));
822 #ifdef ALLOW_TEMPLATES
824 /* Save a pointer to the parsing function */
825 s_head.parse_info_txt = parse_s_info;
827 #endif /* ALLOW_TEMPLATES */
829 return init_info("s_info", &s_head,
830 (void*)&s_info, NULL, NULL, NULL);
835 * @brief 職業魔法情報読み込みのメインルーチン /
836 * Initialize the "m_info" array
839 static errr init_m_info(void)
841 /* Init the header */
842 init_header(&m_head, MAX_CLASS, sizeof(player_magic));
844 #ifdef ALLOW_TEMPLATES
846 /* Save a pointer to the parsing function */
847 m_head.parse_info_txt = parse_m_info;
849 #endif /* ALLOW_TEMPLATES */
851 return init_info("m_info", &m_head,
852 (void*)&m_info, NULL, NULL, NULL);
860 * @brief 基本情報読み込みのメインルーチン /
861 * Initialize misc. values
864 static errr init_misc(void)
866 /* Initialize the values */
867 process_dungeon_file("misc.txt", 0, 0, 0, 0);
874 * @brief 町情報読み込みのメインルーチン /
875 * Initialize town array
878 static errr init_towns(void)
882 /*** Prepare the Towns ***/
884 /* Allocate the towns */
885 C_MAKE(town_info, max_towns, town_type);
887 for (i = 1; i < max_towns; i++)
889 /*** Prepare the Stores ***/
891 /* Allocate the stores */
892 C_MAKE(town_info[i].store, MAX_STORES, store_type);
894 /* Fill in each store */
895 for (j = 0; j < MAX_STORES; j++)
897 /* Access the store */
898 store_type *st_ptr = &town_info[i].store[j];
900 if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME)) continue;
902 /* Assume full stock */
905 * 我が家が 20 ページまで使える隠し機能のための準備。
906 * オプションが有効でもそうでなくても一応スペース
911 st_ptr->stock_size = (STORE_INVEN_MAX * 10);
913 else if (j == STORE_MUSEUM)
915 st_ptr->stock_size = (STORE_INVEN_MAX * 50);
919 st_ptr->stock_size = STORE_INVEN_MAX;
921 /* Allocate the stock */
922 C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type);
924 /* No table for the black market or home */
925 if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM)) continue;
927 /* Assume full table */
928 st_ptr->table_size = STORE_CHOICES;
930 /* Allocate the stock */
931 C_MAKE(st_ptr->table, st_ptr->table_size, s16b);
933 /* Scan the choices */
934 for (k = 0; k < STORE_CHOICES; k++)
936 KIND_OBJECT_IDX k_idx;
938 /* Extract the tval/sval codes */
939 int tv = store_table[j][k][0];
940 int sv = store_table[j][k][1];
943 for (k_idx = 1; k_idx < max_k_idx; k_idx++)
945 object_kind *k_ptr = &k_info[k_idx];
948 if ((k_ptr->tval == tv) && (k_ptr->sval == sv)) break;
952 if (k_idx == max_k_idx) continue;
954 /* Add that item index to the table */
955 st_ptr->table[st_ptr->table_num++] = k_idx;
964 * @brief 店情報初期化のメインルーチン /
965 * Initialize buildings
968 errr init_buildings(void)
972 for (i = 0; i < MAX_BLDG; i++)
974 building[i].name[0] = '\0';
975 building[i].owner_name[0] = '\0';
976 building[i].owner_race[0] = '\0';
978 for (j = 0; j < 8; j++)
980 building[i].act_names[j][0] = '\0';
981 building[i].member_costs[j] = 0;
982 building[i].other_costs[j] = 0;
983 building[i].letters[j] = 0;
984 building[i].actions[j] = 0;
985 building[i].action_restr[j] = 0;
988 for (j = 0; j < MAX_CLASS; j++)
990 building[i].member_class[j] = 0;
993 for (j = 0; j < MAX_RACES; j++)
995 building[i].member_race[j] = 0;
998 for (j = 0; j < MAX_MAGIC+1; j++)
1000 building[i].member_realm[j] = 0;
1009 * @brief クエスト情報初期化のメインルーチン /
1010 * Initialize quest array
1013 static errr init_quests(void)
1017 /*** Prepare the quests ***/
1019 /* Allocate the quests */
1020 C_MAKE(quest, max_q_idx, quest_type);
1022 /* Set all quest to "untaken" */
1023 for (i = 0; i < max_q_idx; i++)
1025 quest[i].status = QUEST_STATUS_UNTAKEN;
1031 /*! 地形タグ情報から地形IDを得られなかった場合にTRUEを返すグローバル変数 */
1032 static bool feat_tag_is_not_found = FALSE;
1035 * @brief 地形タグからIDを得る /
1036 * Initialize quest array
1039 s16b f_tag_to_index_in_init(concptr str)
1041 FEAT_IDX feat = f_tag_to_index(str);
1043 if (feat < 0) feat_tag_is_not_found = TRUE;
1050 * @brief 地形の汎用定義をタグを通じて取得する /
1051 * Initialize feature variables
1054 static errr init_feat_variables(void)
1059 feat_none = f_tag_to_index_in_init("NONE");
1062 feat_floor = f_tag_to_index_in_init("FLOOR");
1065 feat_glyph = f_tag_to_index_in_init("GLYPH");
1066 feat_explosive_rune = f_tag_to_index_in_init("EXPLOSIVE_RUNE");
1067 feat_mirror = f_tag_to_index_in_init("MIRROR");
1070 feat_door[DOOR_DOOR].open = f_tag_to_index_in_init("OPEN_DOOR");
1071 feat_door[DOOR_DOOR].broken = f_tag_to_index_in_init("BROKEN_DOOR");
1072 feat_door[DOOR_DOOR].closed = f_tag_to_index_in_init("CLOSED_DOOR");
1075 for (i = 1; i < MAX_LJ_DOORS; i++)
1077 s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
1078 if (door < 0) break;
1079 feat_door[DOOR_DOOR].locked[i - 1] = door;
1081 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1082 feat_door[DOOR_DOOR].num_locked = i - 1;
1085 for (i = 0; i < MAX_LJ_DOORS; i++)
1087 s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
1088 if (door < 0) break;
1089 feat_door[DOOR_DOOR].jammed[i] = door;
1091 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1092 feat_door[DOOR_DOOR].num_jammed = i;
1095 feat_door[DOOR_GLASS_DOOR].open = f_tag_to_index_in_init("OPEN_GLASS_DOOR");
1096 feat_door[DOOR_GLASS_DOOR].broken = f_tag_to_index_in_init("BROKEN_GLASS_DOOR");
1097 feat_door[DOOR_GLASS_DOOR].closed = f_tag_to_index_in_init("CLOSED_GLASS_DOOR");
1099 /* Locked glass doors */
1100 for (i = 1; i < MAX_LJ_DOORS; i++)
1102 s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
1103 if (door < 0) break;
1104 feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door;
1106 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1107 feat_door[DOOR_GLASS_DOOR].num_locked = i - 1;
1109 /* Jammed glass doors */
1110 for (i = 0; i < MAX_LJ_DOORS; i++)
1112 s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
1113 if (door < 0) break;
1114 feat_door[DOOR_GLASS_DOOR].jammed[i] = door;
1116 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1117 feat_door[DOOR_GLASS_DOOR].num_jammed = i;
1120 feat_door[DOOR_CURTAIN].open = f_tag_to_index_in_init("OPEN_CURTAIN");
1121 feat_door[DOOR_CURTAIN].broken = feat_door[DOOR_CURTAIN].open;
1122 feat_door[DOOR_CURTAIN].closed = f_tag_to_index_in_init("CLOSED_CURTAIN");
1123 feat_door[DOOR_CURTAIN].locked[0] = feat_door[DOOR_CURTAIN].closed;
1124 feat_door[DOOR_CURTAIN].num_locked = 1;
1125 feat_door[DOOR_CURTAIN].jammed[0] = feat_door[DOOR_CURTAIN].closed;
1126 feat_door[DOOR_CURTAIN].num_jammed = 1;
1129 feat_up_stair = f_tag_to_index_in_init("UP_STAIR");
1130 feat_down_stair = f_tag_to_index_in_init("DOWN_STAIR");
1131 feat_entrance = f_tag_to_index_in_init("ENTRANCE");
1134 init_normal_traps();
1137 feat_trap_open = f_tag_to_index_in_init("TRAP_OPEN");
1138 feat_trap_armageddon = f_tag_to_index_in_init("TRAP_ARMAGEDDON");
1139 feat_trap_piranha = f_tag_to_index_in_init("TRAP_PIRANHA");
1142 feat_rubble = f_tag_to_index_in_init("RUBBLE");
1145 feat_magma_vein = f_tag_to_index_in_init("MAGMA_VEIN");
1146 feat_quartz_vein = f_tag_to_index_in_init("QUARTZ_VEIN");
1149 feat_granite = f_tag_to_index_in_init("GRANITE");
1150 feat_permanent = f_tag_to_index_in_init("PERMANENT");
1153 feat_glass_floor = f_tag_to_index_in_init("GLASS_FLOOR");
1156 feat_glass_wall = f_tag_to_index_in_init("GLASS_WALL");
1157 feat_permanent_glass_wall = f_tag_to_index_in_init("PERMANENT_GLASS_WALL");
1160 feat_pattern_start = f_tag_to_index_in_init("PATTERN_START");
1161 feat_pattern_1 = f_tag_to_index_in_init("PATTERN_1");
1162 feat_pattern_2 = f_tag_to_index_in_init("PATTERN_2");
1163 feat_pattern_3 = f_tag_to_index_in_init("PATTERN_3");
1164 feat_pattern_4 = f_tag_to_index_in_init("PATTERN_4");
1165 feat_pattern_end = f_tag_to_index_in_init("PATTERN_END");
1166 feat_pattern_old = f_tag_to_index_in_init("PATTERN_OLD");
1167 feat_pattern_exit = f_tag_to_index_in_init("PATTERN_EXIT");
1168 feat_pattern_corrupted = f_tag_to_index_in_init("PATTERN_CORRUPTED");
1171 feat_black_market = f_tag_to_index_in_init("BLACK_MARKET");
1172 feat_town = f_tag_to_index_in_init("TOWN");
1175 feat_deep_water = f_tag_to_index_in_init("DEEP_WATER");
1176 feat_shallow_water = f_tag_to_index_in_init("SHALLOW_WATER");
1177 feat_deep_lava = f_tag_to_index_in_init("DEEP_LAVA");
1178 feat_shallow_lava = f_tag_to_index_in_init("SHALLOW_LAVA");
1179 feat_heavy_cold_zone = f_tag_to_index_in_init("HEAVY_COLD_ZONE");
1180 feat_cold_zone = f_tag_to_index_in_init("COLD_ZONE");
1181 feat_heavy_electrical_zone = f_tag_to_index_in_init("HEAVY_ELECTRICAL_ZONE");
1182 feat_electrical_zone = f_tag_to_index_in_init("ELECTRICAL_ZONE");
1183 feat_deep_acid_puddle = f_tag_to_index_in_init("DEEP_ACID_PUDDLE");
1184 feat_shallow_acid_puddle = f_tag_to_index_in_init("SHALLOW_ACID_PUDDLE");
1185 feat_deep_poisonous_puddle = f_tag_to_index_in_init("DEEP_POISONOUS_PUDDLE");
1186 feat_shallow_poisonous_puddle = f_tag_to_index_in_init("SHALLOW_POISONOUS_PUDDLE");
1187 feat_dirt = f_tag_to_index_in_init("DIRT");
1188 feat_grass = f_tag_to_index_in_init("GRASS");
1189 feat_flower = f_tag_to_index_in_init("FLOWER");
1190 feat_brake = f_tag_to_index_in_init("BRAKE");
1191 feat_tree = f_tag_to_index_in_init("TREE");
1192 feat_mountain = f_tag_to_index_in_init("MOUNTAIN");
1193 feat_swamp = f_tag_to_index_in_init("SWAMP");
1195 /* Unknown grid (not detected) */
1196 feat_undetected = f_tag_to_index_in_init("UNDETECTED");
1198 /* Wilderness terrains */
1199 init_wilderness_terrains();
1201 return feat_tag_is_not_found ? PARSE_ERROR_UNDEFINED_TERRAIN_TAG : 0;
1206 * @brief その他の初期情報更新 /
1207 * Initialize some other arrays
1210 static errr init_other(void)
1215 /*** Prepare the "dungeon" information ***/
1217 /* Allocate and Wipe the object list */
1218 C_MAKE(current_floor_ptr->o_list, current_floor_ptr->max_o_idx, object_type);
1220 /* Allocate and Wipe the monster list */
1221 C_MAKE(current_floor_ptr->m_list, current_floor_ptr->max_m_idx, monster_type);
1223 /* Allocate and Wipe the monster process list */
1224 for (i = 0; i < MAX_MTIMED; i++)
1226 C_MAKE(current_floor_ptr->mproc_list[i], current_floor_ptr->max_m_idx, s16b);
1229 /* Allocate and Wipe the max dungeon level */
1230 C_MAKE(max_dlv, max_d_idx, DEPTH);
1232 /* Allocate and wipe each line of the current_floor_ptr->grid_array */
1233 for (i = 0; i < MAX_HGT; i++)
1235 /* Allocate one row of the current_floor_ptr->grid_array */
1236 C_MAKE(current_floor_ptr->grid_array[i], MAX_WID, grid_type);
1240 /*** Prepare the various "bizarre" arrays ***/
1242 /* Macro variables */
1243 C_MAKE(macro__pat, MACRO_MAX, concptr);
1244 C_MAKE(macro__act, MACRO_MAX, concptr);
1245 C_MAKE(macro__cmd, MACRO_MAX, bool);
1247 /* Macro action buffer */
1248 C_MAKE(macro__buf, 1024, char);
1250 /* Quark variables */
1253 /* Message variables */
1254 C_MAKE(message__ptr, MESSAGE_MAX, u32b);
1255 C_MAKE(message__buf, MESSAGE_BUF, char);
1257 /* Hack -- No messages yet */
1258 message__tail = MESSAGE_BUF;
1261 /*** Prepare the Player inventory ***/
1264 C_MAKE(inventory, INVEN_TOTAL, object_type);
1267 /*** Prepare the options ***/
1269 /* Scan the options */
1270 for (i = 0; option_info[i].o_desc; i++)
1272 int os = option_info[i].o_set;
1273 int ob = option_info[i].o_bit;
1275 /* Set the "default" options */
1276 if (option_info[i].o_var)
1279 option_mask[os] |= (1L << ob);
1282 if (option_info[i].o_norm)
1285 option_flag[os] |= (1L << ob);
1292 option_flag[os] &= ~(1L << ob);
1297 /* Analyze the windows */
1298 for (n = 0; n < 8; n++)
1300 /* Analyze the options */
1301 for (i = 0; i < 32; i++)
1304 if (window_flag_desc[i])
1307 window_mask[n] |= (1L << i);
1313 * Set the "default" window flags
1314 * Window 1 : Display messages
1315 * Window 2 : Display inven/equip
1317 window_flag[1] = 1L << A_MAX;
1318 window_flag[2] = 1L << 0;
1321 /*** Pre-allocate space for the "format()" buffer ***/
1323 /* Hack -- Just call the "format()" function */
1324 (void)format("%s (%s).", "Mr.Hoge", MAINTAINER);
1333 * @brief オブジェクト配列を初期化する /
1334 * Initialize some other arrays
1337 static errr init_object_alloc(void)
1342 s16b num[MAX_DEPTH];
1343 s16b aux[MAX_DEPTH];
1346 /*** Analyze object allocation info ***/
1348 /* Clear the "aux" array */
1349 (void)C_WIPE(&aux, MAX_DEPTH, s16b);
1351 /* Clear the "num" array */
1352 (void)C_WIPE(&num, MAX_DEPTH, s16b);
1354 /* Free the old "alloc_kind_table" (if it exists) */
1355 if (alloc_kind_table)
1357 C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
1360 /* Size of "alloc_kind_table" */
1361 alloc_kind_size = 0;
1363 /* Scan the objects */
1364 for (i = 1; i < max_k_idx; i++)
1368 /* Scan allocation pairs */
1369 for (j = 0; j < 4; j++)
1371 /* Count the "legal" entries */
1372 if (k_ptr->chance[j])
1374 /* Count the entries */
1377 /* Group by level */
1378 num[k_ptr->locale[j]]++;
1383 /* Collect the level indexes */
1384 for (i = 1; i < MAX_DEPTH; i++)
1386 /* Group by level */
1389 if (!num[0]) quit(_("町のアイテムがない!", "No town objects!"));
1391 /*** Initialize object allocation info ***/
1393 /* Allocate the alloc_kind_table */
1394 C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
1396 /* Access the table entry */
1397 table = alloc_kind_table;
1399 /* Scan the objects */
1400 for (i = 1; i < max_k_idx; i++)
1404 /* Scan allocation pairs */
1405 for (j = 0; j < 4; j++)
1407 /* Count the "legal" entries */
1408 if (k_ptr->chance[j])
1412 /* Extract the base level */
1413 x = k_ptr->locale[j];
1415 /* Extract the base probability */
1416 p = (100 / k_ptr->chance[j]);
1418 /* Skip entries preceding our locale */
1419 y = (x > 0) ? num[x-1] : 0;
1421 /* Skip previous entries at this locale */
1424 /* Load the entry */
1425 table[z].index = (KIND_OBJECT_IDX)i;
1426 table[z].level = (DEPTH)x;
1427 table[z].prob1 = (PROB)p;
1428 table[z].prob2 = (PROB)p;
1429 table[z].prob3 = (PROB)p;
1431 /* Another entry complete for this locale */
1443 * @brief モンスター配列と生成テーブルを初期化する /
1444 * Initialize some other arrays
1447 static errr init_alloc(void)
1450 monster_race *r_ptr;
1456 /* Allocate the "r_info" array */
1457 C_MAKE(elements, max_r_idx, tag_type);
1459 /* Scan the monsters */
1460 for (i = 1; i < max_r_idx; i++)
1462 elements[i].tag = r_info[i].level;
1463 elements[i].index = i;
1466 tag_sort(elements, max_r_idx);
1468 /*** Initialize monster allocation info ***/
1470 /* Size of "alloc_race_table" */
1471 alloc_race_size = max_r_idx;
1473 /* Allocate the alloc_race_table */
1474 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1476 /* Scan the monsters */
1477 for (i = 1; i < max_r_idx; i++)
1479 /* Get the i'th race */
1480 r_ptr = &r_info[elements[i].index];
1482 /* Count valid pairs */
1487 /* Extract the base level */
1490 /* Extract the base probability */
1491 p = (100 / r_ptr->rarity);
1493 /* Load the entry */
1494 alloc_race_table[i].index = (KIND_OBJECT_IDX)elements[i].index;
1495 alloc_race_table[i].level = (DEPTH)x;
1496 alloc_race_table[i].prob1 = (PROB)p;
1497 alloc_race_table[i].prob2 = (PROB)p;
1498 alloc_race_table[i].prob3 = (PROB)p;
1502 /* Free the "r_info" array */
1503 C_KILL(elements, max_r_idx, tag_type);
1505 #else /* SORT_R_INFO */
1509 s16b num[MAX_DEPTH];
1510 s16b aux[MAX_DEPTH];
1512 /*** Analyze monster allocation info ***/
1514 /* Clear the "aux" array */
1515 C_WIPE(&aux, MAX_DEPTH, s16b);
1517 /* Clear the "num" array */
1518 C_WIPE(&num, MAX_DEPTH, s16b);
1520 /* Size of "alloc_race_table" */
1521 alloc_race_size = 0;
1523 /* Scan the monsters */
1524 for (i = 1; i < max_r_idx; i++)
1526 /* Get the i'th race */
1529 /* Legal monsters */
1532 /* Count the entries */
1535 /* Group by level */
1536 num[r_ptr->level]++;
1540 /* Collect the level indexes */
1541 for (i = 1; i < MAX_DEPTH; i++)
1543 /* Group by level */
1546 if (!num[0]) quit(_("町のモンスターがない!", "No town monsters!"));
1548 /*** Initialize monster allocation info ***/
1550 /* Allocate the alloc_race_table */
1551 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1553 /* Access the table entry */
1554 table = alloc_race_table;
1556 /* Scan the monsters */
1557 for (i = 1; i < max_r_idx; i++)
1559 /* Get the i'th race */
1562 /* Count valid pairs */
1567 /* Extract the base level */
1570 /* Extract the base probability */
1571 p = (100 / r_ptr->rarity);
1573 /* Skip entries preceding our locale */
1574 y = (x > 0) ? num[x-1] : 0;
1576 /* Skip previous entries at this locale */
1579 /* Load the entry */
1586 /* Another entry complete for this locale */
1591 #endif /* SORT_R_INFO */
1593 /* Init the "alloc_kind_table" */
1594 (void)init_object_alloc();
1603 * @brief 画面左下にシステムメッセージを表示する /
1604 * Hack -- take notes on line 23
1607 static void note(concptr str)
1609 Term_erase(0, 23, 255);
1610 Term_putstr(20, 23, -1, TERM_WHITE, str);
1617 * @brief 全ゲームデータ読み込みのサブルーチン /
1618 * Hack -- Explain a broken "lib" folder and quit (see below).
1622 * This function is "messy" because various things
1623 * may or may not be initialized, but the "plog()" and "quit()"
1624 * functions are "supposed" to work under any conditions.
1627 static void init_angband_aux(concptr why)
1634 plog("'lib'ディレクトリが存在しないか壊れているようです。");
1637 plog("ひょっとするとアーカイブが正しく解凍されていないのかもしれません。");
1640 plog("該当する'README'ファイルを読んで確認してみて下さい。");
1642 /* Quit with error */
1646 plog("The 'lib' directory is probably missing or broken.");
1649 plog("Perhaps the archive was not extracted correctly.");
1652 plog("See the 'README' file for more information.");
1654 /* Quit with error */
1655 quit("Fatal Error.");
1662 * @brief 全ゲームデータ読み込みのメインルーチン /
1663 * Hack -- main Angband initialization entry point
1667 * This function is "messy" because various things
1668 * may or may not be initialized, but the "plog()" and "quit()"
1669 * functions are "supposed" to work under any conditions.
1670 * Verify some files, display the "news.txt" file, create
1671 * the high score file, initialize all internal arrays, and
1672 * load the basic "user pref files".
1673 * Be very careful to keep track of the order in which things
1674 * are initialized, in particular, the only thing *known* to
1675 * be available when this function is called is the "z-term.c"
1676 * package, and that may not be fully initialized until the
1677 * end of this function, when the default "user pref files"
1678 * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
1679 * Note that this function attempts to verify the "news" file,
1680 * and the game aborts (cleanly) on failure, since without the
1681 * "news" file, it is likely that the "lib" folder has not been
1682 * correctly located. Otherwise, the news file is displayed for
1684 * Note that this function attempts to verify (or create) the
1685 * "high score" file, and the game aborts (cleanly) on failure,
1686 * since one of the most common "extraction" failures involves
1687 * failing to extract all sub-directories (even empty ones), such
1688 * as by failing to use the "-d" option of "pkunzip", or failing
1689 * to use the "save empty directories" option with "Compact Pro".
1690 * This error will often be caught by the "high score" creation
1691 * code below, since the "lib/apex" directory, being empty in the
1692 * standard distributions, is most likely to be "lost", making it
1693 * impossible to create the high score file.
1694 * Note that various things are initialized by this function,
1695 * including everything that was once done by "init_some_arrays".
1696 * This initialization involves the parsing of special files
1697 * in the "lib/data" and sometimes the "lib/edit" directories.
1698 * Note that the "template" files are initialized first, since they
1699 * often contain errors. This means that macros and message recall
1700 * and things like that are not available until after they are done.
1701 * We load the default "user pref files" here in case any "color"
1702 * changes are needed before character creation.
1703 * Note that the "graf-xxx.prf" file must be loaded separately,
1704 * if needed, in the first (?) pass through "TERM_XTRA_REACT".
1707 void init_angband(void)
1711 BIT_FLAGS mode = 0664;
1718 /*** Verify the "news" file ***/
1720 /* Build the filename */
1721 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1723 /* Attempt to open the file */
1724 fd = fd_open(buf, O_RDONLY);
1731 sprintf(why, _("'%s'ファイルにアクセスできません!", "Cannot access the '%s' file!"), buf);
1733 /* Crash and burn */
1734 init_angband_aux(why);
1739 /*** Display the "news" file ***/
1742 /* Build the filename */
1743 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1745 /* Open the News file */
1746 fp = my_fopen(buf, "r");
1753 /* Dump the file to the screen */
1754 while (0 == my_fgets(fp, buf, sizeof(buf)))
1756 /* Display and advance */
1757 Term_putstr(0, i++, -1, TERM_WHITE, buf);
1768 /*** Verify (or create) the "high score" file ***/
1770 /* Build the filename */
1771 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
1773 /* Attempt to open the high score file */
1774 fd = fd_open(buf, O_RDONLY);
1779 /* File type is "DATA" */
1780 FILE_TYPE(FILE_TYPE_DATA);
1782 /* Grab permissions */
1785 /* Create a new high score file */
1786 fd = fd_make(buf, mode);
1788 /* Drop permissions */
1796 sprintf(why, _("'%s'ファイルを作成できません!", "Cannot create the '%s' file!"), buf);
1798 /* Crash and burn */
1799 init_angband_aux(why);
1806 /*** Initialize some arrays ***/
1808 /* Initialize misc. values */
1809 note(_("[変数を初期化しています...(その他)", "[Initializing values... (misc)]"));
1810 if (init_misc()) quit(_("その他の変数を初期化できません", "Cannot initialize misc. values"));
1812 /* Initialize feature info */
1814 note("[データの初期化中... (地形)]");
1815 if (init_f_info()) quit("地形初期化不能");
1816 if (init_feat_variables()) quit("地形初期化不能");
1818 note("[Initializing arrays... (features)]");
1819 if (init_f_info()) quit("Cannot initialize features");
1820 if (init_feat_variables()) quit("Cannot initialize features");
1824 /* Initialize object info */
1825 note(_("[データの初期化中... (アイテム)]", "[Initializing arrays... (objects)]"));
1826 if (init_k_info()) quit(_("アイテム初期化不能", "Cannot initialize objects"));
1829 /* Initialize artifact info */
1830 note(_("[データの初期化中... (伝説のアイテム)]", "[Initializing arrays... (artifacts)]"));
1831 if (init_a_info()) quit(_("伝説のアイテム初期化不能", "Cannot initialize artifacts"));
1834 /* Initialize ego-item info */
1835 note(_("[データの初期化中... (名のあるアイテム)]", "[Initializing arrays... (ego-items)]"));
1836 if (init_e_info()) quit(_("名のあるアイテム初期化不能", "Cannot initialize ego-items"));
1839 /* Initialize monster info */
1840 note(_("[データの初期化中... (モンスター)]", "[Initializing arrays... (monsters)]"));
1841 if (init_r_info()) quit(_("モンスター初期化不能", "Cannot initialize monsters"));
1844 /* Initialize dungeon info */
1845 note(_("[データの初期化中... (ダンジョン)]", "[Initializing arrays... (dungeon)]"));
1846 if (init_d_info()) quit(_("ダンジョン初期化不能", "Cannot initialize dungeon"));
1849 for (i = 1; i < max_d_idx; i++)
1850 if (d_info[i].final_guardian)
1851 r_info[d_info[i].final_guardian].flags7 |= RF7_GUARDIAN;
1854 /* Initialize magic info */
1855 note(_("[データの初期化中... (魔法)]", "[Initializing arrays... (magic)]"));
1856 if (init_m_info()) quit(_("魔法初期化不能", "Cannot initialize magic"));
1858 /* Initialize weapon_exp info */
1859 note(_("[データの初期化中... (熟練度)]", "[Initializing arrays... (skill)]"));
1860 if (init_s_info()) quit(_("熟練度初期化不能", "Cannot initialize skill"));
1862 /* Initialize wilderness array */
1863 note(_("[配列を初期化しています... (荒野)]", "[Initializing arrays... (wilderness)]"));
1865 if (init_wilderness()) quit(_("荒野を初期化できません", "Cannot initialize wilderness"));
1868 /* Initialize town array */
1869 note(_("[配列を初期化しています... (街)]", "[Initializing arrays... (towns)]"));
1870 if (init_towns()) quit(_("街を初期化できません", "Cannot initialize towns"));
1873 /* Initialize building array */
1874 note(_("[配列を初期化しています... (建物)]", "[Initializing arrays... (buildings)]"));
1875 if (init_buildings()) quit(_("建物を初期化できません", "Cannot initialize buildings"));
1878 /* Initialize quest array */
1879 note(_("[配列を初期化しています... (クエスト)]", "[Initializing arrays... (quests)]"));
1880 if (init_quests()) quit(_("クエストを初期化できません", "Cannot initialize quests"));
1882 /* Initialize vault info */
1883 if (init_v_info()) quit(_("vault 初期化不能", "Cannot initialize vaults"));
1885 /* Initialize some other arrays */
1886 note(_("[データの初期化中... (その他)]", "[Initializing arrays... (other)]"));
1887 if (init_other()) quit(_("その他のデータ初期化不能", "Cannot initialize other stuff"));
1890 /* Initialize some other arrays */
1891 note(_("[データの初期化中... (アロケーション)]", "[Initializing arrays... (alloc)]"));
1892 if (init_alloc()) quit(_("アロケーション・スタッフ初期化不能", "Cannot initialize alloc stuff"));
1896 /*** Load default user pref files ***/
1898 /* Initialize feature info */
1899 note(_("[ユーザー設定ファイルを初期化しています...]", "[Initializing user pref files...]"));
1901 /* Access the "basic" pref file */
1902 strcpy(buf, "pref.prf");
1904 /* Process that file */
1905 process_pref_file(buf);
1907 /* Access the "basic" system pref file */
1908 sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
1910 /* Process that file */
1911 process_pref_file(buf);
1913 note(_("[初期化終了]", "[Initialization complete]"));
1920 static void put_title(void)
1925 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,
1927 sprintf(title, _("変愚蛮怒 %d.%d.%d(%s)", "Hengband %d.%d.%d(%s)"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH,
1929 IS_STABLE_VERSION ? _("安定版", "Stable") : _("開発版", "Developing"));
1930 col = (80 - strlen(title)) / 2;
1931 col = col < 0 ? 0 : col;
1932 prt(title, VER_INFO_ROW, col);
1936 * @brief サムチェック情報を出力 / Get check sum in string form
1937 * @return サムチェック情報の文字列
1939 concptr get_check_sum(void)
1941 return format("%02x%02x%02x%02x%02x%02x%02x%02x%02x",