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 #include "dungeon-file.h"
50 #ifdef CHECK_MODIFICATION_TIME
51 #include <sys/types.h>
53 #endif /* CHECK_MODIFICATION_TIME */
56 static void put_title(void);
59 * @brief 各データファイルを読み取るためのパスを取得する
60 * Find the default paths to all of our important sub-directories.
61 * @param path パス保管先の文字列
65 * The purpose of each sub-directory is described in "variable.c".
66 * All of the sub-directories should, by default, be located inside
67 * the main "lib" directory, whose location is very system dependant.
68 * This function takes a writable buffer, initially containing the
69 * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
70 * or a system dependant string, for example, ":lib:". The buffer
71 * must be large enough to contain at least 32 more characters.
72 * Various command line options may allow some of the important
73 * directories to be changed to user-specified directories, most
74 * importantly, the "info" and "user" and "save" directories,
75 * but this is done after this function, see "main.c".
76 * In general, the initial path should end in the appropriate "PATH_SEP"
77 * string. All of the "sub-directory" paths (created below or supplied
78 * by the user) will NOT end in the "PATH_SEP" string, see the special
79 * "path_build()" function in "util.c" for more information.
80 * Mega-Hack -- support fat raw files under NEXTSTEP, using special
81 * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
82 * requiring the directories to be created by hand by the user.
83 * Hack -- first we free all the strings, since this is known
84 * to succeed even if the strings have not been allocated yet,
85 * as long as the variables start out as "NULL". This allows
86 * this function to be called multiple times, for example, to
87 * try several base "path" values until a good one is found.
90 void init_file_paths(char *path)
94 #ifdef PRIVATE_USER_PATH
96 #endif /* PRIVATE_USER_PATH */
98 /*** Free everything ***/
100 /* Free the main path */
101 string_free(ANGBAND_DIR);
103 /* Free the sub-paths */
104 string_free(ANGBAND_DIR_APEX);
105 string_free(ANGBAND_DIR_BONE);
106 string_free(ANGBAND_DIR_DATA);
107 string_free(ANGBAND_DIR_EDIT);
108 string_free(ANGBAND_DIR_SCRIPT);
109 string_free(ANGBAND_DIR_FILE);
110 string_free(ANGBAND_DIR_HELP);
111 string_free(ANGBAND_DIR_INFO);
112 string_free(ANGBAND_DIR_SAVE);
113 string_free(ANGBAND_DIR_USER);
114 string_free(ANGBAND_DIR_XTRA);
117 /*** Prepare the "path" ***/
119 /* Hack -- save the main directory */
120 ANGBAND_DIR = string_make(path);
122 /* Prepare to append to the Base Path */
123 tail = path + strlen(path);
125 /*** Build the sub-directory names ***/
127 /* Build a path name */
128 strcpy(tail, "apex");
129 ANGBAND_DIR_APEX = string_make(path);
131 /* Build a path name */
132 strcpy(tail, "bone");
133 ANGBAND_DIR_BONE = string_make(path);
135 /* Build a path name */
136 strcpy(tail, "data");
137 ANGBAND_DIR_DATA = string_make(path);
139 /* Build a path name */
140 strcpy(tail, "edit");
141 ANGBAND_DIR_EDIT = string_make(path);
143 /* Build a path name */
144 strcpy(tail, "script");
145 ANGBAND_DIR_SCRIPT = string_make(path);
147 /* Build a path name */
148 strcpy(tail, "file");
149 ANGBAND_DIR_FILE = string_make(path);
151 /* Build a path name */
152 strcpy(tail, "help");
153 ANGBAND_DIR_HELP = string_make(path);
155 /* Build a path name */
156 strcpy(tail, "info");
157 ANGBAND_DIR_INFO = string_make(path);
159 /* Build a path name */
160 strcpy(tail, "pref");
161 ANGBAND_DIR_PREF = string_make(path);
163 /* Build a path name */
164 strcpy(tail, "save");
165 ANGBAND_DIR_SAVE = string_make(path);
167 #ifdef PRIVATE_USER_PATH
169 /* Build the path to the user specific directory */
170 path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
172 /* Build a relative path name */
173 ANGBAND_DIR_USER = string_make(buf);
175 #else /* PRIVATE_USER_PATH */
177 /* Build a path name */
178 strcpy(tail, "user");
179 ANGBAND_DIR_USER = string_make(path);
181 #endif /* PRIVATE_USER_PATH */
183 /* Build a path name */
184 strcpy(tail, "xtra");
185 ANGBAND_DIR_XTRA = string_make(path);
190 /* Allow "fat binary" usage with NeXT */
211 /* Use special directory */
214 /* Forget the old path name */
215 string_free(ANGBAND_DIR_DATA);
217 /* Build a new path name */
218 sprintf(tail, "data-%s", next);
219 ANGBAND_DIR_DATA = string_make(path);
229 #ifdef ALLOW_TEMPLATES
233 * Hack -- help give useful error messages
235 int error_idx; /*!< データ読み込み/初期化時に汎用的にエラーコードを保存するグローバル変数 */
236 int error_line; /*!< データ読み込み/初期化時に汎用的にエラー行数を保存するグローバル変数 */
240 * エラーメッセージの名称定義 / Standard error message text
242 concptr err_str[PARSE_ERROR_MAX] =
259 "missing record header",
260 "non-sequential records",
261 "invalid flag specification",
262 "undefined directive",
264 "coordinates out of bounds",
266 "undefined terrain tag",
272 #endif /* ALLOW_TEMPLATES */
278 header v_head; /*!< Vault情報のヘッダ構造体 */
279 header f_head; /*!< 地形情報のヘッダ構造体 */
280 header k_head; /*!< ペースアイテム情報のヘッダ構造体 */
281 header a_head; /*!< 固定アーティファクト情報のヘッダ構造体 */
282 header e_head; /*!< アイテムエゴ情報のヘッダ構造体 */
283 header r_head; /*!< モンスター種族情報のヘッダ構造体 */
284 header d_head; /*!< ダンジョン情報のヘッダ構造体 */
285 header s_head; /*!< プレイヤー職業技能情報のヘッダ構造体 */
286 header m_head; /*!< プレイヤー職業魔法情報のヘッダ構造体 */
288 #ifdef CHECK_MODIFICATION_TIME
291 * @brief テキストファイルとrawファイルの更新時刻を比較する
292 * Find the default paths to all of our important sub-directories.
293 * @param fd ファイルディスクリプタ
294 * @param template_file ファイル名
295 * @return テキストの方が新しいか、rawファイルがなく更新の必要がある場合-1、更新の必要がない場合0。
297 static errr check_modification_date(int fd, concptr template_file)
301 struct stat txt_stat, raw_stat;
303 /* Build the filename */
304 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, template_file);
306 /* Access stats on text file */
307 if (stat(buf, &txt_stat))
309 /* No text file - continue */
312 /* Access stats on raw file */
313 else if (fstat(fd, &raw_stat))
319 /* Ensure text file is not newer than raw file */
320 else if (txt_stat.st_mtime > raw_stat.st_mtime)
322 /* Reprocess text file */
329 #endif /* CHECK_MODIFICATION_TIME */
333 /*** Initialize from binary image files ***/
337 * @brief rawファイルからのデータの読み取り処理
338 * Initialize the "*_info" array, by parsing a binary "image" file
339 * @param fd ファイルディスクリプタ
340 * @param head rawファイルのヘッダ
343 static errr init_info_raw(int fd, header *head)
347 /* Read and Verify the header */
348 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
349 (test.v_major != head->v_major) ||
350 (test.v_minor != head->v_minor) ||
351 (test.v_patch != head->v_patch) ||
352 (test.info_num != head->info_num) ||
353 (test.info_len != head->info_len) ||
354 (test.head_size != head->head_size) ||
355 (test.info_size != head->info_size))
362 /* Accept the header */
366 /* Allocate the "*_info" array */
367 C_MAKE(head->info_ptr, head->info_size, char);
369 /* Read the "*_info" array */
370 fd_read(fd, head->info_ptr, head->info_size);
375 /* Allocate the "*_name" array */
376 C_MAKE(head->name_ptr, head->name_size, char);
378 /* Read the "*_name" array */
379 fd_read(fd, head->name_ptr, head->name_size);
385 /* Allocate the "*_text" array */
386 C_MAKE(head->text_ptr, head->text_size, char);
388 /* Read the "*_text" array */
389 fd_read(fd, head->text_ptr, head->text_size);
395 /* Allocate the "*_tag" array */
396 C_MAKE(head->tag_ptr, head->tag_size, char);
398 /* Read the "*_tag" array */
399 fd_read(fd, head->tag_ptr, head->tag_size);
411 * Initialize the header of an *_info.raw file.
412 * @param head rawファイルのヘッダ
417 static void init_header(header *head, IDX num, int len)
419 /* Save the "version" */
420 head->v_major = FAKE_VER_MAJOR;
421 head->v_minor = FAKE_VER_MINOR;
422 head->v_patch = FAKE_VER_PATCH;
425 /* Save the "record" information */
426 head->info_num = (IDX)num;
427 head->info_len = len;
429 /* Save the size of "*_head" and "*_info" */
430 head->head_size = sizeof(header);
431 head->info_size = head->info_num * head->info_len;
437 * Initialize the "*_info" array
438 * @param filename ファイル名(拡張子txt/raw)
439 * @param head 処理に用いるヘッダ構造体
440 * @param info データ保管先の構造体ポインタ
441 * @param name 名称用可変文字列の保管先
442 * @param text テキスト用可変文字列の保管先
443 * @param tag タグ用可変文字列の保管先
446 * Note that we let each entry have a unique "name" and "text" string,
447 * even if the string happens to be empty (everyone has a unique '\0').
449 static errr init_info(concptr filename, header *head,
450 void **info, char **name, char **text, char **tag)
454 BIT_FLAGS mode = 0644;
464 #ifdef ALLOW_TEMPLATES
466 /*** Load the binary image file ***/
468 /* Build the filename */
469 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
472 /* Attempt to open the "raw" file */
473 fd = fd_open(buf, O_RDONLY);
475 /* Process existing "raw" file */
478 #ifdef CHECK_MODIFICATION_TIME
480 err = check_modification_date(fd, format("%s.txt", filename));
482 #endif /* CHECK_MODIFICATION_TIME */
484 /* Attempt to parse the "raw" file */
486 err = init_info_raw(fd, head);
491 /* Do we have to parse the *.txt file? */
494 /*** Make the fake arrays ***/
496 /* Allocate the "*_info" array */
497 C_MAKE(head->info_ptr, head->info_size, char);
499 /* Hack -- make "fake" arrays */
500 if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
501 if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
502 if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
504 if (info) (*info) = head->info_ptr;
505 if (name) (*name) = head->name_ptr;
506 if (text) (*text) = head->text_ptr;
507 if (tag) (*tag) = head->tag_ptr;
509 /*** Load the ascii template file ***/
511 /* Build the filename */
513 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
516 fp = my_fopen(buf, "r");
519 if (!fp) quit(format(_("'%s.txt'ファイルをオープンできません。", "Cannot open '%s.txt' file."), filename));
522 err = init_info_txt(fp, buf, head, head->parse_info_txt);
532 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "未知の");
534 msg_format("'%s.txt'ファイルの %d 行目にエラー。", filename, error_line);
535 msg_format("レコード %d は '%s' エラーがあります。", error_idx, oops);
536 msg_format("構文 '%s'。", buf);
540 quit(format("'%s.txt'ファイルにエラー", filename));
543 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
545 msg_format("Error %d at line %d of '%s.txt'.", err, error_line, filename);
546 msg_format("Record %d contains a '%s' error.", error_idx, oops);
547 msg_format("Parsing '%s'.", buf);
551 quit(format("Error in '%s.txt' file.", filename));
557 /*** Make final retouch on fake tags ***/
561 (*head->retouch)(head);
565 /*** Dump the binary image file ***/
567 /* File type is "DATA" */
568 FILE_TYPE(FILE_TYPE_DATA);
570 /* Build the filename */
571 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
574 /* Grab permissions */
577 /* Kill the old file */
580 /* Attempt to create the raw file */
581 fd = fd_make(buf, mode);
583 /* Drop permissions */
586 /* Dump to the file */
590 fd_write(fd, (concptr)(head), head->head_size);
592 /* Dump the "*_info" array */
593 fd_write(fd, head->info_ptr, head->info_size);
595 /* Dump the "*_name" array */
596 fd_write(fd, head->name_ptr, head->name_size);
598 /* Dump the "*_text" array */
599 fd_write(fd, head->text_ptr, head->text_size);
601 /* Dump the "*_tag" array */
602 fd_write(fd, head->tag_ptr, head->tag_size);
609 /*** Kill the fake arrays ***/
611 /* Free the "*_info" array */
612 C_KILL(head->info_ptr, head->info_size, char);
614 /* Hack -- Free the "fake" arrays */
615 if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char);
616 if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char);
617 if (tag) C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char);
619 #endif /* ALLOW_TEMPLATES */
622 /*** Load the binary image file ***/
624 /* Build the filename */
625 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
627 /* Attempt to open the "raw" file */
628 fd = fd_open(buf, O_RDONLY);
630 /* Process existing "raw" file */
631 if (fd < 0) quit(format(_("'%s_j.raw'ファイルをロードできません。", "Cannot load '%s.raw' file."), filename));
633 /* Attempt to parse the "raw" file */
634 err = init_info_raw(fd, head);
638 if (err) quit(format(_("'%s_j.raw'ファイルを解析できません。", "Cannot parse '%s.raw' file."), filename));
640 #ifdef ALLOW_TEMPLATES
644 if (info) (*info) = head->info_ptr;
645 if (name) (*name) = head->name_ptr;
646 if (text) (*text) = head->text_ptr;
647 if (tag) (*tag) = head->tag_ptr;
655 * @brief 地形情報読み込みのメインルーチン /
656 * Initialize the "f_info" array
659 static errr init_f_info(void)
661 /* Init the header */
662 init_header(&f_head, max_f_idx, sizeof(feature_type));
664 #ifdef ALLOW_TEMPLATES
666 /* Save a pointer to the parsing function */
667 f_head.parse_info_txt = parse_f_info;
669 /* Save a pointer to the retouch fake tags */
670 f_head.retouch = retouch_f_info;
672 #endif /* ALLOW_TEMPLATES */
674 return init_info("f_info", &f_head,
675 (void*)&f_info, &f_name, NULL, &f_tag);
680 * @brief ベースアイテム情報読み込みのメインルーチン /
681 * Initialize the "k_info" array
684 static errr init_k_info(void)
686 /* Init the header */
687 init_header(&k_head, max_k_idx, sizeof(object_kind));
689 #ifdef ALLOW_TEMPLATES
691 /* Save a pointer to the parsing function */
692 k_head.parse_info_txt = parse_k_info;
694 #endif /* ALLOW_TEMPLATES */
696 return init_info("k_info", &k_head,
697 (void*)&k_info, &k_name, &k_text, NULL);
703 * @brief 固定アーティファクト情報読み込みのメインルーチン /
704 * Initialize the "a_info" array
707 static errr init_a_info(void)
709 /* Init the header */
710 init_header(&a_head, max_a_idx, sizeof(artifact_type));
712 #ifdef ALLOW_TEMPLATES
714 /* Save a pointer to the parsing function */
715 a_head.parse_info_txt = parse_a_info;
717 #endif /* ALLOW_TEMPLATES */
719 return init_info("a_info", &a_head,
720 (void*)&a_info, &a_name, &a_text, NULL);
726 * @brief 固定アーティファクト情報読み込みのメインルーチン /
727 * Initialize the "e_info" array
730 static errr init_e_info(void)
732 /* Init the header */
733 init_header(&e_head, max_e_idx, sizeof(ego_item_type));
735 #ifdef ALLOW_TEMPLATES
737 /* Save a pointer to the parsing function */
738 e_head.parse_info_txt = parse_e_info;
740 #endif /* ALLOW_TEMPLATES */
742 return init_info("e_info", &e_head,
743 (void*)&e_info, &e_name, &e_text, NULL);
749 * @brief モンスター種族情報読み込みのメインルーチン /
750 * Initialize the "r_info" array
753 static errr init_r_info(void)
755 /* Init the header */
756 init_header(&r_head, max_r_idx, sizeof(monster_race));
758 #ifdef ALLOW_TEMPLATES
760 /* Save a pointer to the parsing function */
761 r_head.parse_info_txt = parse_r_info;
763 #endif /* ALLOW_TEMPLATES */
765 return init_info("r_info", &r_head,
766 (void*)&r_info, &r_name, &r_text, NULL);
772 * @brief ダンジョン情報読み込みのメインルーチン /
773 * Initialize the "d_info" array
776 static errr init_d_info(void)
778 /* Init the header */
779 init_header(&d_head, max_d_idx, sizeof(dungeon_type));
781 #ifdef ALLOW_TEMPLATES
783 /* Save a pointer to the parsing function */
784 d_head.parse_info_txt = parse_d_info;
786 #endif /* ALLOW_TEMPLATES */
788 return init_info("d_info", &d_head,
789 (void*)&d_info, &d_name, &d_text, NULL);
794 * @brief Vault情報読み込みのメインルーチン /
795 * Initialize the "v_info" array
798 * Note that we let each entry have a unique "name" and "text" string,
799 * even if the string happens to be empty (everyone has a unique '\0').
801 errr init_v_info(void)
803 /* Init the header */
804 init_header(&v_head, max_v_idx, sizeof(vault_type));
806 #ifdef ALLOW_TEMPLATES
808 /* Save a pointer to the parsing function */
809 v_head.parse_info_txt = parse_v_info;
811 #endif /* ALLOW_TEMPLATES */
813 return init_info("v_info", &v_head,
814 (void*)&v_info, &v_name, &v_text, NULL);
819 * @brief 職業技能情報読み込みのメインルーチン /
820 * Initialize the "s_info" array
823 static errr init_s_info(void)
825 /* Init the header */
826 init_header(&s_head, MAX_CLASS, sizeof(skill_table));
828 #ifdef ALLOW_TEMPLATES
830 /* Save a pointer to the parsing function */
831 s_head.parse_info_txt = parse_s_info;
833 #endif /* ALLOW_TEMPLATES */
835 return init_info("s_info", &s_head,
836 (void*)&s_info, NULL, NULL, NULL);
841 * @brief 職業魔法情報読み込みのメインルーチン /
842 * Initialize the "m_info" array
845 static errr init_m_info(void)
847 /* Init the header */
848 init_header(&m_head, MAX_CLASS, sizeof(player_magic));
850 #ifdef ALLOW_TEMPLATES
852 /* Save a pointer to the parsing function */
853 m_head.parse_info_txt = parse_m_info;
855 #endif /* ALLOW_TEMPLATES */
857 return init_info("m_info", &m_head,
858 (void*)&m_info, NULL, NULL, NULL);
866 * @brief 基本情報読み込みのメインルーチン /
867 * Initialize misc. values
870 static errr init_misc(void)
872 /* Initialize the values */
873 process_dungeon_file("misc.txt", 0, 0, 0, 0);
880 * @brief 町情報読み込みのメインルーチン /
881 * Initialize town array
884 static errr init_towns(void)
888 /*** Prepare the Towns ***/
890 /* Allocate the towns */
891 C_MAKE(town_info, max_towns, town_type);
893 for (i = 1; i < max_towns; i++)
895 /*** Prepare the Stores ***/
897 /* Allocate the stores */
898 C_MAKE(town_info[i].store, MAX_STORES, store_type);
900 /* Fill in each store */
901 for (j = 0; j < MAX_STORES; j++)
903 /* Access the store */
904 store_type *st_ptr = &town_info[i].store[j];
906 if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME)) continue;
908 /* Assume full stock */
911 * 我が家が 20 ページまで使える隠し機能のための準備。
912 * オプションが有効でもそうでなくても一応スペース
917 st_ptr->stock_size = (STORE_INVEN_MAX * 10);
919 else if (j == STORE_MUSEUM)
921 st_ptr->stock_size = (STORE_INVEN_MAX * 50);
925 st_ptr->stock_size = STORE_INVEN_MAX;
927 /* Allocate the stock */
928 C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type);
930 /* No table for the black market or home */
931 if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM)) continue;
933 /* Assume full table */
934 st_ptr->table_size = STORE_CHOICES;
936 /* Allocate the stock */
937 C_MAKE(st_ptr->table, st_ptr->table_size, s16b);
939 /* Scan the choices */
940 for (k = 0; k < STORE_CHOICES; k++)
942 KIND_OBJECT_IDX k_idx;
944 /* Extract the tval/sval codes */
945 int tv = store_table[j][k][0];
946 int sv = store_table[j][k][1];
949 for (k_idx = 1; k_idx < max_k_idx; k_idx++)
951 object_kind *k_ptr = &k_info[k_idx];
954 if ((k_ptr->tval == tv) && (k_ptr->sval == sv)) break;
958 if (k_idx == max_k_idx) continue;
960 /* Add that item index to the table */
961 st_ptr->table[st_ptr->table_num++] = k_idx;
970 * @brief 店情報初期化のメインルーチン /
971 * Initialize buildings
974 errr init_buildings(void)
978 for (i = 0; i < MAX_BLDG; i++)
980 building[i].name[0] = '\0';
981 building[i].owner_name[0] = '\0';
982 building[i].owner_race[0] = '\0';
984 for (j = 0; j < 8; j++)
986 building[i].act_names[j][0] = '\0';
987 building[i].member_costs[j] = 0;
988 building[i].other_costs[j] = 0;
989 building[i].letters[j] = 0;
990 building[i].actions[j] = 0;
991 building[i].action_restr[j] = 0;
994 for (j = 0; j < MAX_CLASS; j++)
996 building[i].member_class[j] = 0;
999 for (j = 0; j < MAX_RACES; j++)
1001 building[i].member_race[j] = 0;
1004 for (j = 0; j < MAX_MAGIC+1; j++)
1006 building[i].member_realm[j] = 0;
1015 * @brief クエスト情報初期化のメインルーチン /
1016 * Initialize quest array
1019 static errr init_quests(void)
1023 /*** Prepare the quests ***/
1025 /* Allocate the quests */
1026 C_MAKE(quest, max_q_idx, quest_type);
1028 /* Set all quest to "untaken" */
1029 for (i = 0; i < max_q_idx; i++)
1031 quest[i].status = QUEST_STATUS_UNTAKEN;
1037 /*! 地形タグ情報から地形IDを得られなかった場合にTRUEを返すグローバル変数 */
1038 static bool feat_tag_is_not_found = FALSE;
1041 * @brief 地形タグからIDを得る /
1042 * Initialize quest array
1045 s16b f_tag_to_index_in_init(concptr str)
1047 FEAT_IDX feat = f_tag_to_index(str);
1049 if (feat < 0) feat_tag_is_not_found = TRUE;
1056 * @brief 地形の汎用定義をタグを通じて取得する /
1057 * Initialize feature variables
1060 static errr init_feat_variables(void)
1065 feat_none = f_tag_to_index_in_init("NONE");
1068 feat_floor = f_tag_to_index_in_init("FLOOR");
1071 feat_glyph = f_tag_to_index_in_init("GLYPH");
1072 feat_explosive_rune = f_tag_to_index_in_init("EXPLOSIVE_RUNE");
1073 feat_mirror = f_tag_to_index_in_init("MIRROR");
1076 feat_door[DOOR_DOOR].open = f_tag_to_index_in_init("OPEN_DOOR");
1077 feat_door[DOOR_DOOR].broken = f_tag_to_index_in_init("BROKEN_DOOR");
1078 feat_door[DOOR_DOOR].closed = f_tag_to_index_in_init("CLOSED_DOOR");
1081 for (i = 1; i < MAX_LJ_DOORS; i++)
1083 s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
1084 if (door < 0) break;
1085 feat_door[DOOR_DOOR].locked[i - 1] = door;
1087 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1088 feat_door[DOOR_DOOR].num_locked = i - 1;
1091 for (i = 0; i < MAX_LJ_DOORS; i++)
1093 s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
1094 if (door < 0) break;
1095 feat_door[DOOR_DOOR].jammed[i] = door;
1097 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1098 feat_door[DOOR_DOOR].num_jammed = i;
1101 feat_door[DOOR_GLASS_DOOR].open = f_tag_to_index_in_init("OPEN_GLASS_DOOR");
1102 feat_door[DOOR_GLASS_DOOR].broken = f_tag_to_index_in_init("BROKEN_GLASS_DOOR");
1103 feat_door[DOOR_GLASS_DOOR].closed = f_tag_to_index_in_init("CLOSED_GLASS_DOOR");
1105 /* Locked glass doors */
1106 for (i = 1; i < MAX_LJ_DOORS; i++)
1108 s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
1109 if (door < 0) break;
1110 feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door;
1112 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1113 feat_door[DOOR_GLASS_DOOR].num_locked = i - 1;
1115 /* Jammed glass doors */
1116 for (i = 0; i < MAX_LJ_DOORS; i++)
1118 s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
1119 if (door < 0) break;
1120 feat_door[DOOR_GLASS_DOOR].jammed[i] = door;
1122 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1123 feat_door[DOOR_GLASS_DOOR].num_jammed = i;
1126 feat_door[DOOR_CURTAIN].open = f_tag_to_index_in_init("OPEN_CURTAIN");
1127 feat_door[DOOR_CURTAIN].broken = feat_door[DOOR_CURTAIN].open;
1128 feat_door[DOOR_CURTAIN].closed = f_tag_to_index_in_init("CLOSED_CURTAIN");
1129 feat_door[DOOR_CURTAIN].locked[0] = feat_door[DOOR_CURTAIN].closed;
1130 feat_door[DOOR_CURTAIN].num_locked = 1;
1131 feat_door[DOOR_CURTAIN].jammed[0] = feat_door[DOOR_CURTAIN].closed;
1132 feat_door[DOOR_CURTAIN].num_jammed = 1;
1135 feat_up_stair = f_tag_to_index_in_init("UP_STAIR");
1136 feat_down_stair = f_tag_to_index_in_init("DOWN_STAIR");
1137 feat_entrance = f_tag_to_index_in_init("ENTRANCE");
1140 init_normal_traps();
1143 feat_trap_open = f_tag_to_index_in_init("TRAP_OPEN");
1144 feat_trap_armageddon = f_tag_to_index_in_init("TRAP_ARMAGEDDON");
1145 feat_trap_piranha = f_tag_to_index_in_init("TRAP_PIRANHA");
1148 feat_rubble = f_tag_to_index_in_init("RUBBLE");
1151 feat_magma_vein = f_tag_to_index_in_init("MAGMA_VEIN");
1152 feat_quartz_vein = f_tag_to_index_in_init("QUARTZ_VEIN");
1155 feat_granite = f_tag_to_index_in_init("GRANITE");
1156 feat_permanent = f_tag_to_index_in_init("PERMANENT");
1159 feat_glass_floor = f_tag_to_index_in_init("GLASS_FLOOR");
1162 feat_glass_wall = f_tag_to_index_in_init("GLASS_WALL");
1163 feat_permanent_glass_wall = f_tag_to_index_in_init("PERMANENT_GLASS_WALL");
1166 feat_pattern_start = f_tag_to_index_in_init("PATTERN_START");
1167 feat_pattern_1 = f_tag_to_index_in_init("PATTERN_1");
1168 feat_pattern_2 = f_tag_to_index_in_init("PATTERN_2");
1169 feat_pattern_3 = f_tag_to_index_in_init("PATTERN_3");
1170 feat_pattern_4 = f_tag_to_index_in_init("PATTERN_4");
1171 feat_pattern_end = f_tag_to_index_in_init("PATTERN_END");
1172 feat_pattern_old = f_tag_to_index_in_init("PATTERN_OLD");
1173 feat_pattern_exit = f_tag_to_index_in_init("PATTERN_EXIT");
1174 feat_pattern_corrupted = f_tag_to_index_in_init("PATTERN_CORRUPTED");
1177 feat_black_market = f_tag_to_index_in_init("BLACK_MARKET");
1178 feat_town = f_tag_to_index_in_init("TOWN");
1181 feat_deep_water = f_tag_to_index_in_init("DEEP_WATER");
1182 feat_shallow_water = f_tag_to_index_in_init("SHALLOW_WATER");
1183 feat_deep_lava = f_tag_to_index_in_init("DEEP_LAVA");
1184 feat_shallow_lava = f_tag_to_index_in_init("SHALLOW_LAVA");
1185 feat_heavy_cold_zone = f_tag_to_index_in_init("HEAVY_COLD_ZONE");
1186 feat_cold_zone = f_tag_to_index_in_init("COLD_ZONE");
1187 feat_heavy_electrical_zone = f_tag_to_index_in_init("HEAVY_ELECTRICAL_ZONE");
1188 feat_electrical_zone = f_tag_to_index_in_init("ELECTRICAL_ZONE");
1189 feat_deep_acid_puddle = f_tag_to_index_in_init("DEEP_ACID_PUDDLE");
1190 feat_shallow_acid_puddle = f_tag_to_index_in_init("SHALLOW_ACID_PUDDLE");
1191 feat_deep_poisonous_puddle = f_tag_to_index_in_init("DEEP_POISONOUS_PUDDLE");
1192 feat_shallow_poisonous_puddle = f_tag_to_index_in_init("SHALLOW_POISONOUS_PUDDLE");
1193 feat_dirt = f_tag_to_index_in_init("DIRT");
1194 feat_grass = f_tag_to_index_in_init("GRASS");
1195 feat_flower = f_tag_to_index_in_init("FLOWER");
1196 feat_brake = f_tag_to_index_in_init("BRAKE");
1197 feat_tree = f_tag_to_index_in_init("TREE");
1198 feat_mountain = f_tag_to_index_in_init("MOUNTAIN");
1199 feat_swamp = f_tag_to_index_in_init("SWAMP");
1201 /* Unknown grid (not detected) */
1202 feat_undetected = f_tag_to_index_in_init("UNDETECTED");
1204 /* Wilderness terrains */
1205 init_wilderness_terrains();
1207 return feat_tag_is_not_found ? PARSE_ERROR_UNDEFINED_TERRAIN_TAG : 0;
1212 * @brief その他の初期情報更新 /
1213 * Initialize some other arrays
1216 static errr init_other(void)
1221 /*** Prepare the "dungeon" information ***/
1223 /* Allocate and Wipe the object list */
1224 C_MAKE(current_floor_ptr->o_list, current_floor_ptr->max_o_idx, object_type);
1226 /* Allocate and Wipe the monster list */
1227 C_MAKE(current_floor_ptr->m_list, current_floor_ptr->max_m_idx, monster_type);
1229 /* Allocate and Wipe the monster process list */
1230 for (i = 0; i < MAX_MTIMED; i++)
1232 C_MAKE(current_floor_ptr->mproc_list[i], current_floor_ptr->max_m_idx, s16b);
1235 /* Allocate and Wipe the max dungeon level */
1236 C_MAKE(max_dlv, max_d_idx, DEPTH);
1238 /* Allocate and wipe each line of the current_floor_ptr->grid_array */
1239 for (i = 0; i < MAX_HGT; i++)
1241 /* Allocate one row of the current_floor_ptr->grid_array */
1242 C_MAKE(current_floor_ptr->grid_array[i], MAX_WID, grid_type);
1246 /*** Prepare the various "bizarre" arrays ***/
1248 /* Macro variables */
1249 C_MAKE(macro__pat, MACRO_MAX, concptr);
1250 C_MAKE(macro__act, MACRO_MAX, concptr);
1251 C_MAKE(macro__cmd, MACRO_MAX, bool);
1253 /* Macro action buffer */
1254 C_MAKE(macro__buf, 1024, char);
1256 /* Quark variables */
1259 /* Message variables */
1260 C_MAKE(message__ptr, MESSAGE_MAX, u32b);
1261 C_MAKE(message__buf, MESSAGE_BUF, char);
1263 /* Hack -- No messages yet */
1264 message__tail = MESSAGE_BUF;
1267 /*** Prepare the Player inventory ***/
1270 C_MAKE(inventory, INVEN_TOTAL, object_type);
1273 /*** Prepare the options ***/
1275 /* Scan the options */
1276 for (i = 0; option_info[i].o_desc; i++)
1278 int os = option_info[i].o_set;
1279 int ob = option_info[i].o_bit;
1281 /* Set the "default" options */
1282 if (option_info[i].o_var)
1285 option_mask[os] |= (1L << ob);
1288 if (option_info[i].o_norm)
1291 option_flag[os] |= (1L << ob);
1298 option_flag[os] &= ~(1L << ob);
1303 /* Analyze the windows */
1304 for (n = 0; n < 8; n++)
1306 /* Analyze the options */
1307 for (i = 0; i < 32; i++)
1310 if (window_flag_desc[i])
1313 window_mask[n] |= (1L << i);
1319 * Set the "default" window flags
1320 * Window 1 : Display messages
1321 * Window 2 : Display inven/equip
1323 window_flag[1] = 1L << A_MAX;
1324 window_flag[2] = 1L << 0;
1327 /*** Pre-allocate space for the "format()" buffer ***/
1329 /* Hack -- Just call the "format()" function */
1330 (void)format("%s (%s).", "Mr.Hoge", MAINTAINER);
1339 * @brief オブジェクト配列を初期化する /
1340 * Initialize some other arrays
1343 static errr init_object_alloc(void)
1348 s16b num[MAX_DEPTH];
1349 s16b aux[MAX_DEPTH];
1352 /*** Analyze object allocation info ***/
1354 /* Clear the "aux" array */
1355 (void)C_WIPE(&aux, MAX_DEPTH, s16b);
1357 /* Clear the "num" array */
1358 (void)C_WIPE(&num, MAX_DEPTH, s16b);
1360 /* Free the old "alloc_kind_table" (if it exists) */
1361 if (alloc_kind_table)
1363 C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
1366 /* Size of "alloc_kind_table" */
1367 alloc_kind_size = 0;
1369 /* Scan the objects */
1370 for (i = 1; i < max_k_idx; i++)
1374 /* Scan allocation pairs */
1375 for (j = 0; j < 4; j++)
1377 /* Count the "legal" entries */
1378 if (k_ptr->chance[j])
1380 /* Count the entries */
1383 /* Group by level */
1384 num[k_ptr->locale[j]]++;
1389 /* Collect the level indexes */
1390 for (i = 1; i < MAX_DEPTH; i++)
1392 /* Group by level */
1395 if (!num[0]) quit(_("町のアイテムがない!", "No town objects!"));
1397 /*** Initialize object allocation info ***/
1399 /* Allocate the alloc_kind_table */
1400 C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
1402 /* Access the table entry */
1403 table = alloc_kind_table;
1405 /* Scan the objects */
1406 for (i = 1; i < max_k_idx; i++)
1410 /* Scan allocation pairs */
1411 for (j = 0; j < 4; j++)
1413 /* Count the "legal" entries */
1414 if (k_ptr->chance[j])
1418 /* Extract the base level */
1419 x = k_ptr->locale[j];
1421 /* Extract the base probability */
1422 p = (100 / k_ptr->chance[j]);
1424 /* Skip entries preceding our locale */
1425 y = (x > 0) ? num[x-1] : 0;
1427 /* Skip previous entries at this locale */
1430 /* Load the entry */
1431 table[z].index = (KIND_OBJECT_IDX)i;
1432 table[z].level = (DEPTH)x;
1433 table[z].prob1 = (PROB)p;
1434 table[z].prob2 = (PROB)p;
1435 table[z].prob3 = (PROB)p;
1437 /* Another entry complete for this locale */
1449 * @brief モンスター配列と生成テーブルを初期化する /
1450 * Initialize some other arrays
1453 static errr init_alloc(void)
1456 monster_race *r_ptr;
1462 /* Allocate the "r_info" array */
1463 C_MAKE(elements, max_r_idx, tag_type);
1465 /* Scan the monsters */
1466 for (i = 1; i < max_r_idx; i++)
1468 elements[i].tag = r_info[i].level;
1469 elements[i].index = i;
1472 tag_sort(elements, max_r_idx);
1474 /*** Initialize monster allocation info ***/
1476 /* Size of "alloc_race_table" */
1477 alloc_race_size = max_r_idx;
1479 /* Allocate the alloc_race_table */
1480 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1482 /* Scan the monsters */
1483 for (i = 1; i < max_r_idx; i++)
1485 /* Get the i'th race */
1486 r_ptr = &r_info[elements[i].index];
1488 /* Count valid pairs */
1493 /* Extract the base level */
1496 /* Extract the base probability */
1497 p = (100 / r_ptr->rarity);
1499 /* Load the entry */
1500 alloc_race_table[i].index = (KIND_OBJECT_IDX)elements[i].index;
1501 alloc_race_table[i].level = (DEPTH)x;
1502 alloc_race_table[i].prob1 = (PROB)p;
1503 alloc_race_table[i].prob2 = (PROB)p;
1504 alloc_race_table[i].prob3 = (PROB)p;
1508 /* Free the "r_info" array */
1509 C_KILL(elements, max_r_idx, tag_type);
1511 #else /* SORT_R_INFO */
1515 s16b num[MAX_DEPTH];
1516 s16b aux[MAX_DEPTH];
1518 /*** Analyze monster allocation info ***/
1520 /* Clear the "aux" array */
1521 C_WIPE(&aux, MAX_DEPTH, s16b);
1523 /* Clear the "num" array */
1524 C_WIPE(&num, MAX_DEPTH, s16b);
1526 /* Size of "alloc_race_table" */
1527 alloc_race_size = 0;
1529 /* Scan the monsters */
1530 for (i = 1; i < max_r_idx; i++)
1532 /* Get the i'th race */
1535 /* Legal monsters */
1538 /* Count the entries */
1541 /* Group by level */
1542 num[r_ptr->level]++;
1546 /* Collect the level indexes */
1547 for (i = 1; i < MAX_DEPTH; i++)
1549 /* Group by level */
1552 if (!num[0]) quit(_("町のモンスターがない!", "No town monsters!"));
1554 /*** Initialize monster allocation info ***/
1556 /* Allocate the alloc_race_table */
1557 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1559 /* Access the table entry */
1560 table = alloc_race_table;
1562 /* Scan the monsters */
1563 for (i = 1; i < max_r_idx; i++)
1565 /* Get the i'th race */
1568 /* Count valid pairs */
1573 /* Extract the base level */
1576 /* Extract the base probability */
1577 p = (100 / r_ptr->rarity);
1579 /* Skip entries preceding our locale */
1580 y = (x > 0) ? num[x-1] : 0;
1582 /* Skip previous entries at this locale */
1585 /* Load the entry */
1592 /* Another entry complete for this locale */
1597 #endif /* SORT_R_INFO */
1599 /* Init the "alloc_kind_table" */
1600 (void)init_object_alloc();
1609 * @brief 画面左下にシステムメッセージを表示する /
1610 * Hack -- take notes on line 23
1613 static void note(concptr str)
1615 Term_erase(0, 23, 255);
1616 Term_putstr(20, 23, -1, TERM_WHITE, str);
1623 * @brief 全ゲームデータ読み込みのサブルーチン /
1624 * Hack -- Explain a broken "lib" folder and quit (see below).
1628 * This function is "messy" because various things
1629 * may or may not be initialized, but the "plog()" and "quit()"
1630 * functions are "supposed" to work under any conditions.
1633 static void init_angband_aux(concptr why)
1640 plog("'lib'ディレクトリが存在しないか壊れているようです。");
1643 plog("ひょっとするとアーカイブが正しく解凍されていないのかもしれません。");
1646 plog("該当する'README'ファイルを読んで確認してみて下さい。");
1648 /* Quit with error */
1652 plog("The 'lib' directory is probably missing or broken.");
1655 plog("Perhaps the archive was not extracted correctly.");
1658 plog("See the 'README' file for more information.");
1660 /* Quit with error */
1661 quit("Fatal Error.");
1668 * @brief 全ゲームデータ読み込みのメインルーチン /
1669 * Hack -- main Angband initialization entry point
1673 * This function is "messy" because various things
1674 * may or may not be initialized, but the "plog()" and "quit()"
1675 * functions are "supposed" to work under any conditions.
1676 * Verify some files, display the "news.txt" file, create
1677 * the high score file, initialize all internal arrays, and
1678 * load the basic "user pref files".
1679 * Be very careful to keep track of the order in which things
1680 * are initialized, in particular, the only thing *known* to
1681 * be available when this function is called is the "z-term.c"
1682 * package, and that may not be fully initialized until the
1683 * end of this function, when the default "user pref files"
1684 * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
1685 * Note that this function attempts to verify the "news" file,
1686 * and the game aborts (cleanly) on failure, since without the
1687 * "news" file, it is likely that the "lib" folder has not been
1688 * correctly located. Otherwise, the news file is displayed for
1690 * Note that this function attempts to verify (or create) the
1691 * "high score" file, and the game aborts (cleanly) on failure,
1692 * since one of the most common "extraction" failures involves
1693 * failing to extract all sub-directories (even empty ones), such
1694 * as by failing to use the "-d" option of "pkunzip", or failing
1695 * to use the "save empty directories" option with "Compact Pro".
1696 * This error will often be caught by the "high score" creation
1697 * code below, since the "lib/apex" directory, being empty in the
1698 * standard distributions, is most likely to be "lost", making it
1699 * impossible to create the high score file.
1700 * Note that various things are initialized by this function,
1701 * including everything that was once done by "init_some_arrays".
1702 * This initialization involves the parsing of special files
1703 * in the "lib/data" and sometimes the "lib/edit" directories.
1704 * Note that the "template" files are initialized first, since they
1705 * often contain errors. This means that macros and message recall
1706 * and things like that are not available until after they are done.
1707 * We load the default "user pref files" here in case any "color"
1708 * changes are needed before character creation.
1709 * Note that the "graf-xxx.prf" file must be loaded separately,
1710 * if needed, in the first (?) pass through "TERM_XTRA_REACT".
1713 void init_angband(void)
1717 BIT_FLAGS mode = 0664;
1724 /*** Verify the "news" file ***/
1726 /* Build the filename */
1727 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1729 /* Attempt to open the file */
1730 fd = fd_open(buf, O_RDONLY);
1737 sprintf(why, _("'%s'ファイルにアクセスできません!", "Cannot access the '%s' file!"), buf);
1739 /* Crash and burn */
1740 init_angband_aux(why);
1745 /*** Display the "news" file ***/
1748 /* Build the filename */
1749 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1751 /* Open the News file */
1752 fp = my_fopen(buf, "r");
1759 /* Dump the file to the screen */
1760 while (0 == my_fgets(fp, buf, sizeof(buf)))
1762 /* Display and advance */
1763 Term_putstr(0, i++, -1, TERM_WHITE, buf);
1774 /*** Verify (or create) the "high score" file ***/
1776 /* Build the filename */
1777 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
1779 /* Attempt to open the high score file */
1780 fd = fd_open(buf, O_RDONLY);
1785 /* File type is "DATA" */
1786 FILE_TYPE(FILE_TYPE_DATA);
1788 /* Grab permissions */
1791 /* Create a new high score file */
1792 fd = fd_make(buf, mode);
1794 /* Drop permissions */
1802 sprintf(why, _("'%s'ファイルを作成できません!", "Cannot create the '%s' file!"), buf);
1804 /* Crash and burn */
1805 init_angband_aux(why);
1812 /*** Initialize some arrays ***/
1814 /* Initialize misc. values */
1815 note(_("[変数を初期化しています...(その他)", "[Initializing values... (misc)]"));
1816 if (init_misc()) quit(_("その他の変数を初期化できません", "Cannot initialize misc. values"));
1818 /* Initialize feature info */
1820 note("[データの初期化中... (地形)]");
1821 if (init_f_info()) quit("地形初期化不能");
1822 if (init_feat_variables()) quit("地形初期化不能");
1824 note("[Initializing arrays... (features)]");
1825 if (init_f_info()) quit("Cannot initialize features");
1826 if (init_feat_variables()) quit("Cannot initialize features");
1830 /* Initialize object info */
1831 note(_("[データの初期化中... (アイテム)]", "[Initializing arrays... (objects)]"));
1832 if (init_k_info()) quit(_("アイテム初期化不能", "Cannot initialize objects"));
1835 /* Initialize artifact info */
1836 note(_("[データの初期化中... (伝説のアイテム)]", "[Initializing arrays... (artifacts)]"));
1837 if (init_a_info()) quit(_("伝説のアイテム初期化不能", "Cannot initialize artifacts"));
1840 /* Initialize ego-item info */
1841 note(_("[データの初期化中... (名のあるアイテム)]", "[Initializing arrays... (ego-items)]"));
1842 if (init_e_info()) quit(_("名のあるアイテム初期化不能", "Cannot initialize ego-items"));
1845 /* Initialize monster info */
1846 note(_("[データの初期化中... (モンスター)]", "[Initializing arrays... (monsters)]"));
1847 if (init_r_info()) quit(_("モンスター初期化不能", "Cannot initialize monsters"));
1850 /* Initialize dungeon info */
1851 note(_("[データの初期化中... (ダンジョン)]", "[Initializing arrays... (dungeon)]"));
1852 if (init_d_info()) quit(_("ダンジョン初期化不能", "Cannot initialize dungeon"));
1855 for (i = 1; i < max_d_idx; i++)
1856 if (d_info[i].final_guardian)
1857 r_info[d_info[i].final_guardian].flags7 |= RF7_GUARDIAN;
1860 /* Initialize magic info */
1861 note(_("[データの初期化中... (魔法)]", "[Initializing arrays... (magic)]"));
1862 if (init_m_info()) quit(_("魔法初期化不能", "Cannot initialize magic"));
1864 /* Initialize weapon_exp info */
1865 note(_("[データの初期化中... (熟練度)]", "[Initializing arrays... (skill)]"));
1866 if (init_s_info()) quit(_("熟練度初期化不能", "Cannot initialize skill"));
1868 /* Initialize wilderness array */
1869 note(_("[配列を初期化しています... (荒野)]", "[Initializing arrays... (wilderness)]"));
1871 if (init_wilderness()) quit(_("荒野を初期化できません", "Cannot initialize wilderness"));
1874 /* Initialize town array */
1875 note(_("[配列を初期化しています... (街)]", "[Initializing arrays... (towns)]"));
1876 if (init_towns()) quit(_("街を初期化できません", "Cannot initialize towns"));
1879 /* Initialize building array */
1880 note(_("[配列を初期化しています... (建物)]", "[Initializing arrays... (buildings)]"));
1881 if (init_buildings()) quit(_("建物を初期化できません", "Cannot initialize buildings"));
1884 /* Initialize quest array */
1885 note(_("[配列を初期化しています... (クエスト)]", "[Initializing arrays... (quests)]"));
1886 if (init_quests()) quit(_("クエストを初期化できません", "Cannot initialize quests"));
1888 /* Initialize vault info */
1889 if (init_v_info()) quit(_("vault 初期化不能", "Cannot initialize vaults"));
1891 /* Initialize some other arrays */
1892 note(_("[データの初期化中... (その他)]", "[Initializing arrays... (other)]"));
1893 if (init_other()) quit(_("その他のデータ初期化不能", "Cannot initialize other stuff"));
1896 /* Initialize some other arrays */
1897 note(_("[データの初期化中... (アロケーション)]", "[Initializing arrays... (alloc)]"));
1898 if (init_alloc()) quit(_("アロケーション・スタッフ初期化不能", "Cannot initialize alloc stuff"));
1902 /*** Load default user pref files ***/
1904 /* Initialize feature info */
1905 note(_("[ユーザー設定ファイルを初期化しています...]", "[Initializing user pref files...]"));
1907 /* Access the "basic" pref file */
1908 strcpy(buf, "pref.prf");
1910 /* Process that file */
1911 process_pref_file(buf);
1913 /* Access the "basic" system pref file */
1914 sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
1916 /* Process that file */
1917 process_pref_file(buf);
1919 note(_("[初期化終了]", "[Initialization complete]"));
1926 static void put_title(void)
1931 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,
1933 sprintf(title, _("変愚蛮怒 %d.%d.%d(%s)", "Hengband %d.%d.%d(%s)"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH,
1935 IS_STABLE_VERSION ? _("安定版", "Stable") : _("開発版", "Developing"));
1936 col = (80 - strlen(title)) / 2;
1937 col = col < 0 ? 0 : col;
1938 prt(title, VER_INFO_ROW, col);
1942 * @brief サムチェック情報を出力 / Get check sum in string form
1943 * @return サムチェック情報の文字列
1945 concptr get_check_sum(void)
1947 return format("%02x%02x%02x%02x%02x%02x%02x%02x%02x",