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. Note that the binary image files
29 * are extremely system dependant.
47 #include "dungeon-file.h"
51 #include "floor-town.h"
53 #include "rooms-vault.h"
54 #include "player-skill.h"
55 #include "player-class.h"
56 #include "objectkind.h"
57 #include "object-ego.h"
58 #include "rooms-vault.h"
61 #ifdef CHECK_MODIFICATION_TIME
62 #include <sys/types.h>
64 #endif /* CHECK_MODIFICATION_TIME */
66 static void put_title(void);
69 * @brief 各データファイルを読み取るためのパスを取得する
70 * Find the default paths to all of our important sub-directories.
71 * @param path パス保管先の文字列
75 * The purpose of each sub-directory is described in "variable.c".
76 * All of the sub-directories should, by default, be located inside
77 * the main "lib" directory, whose location is very system dependant.
78 * This function takes a writable buffer, initially containing the
79 * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
80 * or a system dependant string, for example, ":lib:". The buffer
81 * must be large enough to contain at least 32 more characters.
82 * Various command line options may allow some of the important
83 * directories to be changed to user-specified directories, most
84 * importantly, the "info" and "user" and "save" directories,
85 * but this is done after this function, see "main.c".
86 * In general, the initial path should end in the appropriate "PATH_SEP"
87 * string. All of the "sub-directory" paths (created below or supplied
88 * by the user) will NOT end in the "PATH_SEP" string, see the special
89 * "path_build()" function in "util.c" for more information.
90 * Mega-Hack -- support fat raw files under NEXTSTEP, using special
91 * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
92 * requiring the directories to be created by hand by the user.
93 * Hack -- first we free all the strings, since this is known
94 * to succeed even if the strings have not been allocated yet,
95 * as long as the variables start out as "NULL". This allows
96 * this function to be called multiple times, for example, to
97 * try several base "path" values until a good one is found.
100 void init_file_paths(char *path)
104 #ifdef PRIVATE_USER_PATH
106 #endif /* PRIVATE_USER_PATH */
108 /*** Free everything ***/
110 /* Free the main path */
111 string_free(ANGBAND_DIR);
113 /* Free the sub-paths */
114 string_free(ANGBAND_DIR_APEX);
115 string_free(ANGBAND_DIR_BONE);
116 string_free(ANGBAND_DIR_DATA);
117 string_free(ANGBAND_DIR_EDIT);
118 string_free(ANGBAND_DIR_SCRIPT);
119 string_free(ANGBAND_DIR_FILE);
120 string_free(ANGBAND_DIR_HELP);
121 string_free(ANGBAND_DIR_INFO);
122 string_free(ANGBAND_DIR_SAVE);
123 string_free(ANGBAND_DIR_USER);
124 string_free(ANGBAND_DIR_XTRA);
126 /*** Prepare the "path" ***/
128 /* Hack -- save the main directory */
129 ANGBAND_DIR = string_make(path);
131 /* Prepare to append to the Base Path */
132 tail = path + strlen(path);
134 /*** Build the sub-directory names ***/
136 /* Build a path name */
137 strcpy(tail, "apex");
138 ANGBAND_DIR_APEX = string_make(path);
140 /* Build a path name */
141 strcpy(tail, "bone");
142 ANGBAND_DIR_BONE = string_make(path);
144 /* Build a path name */
145 strcpy(tail, "data");
146 ANGBAND_DIR_DATA = string_make(path);
148 /* Build a path name */
149 strcpy(tail, "edit");
150 ANGBAND_DIR_EDIT = string_make(path);
152 /* Build a path name */
153 strcpy(tail, "script");
154 ANGBAND_DIR_SCRIPT = string_make(path);
156 /* Build a path name */
157 strcpy(tail, "file");
158 ANGBAND_DIR_FILE = string_make(path);
160 /* Build a path name */
161 strcpy(tail, "help");
162 ANGBAND_DIR_HELP = string_make(path);
164 /* Build a path name */
165 strcpy(tail, "info");
166 ANGBAND_DIR_INFO = string_make(path);
168 /* Build a path name */
169 strcpy(tail, "pref");
170 ANGBAND_DIR_PREF = string_make(path);
172 /* Build a path name */
173 strcpy(tail, "save");
174 ANGBAND_DIR_SAVE = string_make(path);
176 #ifdef PRIVATE_USER_PATH
178 /* Build the path to the user specific directory */
179 path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
181 /* Build a relative path name */
182 ANGBAND_DIR_USER = string_make(buf);
184 #else /* PRIVATE_USER_PATH */
186 /* Build a path name */
187 strcpy(tail, "user");
188 ANGBAND_DIR_USER = string_make(path);
190 #endif /* PRIVATE_USER_PATH */
192 /* Build a path name */
193 strcpy(tail, "xtra");
194 ANGBAND_DIR_XTRA = string_make(path);
199 /* Allow "fat binary" usage with NeXT */
220 /* Use special directory */
223 /* Forget the old path name */
224 string_free(ANGBAND_DIR_DATA);
226 /* Build a new path name */
227 sprintf(tail, "data-%s", next);
228 ANGBAND_DIR_DATA = string_make(path);
238 * Hack -- help give useful error messages
240 int error_idx; /*!< データ読み込み/初期化時に汎用的にエラーコードを保存するグローバル変数 */
241 int error_line; /*!< データ読み込み/初期化時に汎用的にエラー行数を保存するグローバル変数 */
244 * エラーメッセージの名称定義 / Standard error message text
246 concptr err_str[PARSE_ERROR_MAX] =
263 "missing record header",
264 "non-sequential records",
265 "invalid flag specification",
266 "undefined directive",
268 "coordinates out of bounds",
270 "undefined terrain tag",
279 header v_head; /*!< Vault情報のヘッダ構造体 */
280 header f_head; /*!< 地形情報のヘッダ構造体 */
281 header k_head; /*!< ペースアイテム情報のヘッダ構造体 */
282 header a_head; /*!< 固定アーティファクト情報のヘッダ構造体 */
283 header e_head; /*!< アイテムエゴ情報のヘッダ構造体 */
284 header r_head; /*!< モンスター種族情報のヘッダ構造体 */
285 header d_head; /*!< ダンジョン情報のヘッダ構造体 */
286 header s_head; /*!< プレイヤー職業技能情報のヘッダ構造体 */
287 header m_head; /*!< プレイヤー職業魔法情報のヘッダ構造体 */
289 #ifdef CHECK_MODIFICATION_TIME
292 * @brief テキストファイルとrawファイルの更新時刻を比較する
293 * Find the default paths to all of our important sub-directories.
294 * @param fd ファイルディスクリプタ
295 * @param template_file ファイル名
296 * @return テキストの方が新しいか、rawファイルがなく更新の必要がある場合-1、更新の必要がない場合0。
298 static errr check_modification_date(int fd, concptr template_file)
300 struct stat txt_stat, raw_stat;
302 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, template_file);
304 /* Access stats on text file */
305 if (stat(buf, &txt_stat))
310 /* Access stats on raw file */
311 if (fstat(fd, &raw_stat))
316 /* Ensure text file is not newer than raw file */
317 if (txt_stat.st_mtime > raw_stat.st_mtime)
325 #endif /* CHECK_MODIFICATION_TIME */
327 /*** 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))
354 /* Accept the header */
357 /* Allocate the "*_info" array */
358 C_MAKE(head->info_ptr, head->info_size, char);
360 /* Read the "*_info" array */
361 fd_read(fd, head->info_ptr, head->info_size);
365 /* Allocate the "*_name" array */
366 C_MAKE(head->name_ptr, head->name_size, char);
368 /* Read the "*_name" array */
369 fd_read(fd, head->name_ptr, head->name_size);
374 /* Allocate the "*_text" array */
375 C_MAKE(head->text_ptr, head->text_size, char);
377 /* Read the "*_text" array */
378 fd_read(fd, head->text_ptr, head->text_size);
383 /* Allocate the "*_tag" array */
384 C_MAKE(head->tag_ptr, head->tag_size, char);
386 /* Read the "*_tag" array */
387 fd_read(fd, head->tag_ptr, head->tag_size);
397 * Initialize the header of an *_info.raw file.
398 * @param head rawファイルのヘッダ
403 static void init_header(header *head, IDX num, int len)
405 /* Save the "version" */
406 head->v_major = FAKE_VER_MAJOR;
407 head->v_minor = FAKE_VER_MINOR;
408 head->v_patch = FAKE_VER_PATCH;
411 /* Save the "record" information */
412 head->info_num = (IDX)num;
413 head->info_len = len;
415 /* Save the size of "*_head" and "*_info" */
416 head->head_size = sizeof(header);
417 head->info_size = head->info_num * head->info_len;
421 static void update_header(header *head, void **info, char **name, char **text, char **tag)
423 if (info) *info = head->info_ptr;
424 if (name) *name = head->name_ptr;
425 if (text) *text = head->text_ptr;
426 if (tag) *tag = head->tag_ptr;
432 * Initialize the "*_info" array
433 * @param filename ファイル名(拡張子txt/raw)
434 * @param head 処理に用いるヘッダ構造体
435 * @param info データ保管先の構造体ポインタ
436 * @param name 名称用可変文字列の保管先
437 * @param text テキスト用可変文字列の保管先
438 * @param tag タグ用可変文字列の保管先
441 * Note that we let each entry have a unique "name" and "text" string,
442 * even if the string happens to be empty (everyone has a unique '\0').
444 static errr init_info(concptr filename, header *head, void **info, char **name, char **text, char **tag)
449 /*** Load the binary image file ***/
450 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
452 /* Attempt to open the "raw" file */
453 int fd = fd_open(buf, O_RDONLY);
455 /* Process existing "raw" file */
459 #ifdef CHECK_MODIFICATION_TIME
461 err = check_modification_date(fd, format("%s.txt", filename));
463 #endif /* CHECK_MODIFICATION_TIME */
465 /* Attempt to parse the "raw" file */
467 err = init_info_raw(fd, head);
471 /* Do we have to parse the *.txt file? */
472 BIT_FLAGS file_permission = 0644;
475 update_header(head, info, name, text, tag);
479 /*** Make the fake arrays ***/
480 C_MAKE(head->info_ptr, head->info_size, char);
482 /* Hack -- make "fake" arrays */
483 if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
484 if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
485 if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
487 if (info) (*info) = head->info_ptr;
488 if (name) (*name) = head->name_ptr;
489 if (text) (*text) = head->text_ptr;
490 if (tag) (*tag) = head->tag_ptr;
492 /*** Load the ascii template file ***/
493 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
495 fp = my_fopen(buf, "r");
498 if (!fp) quit(format(_("'%s.txt'ファイルをオープンできません。", "Cannot open '%s.txt' file."), filename));
501 err = init_info_txt(fp, buf, head, head->parse_info_txt);
511 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "未知の");
513 msg_format("'%s.txt'ファイルの %d 行目にエラー。", filename, error_line);
514 msg_format("レコード %d は '%s' エラーがあります。", error_idx, oops);
515 msg_format("構文 '%s'。", buf);
519 quit(format("'%s.txt'ファイルにエラー", filename));
522 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
524 msg_format("Error %d at line %d of '%s.txt'.", err, error_line, filename);
525 msg_format("Record %d contains a '%s' error.", error_idx, oops);
526 msg_format("Parsing '%s'.", buf);
530 quit(format("Error in '%s.txt' file.", filename));
534 /*** Make final retouch on fake tags ***/
537 (*head->retouch)(head);
540 /*** Dump the binary image file ***/
541 /* File type is "DATA" */
542 FILE_TYPE(FILE_TYPE_DATA);
543 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
545 /* Grab permissions */
548 /* Kill the old file */
551 /* Attempt to create the raw file */
552 fd = fd_make(buf, file_permission);
554 /* Drop permissions */
557 /* Dump to the file */
561 fd_write(fd, (concptr)(head), head->head_size);
563 /* Dump the "*_info" array */
564 fd_write(fd, head->info_ptr, head->info_size);
566 /* Dump the "*_name" array */
567 fd_write(fd, head->name_ptr, head->name_size);
569 /* Dump the "*_text" array */
570 fd_write(fd, head->text_ptr, head->text_size);
572 /* Dump the "*_tag" array */
573 fd_write(fd, head->tag_ptr, head->tag_size);
579 /*** Kill the fake arrays ***/
581 /* Free the "*_info" array */
582 C_KILL(head->info_ptr, head->info_size, char);
584 /* Hack -- Free the "fake" arrays */
585 if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char);
586 if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char);
587 if (tag) C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char);
589 /*** Load the binary image file ***/
590 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
592 /* Attempt to open the "raw" file */
593 fd = fd_open(buf, O_RDONLY);
595 /* Process existing "raw" file */
596 if (fd < 0) quit(format(_("'%s_j.raw'ファイルをロードできません。", "Cannot load '%s.raw' file."), filename));
598 /* Attempt to parse the "raw" file */
599 err = init_info_raw(fd, head);
603 if (err) quit(format(_("'%s_j.raw'ファイルを解析できません。", "Cannot parse '%s.raw' file."), filename));
605 update_header(head, info, name, text, tag);
611 * @brief 地形情報読み込みのメインルーチン /
612 * Initialize the "f_info" array
615 static errr init_f_info(void)
617 /* Init the header */
618 init_header(&f_head, max_f_idx, sizeof(feature_type));
620 /* Save a pointer to the parsing function */
621 f_head.parse_info_txt = parse_f_info;
623 /* Save a pointer to the retouch fake tags */
624 f_head.retouch = retouch_f_info;
626 return init_info("f_info", &f_head,
627 (void*)&f_info, &f_name, NULL, &f_tag);
632 * @brief ベースアイテム情報読み込みのメインルーチン /
633 * Initialize the "k_info" array
636 static errr init_k_info(void)
638 /* Init the header */
639 init_header(&k_head, max_k_idx, sizeof(object_kind));
641 /* Save a pointer to the parsing function */
642 k_head.parse_info_txt = parse_k_info;
644 return init_info("k_info", &k_head,
645 (void*)&k_info, &k_name, &k_text, NULL);
650 * @brief 固定アーティファクト情報読み込みのメインルーチン /
651 * Initialize the "a_info" array
654 static errr init_a_info(void)
656 /* Init the header */
657 init_header(&a_head, max_a_idx, sizeof(artifact_type));
659 /* Save a pointer to the parsing function */
660 a_head.parse_info_txt = parse_a_info;
662 return init_info("a_info", &a_head,
663 (void*)&a_info, &a_name, &a_text, NULL);
668 * @brief 固定アーティファクト情報読み込みのメインルーチン /
669 * Initialize the "e_info" array
672 static errr init_e_info(void)
674 /* Init the header */
675 init_header(&e_head, max_e_idx, sizeof(ego_item_type));
677 /* Save a pointer to the parsing function */
678 e_head.parse_info_txt = parse_e_info;
680 return init_info("e_info", &e_head,
681 (void*)&e_info, &e_name, &e_text, NULL);
686 * @brief モンスター種族情報読み込みのメインルーチン /
687 * Initialize the "r_info" array
690 static errr init_r_info(void)
692 /* Init the header */
693 init_header(&r_head, max_r_idx, sizeof(monster_race));
695 /* Save a pointer to the parsing function */
696 r_head.parse_info_txt = parse_r_info;
698 return init_info("r_info", &r_head,
699 (void*)&r_info, &r_name, &r_text, NULL);
704 * @brief ダンジョン情報読み込みのメインルーチン /
705 * Initialize the "d_info" array
708 static errr init_d_info(void)
710 /* Init the header */
711 init_header(&d_head, current_world_ptr->max_d_idx, sizeof(dungeon_type));
713 /* Save a pointer to the parsing function */
714 d_head.parse_info_txt = parse_d_info;
716 return init_info("d_info", &d_head,
717 (void*)&d_info, &d_name, &d_text, NULL);
722 * @brief Vault情報読み込みのメインルーチン /
723 * Initialize the "v_info" array
726 * Note that we let each entry have a unique "name" and "text" string,
727 * even if the string happens to be empty (everyone has a unique '\0').
729 errr init_v_info(void)
731 /* Init the header */
732 init_header(&v_head, max_v_idx, sizeof(vault_type));
734 /* Save a pointer to the parsing function */
735 v_head.parse_info_txt = parse_v_info;
737 return init_info("v_info", &v_head,
738 (void*)&v_info, &v_name, &v_text, NULL);
743 * @brief 職業技能情報読み込みのメインルーチン /
744 * Initialize the "s_info" array
747 static errr init_s_info(void)
749 /* Init the header */
750 init_header(&s_head, MAX_CLASS, sizeof(skill_table));
752 /* Save a pointer to the parsing function */
753 s_head.parse_info_txt = parse_s_info;
755 return init_info("s_info", &s_head,
756 (void*)&s_info, NULL, NULL, NULL);
761 * @brief 職業魔法情報読み込みのメインルーチン /
762 * Initialize the "m_info" array
765 static errr init_m_info(void)
767 /* Init the header */
768 init_header(&m_head, MAX_CLASS, sizeof(player_magic));
770 /* Save a pointer to the parsing function */
771 m_head.parse_info_txt = parse_m_info;
773 return init_info("m_info", &m_head,
774 (void*)&m_info, NULL, NULL, NULL);
779 * @brief 基本情報読み込みのメインルーチン /
780 * Initialize misc. values
781 * @param player_ptr プレーヤーへの参照ポインタ
784 static errr init_misc(player_type *player_ptr)
786 return process_dungeon_file(player_ptr, "misc.txt", 0, 0, 0, 0);
791 * @brief 町情報読み込みのメインルーチン /
792 * Initialize town array
795 static errr init_towns(void)
797 /* Allocate the towns */
798 C_MAKE(town_info, max_towns, town_type);
800 for (int i = 1; i < max_towns; i++)
802 /*** Prepare the Stores ***/
804 /* Allocate the stores */
805 C_MAKE(town_info[i].store, MAX_STORES, store_type);
807 /* Fill in each store */
808 for (int j = 0; j < MAX_STORES; j++)
810 /* Access the store */
811 store_type *st_ptr = &town_info[i].store[j];
813 if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME)) continue;
815 /* Assume full stock */
818 * 我が家が 20 ページまで使える隠し機能のための準備。
819 * オプションが有効でもそうでなくても一応スペースを作っておく。
823 st_ptr->stock_size = (STORE_INVEN_MAX * 10);
825 else if (j == STORE_MUSEUM)
827 st_ptr->stock_size = (STORE_INVEN_MAX * 50);
831 st_ptr->stock_size = STORE_INVEN_MAX;
834 /* Allocate the stock */
835 C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type);
837 /* No table for the black market or home */
838 if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM)) continue;
840 /* Assume full table */
841 st_ptr->table_size = STORE_CHOICES;
843 /* Allocate the stock */
844 C_MAKE(st_ptr->table, st_ptr->table_size, s16b);
846 /* Scan the choices */
847 for (int k = 0; k < STORE_CHOICES; k++)
849 KIND_OBJECT_IDX k_idx;
851 /* Extract the tval/sval codes */
852 int tv = store_table[j][k][0];
853 int sv = store_table[j][k][1];
856 for (k_idx = 1; k_idx < max_k_idx; k_idx++)
858 object_kind *k_ptr = &k_info[k_idx];
861 if ((k_ptr->tval == tv) && (k_ptr->sval == sv)) break;
865 if (k_idx == max_k_idx) continue;
867 /* Add that item index to the table */
868 st_ptr->table[st_ptr->table_num++] = k_idx;
877 * @brief 店情報初期化のメインルーチン /
878 * Initialize buildings
881 errr init_buildings(void)
883 for (int i = 0; i < MAX_BLDG; i++)
885 building[i].name[0] = '\0';
886 building[i].owner_name[0] = '\0';
887 building[i].owner_race[0] = '\0';
889 for (int j = 0; j < 8; j++)
891 building[i].act_names[j][0] = '\0';
892 building[i].member_costs[j] = 0;
893 building[i].other_costs[j] = 0;
894 building[i].letters[j] = 0;
895 building[i].actions[j] = 0;
896 building[i].action_restr[j] = 0;
899 for (int j = 0; j < MAX_CLASS; j++)
901 building[i].member_class[j] = 0;
904 for (int j = 0; j < MAX_RACES; j++)
906 building[i].member_race[j] = 0;
909 for (int j = 0; j < MAX_MAGIC + 1; j++)
911 building[i].member_realm[j] = 0;
920 * @brief クエスト情報初期化のメインルーチン /
921 * Initialize quest array
924 static errr init_quests(void)
926 /* Allocate the quests */
927 C_MAKE(quest, max_q_idx, quest_type);
929 /* Set all quest to "untaken" */
930 for (int i = 0; i < max_q_idx; i++)
932 quest[i].status = QUEST_STATUS_UNTAKEN;
938 /*! 地形タグ情報から地形IDを得られなかった場合にTRUEを返すグローバル変数 */
939 static bool feat_tag_is_not_found = FALSE;
942 * @brief 地形タグからIDを得る /
943 * Initialize quest array
946 s16b f_tag_to_index_in_init(concptr str)
948 FEAT_IDX feat = f_tag_to_index(str);
950 if (feat < 0) feat_tag_is_not_found = TRUE;
957 * @brief 地形の汎用定義をタグを通じて取得する /
958 * Initialize feature variables
961 static errr init_feat_variables(void)
963 feat_none = f_tag_to_index_in_init("NONE");
965 feat_floor = f_tag_to_index_in_init("FLOOR");
966 feat_glyph = f_tag_to_index_in_init("GLYPH");
967 feat_explosive_rune = f_tag_to_index_in_init("EXPLOSIVE_RUNE");
968 feat_mirror = f_tag_to_index_in_init("MIRROR");
970 feat_door[DOOR_DOOR].open = f_tag_to_index_in_init("OPEN_DOOR");
971 feat_door[DOOR_DOOR].broken = f_tag_to_index_in_init("BROKEN_DOOR");
972 feat_door[DOOR_DOOR].closed = f_tag_to_index_in_init("CLOSED_DOOR");
976 for (i = 1; i < MAX_LJ_DOORS; i++)
978 s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
980 feat_door[DOOR_DOOR].locked[i - 1] = door;
983 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
984 feat_door[DOOR_DOOR].num_locked = i - 1;
987 for (i = 0; i < MAX_LJ_DOORS; i++)
989 s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
991 feat_door[DOOR_DOOR].jammed[i] = door;
994 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
995 feat_door[DOOR_DOOR].num_jammed = i;
998 feat_door[DOOR_GLASS_DOOR].open = f_tag_to_index_in_init("OPEN_GLASS_DOOR");
999 feat_door[DOOR_GLASS_DOOR].broken = f_tag_to_index_in_init("BROKEN_GLASS_DOOR");
1000 feat_door[DOOR_GLASS_DOOR].closed = f_tag_to_index_in_init("CLOSED_GLASS_DOOR");
1002 /* Locked glass doors */
1003 for (i = 1; i < MAX_LJ_DOORS; i++)
1005 s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
1006 if (door < 0) break;
1007 feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door;
1010 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1011 feat_door[DOOR_GLASS_DOOR].num_locked = i - 1;
1013 /* Jammed glass doors */
1014 for (i = 0; i < MAX_LJ_DOORS; i++)
1016 s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
1017 if (door < 0) break;
1018 feat_door[DOOR_GLASS_DOOR].jammed[i] = door;
1021 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1022 feat_door[DOOR_GLASS_DOOR].num_jammed = i;
1025 feat_door[DOOR_CURTAIN].open = f_tag_to_index_in_init("OPEN_CURTAIN");
1026 feat_door[DOOR_CURTAIN].broken = feat_door[DOOR_CURTAIN].open;
1027 feat_door[DOOR_CURTAIN].closed = f_tag_to_index_in_init("CLOSED_CURTAIN");
1028 feat_door[DOOR_CURTAIN].locked[0] = feat_door[DOOR_CURTAIN].closed;
1029 feat_door[DOOR_CURTAIN].num_locked = 1;
1030 feat_door[DOOR_CURTAIN].jammed[0] = feat_door[DOOR_CURTAIN].closed;
1031 feat_door[DOOR_CURTAIN].num_jammed = 1;
1034 feat_up_stair = f_tag_to_index_in_init("UP_STAIR");
1035 feat_down_stair = f_tag_to_index_in_init("DOWN_STAIR");
1036 feat_entrance = f_tag_to_index_in_init("ENTRANCE");
1039 init_normal_traps();
1042 feat_trap_open = f_tag_to_index_in_init("TRAP_OPEN");
1043 feat_trap_armageddon = f_tag_to_index_in_init("TRAP_ARMAGEDDON");
1044 feat_trap_piranha = f_tag_to_index_in_init("TRAP_PIRANHA");
1047 feat_rubble = f_tag_to_index_in_init("RUBBLE");
1050 feat_magma_vein = f_tag_to_index_in_init("MAGMA_VEIN");
1051 feat_quartz_vein = f_tag_to_index_in_init("QUARTZ_VEIN");
1054 feat_granite = f_tag_to_index_in_init("GRANITE");
1055 feat_permanent = f_tag_to_index_in_init("PERMANENT");
1058 feat_glass_floor = f_tag_to_index_in_init("GLASS_FLOOR");
1061 feat_glass_wall = f_tag_to_index_in_init("GLASS_WALL");
1062 feat_permanent_glass_wall = f_tag_to_index_in_init("PERMANENT_GLASS_WALL");
1065 feat_pattern_start = f_tag_to_index_in_init("PATTERN_START");
1066 feat_pattern_1 = f_tag_to_index_in_init("PATTERN_1");
1067 feat_pattern_2 = f_tag_to_index_in_init("PATTERN_2");
1068 feat_pattern_3 = f_tag_to_index_in_init("PATTERN_3");
1069 feat_pattern_4 = f_tag_to_index_in_init("PATTERN_4");
1070 feat_pattern_end = f_tag_to_index_in_init("PATTERN_END");
1071 feat_pattern_old = f_tag_to_index_in_init("PATTERN_OLD");
1072 feat_pattern_exit = f_tag_to_index_in_init("PATTERN_EXIT");
1073 feat_pattern_corrupted = f_tag_to_index_in_init("PATTERN_CORRUPTED");
1076 feat_black_market = f_tag_to_index_in_init("BLACK_MARKET");
1077 feat_town = f_tag_to_index_in_init("TOWN");
1080 feat_deep_water = f_tag_to_index_in_init("DEEP_WATER");
1081 feat_shallow_water = f_tag_to_index_in_init("SHALLOW_WATER");
1082 feat_deep_lava = f_tag_to_index_in_init("DEEP_LAVA");
1083 feat_shallow_lava = f_tag_to_index_in_init("SHALLOW_LAVA");
1084 feat_heavy_cold_zone = f_tag_to_index_in_init("HEAVY_COLD_ZONE");
1085 feat_cold_zone = f_tag_to_index_in_init("COLD_ZONE");
1086 feat_heavy_electrical_zone = f_tag_to_index_in_init("HEAVY_ELECTRICAL_ZONE");
1087 feat_electrical_zone = f_tag_to_index_in_init("ELECTRICAL_ZONE");
1088 feat_deep_acid_puddle = f_tag_to_index_in_init("DEEP_ACID_PUDDLE");
1089 feat_shallow_acid_puddle = f_tag_to_index_in_init("SHALLOW_ACID_PUDDLE");
1090 feat_deep_poisonous_puddle = f_tag_to_index_in_init("DEEP_POISONOUS_PUDDLE");
1091 feat_shallow_poisonous_puddle = f_tag_to_index_in_init("SHALLOW_POISONOUS_PUDDLE");
1092 feat_dirt = f_tag_to_index_in_init("DIRT");
1093 feat_grass = f_tag_to_index_in_init("GRASS");
1094 feat_flower = f_tag_to_index_in_init("FLOWER");
1095 feat_brake = f_tag_to_index_in_init("BRAKE");
1096 feat_tree = f_tag_to_index_in_init("TREE");
1097 feat_mountain = f_tag_to_index_in_init("MOUNTAIN");
1098 feat_swamp = f_tag_to_index_in_init("SWAMP");
1100 feat_undetected = f_tag_to_index_in_init("UNDETECTED");
1102 init_wilderness_terrains();
1103 return feat_tag_is_not_found ? PARSE_ERROR_UNDEFINED_TERRAIN_TAG : 0;
1108 * @brief その他の初期情報更新 /
1109 * Initialize some other arrays
1112 static errr init_other(player_type *player_ptr)
1114 player_ptr->current_floor_ptr = &floor_info; // TODO:本当はこんなところで初期化したくない
1115 floor_type *floor_ptr = player_ptr->current_floor_ptr;
1117 /*** Prepare the "dungeon" information ***/
1119 /* Allocate and Wipe the object list */
1120 C_MAKE(floor_ptr->o_list, current_world_ptr->max_o_idx, object_type);
1122 /* Allocate and Wipe the monster list */
1123 C_MAKE(floor_ptr->m_list, current_world_ptr->max_m_idx, monster_type);
1125 /* Allocate and Wipe the monster process list */
1126 for (int i = 0; i < MAX_MTIMED; i++)
1128 C_MAKE(floor_ptr->mproc_list[i], current_world_ptr->max_m_idx, s16b);
1131 /* Allocate and Wipe the max dungeon level */
1132 C_MAKE(max_dlv, current_world_ptr->max_d_idx, DEPTH);
1134 for (int i = 0; i < MAX_HGT; i++)
1136 C_MAKE(floor_ptr->grid_array[i], MAX_WID, grid_type);
1139 /*** Prepare the various "bizarre" arrays ***/
1141 /* Macro variables */
1142 C_MAKE(macro__pat, MACRO_MAX, concptr);
1143 C_MAKE(macro__act, MACRO_MAX, concptr);
1144 C_MAKE(macro__cmd, MACRO_MAX, bool);
1146 /* Macro action buffer */
1147 C_MAKE(macro__buf, 1024, char);
1149 /* Quark variables */
1152 /* Message variables */
1153 C_MAKE(message__ptr, MESSAGE_MAX, u32b);
1154 C_MAKE(message__buf, MESSAGE_BUF, char);
1156 /* Hack -- No messages yet */
1157 message__tail = MESSAGE_BUF;
1159 /*** Prepare the options ***/
1161 /* Scan the options */
1162 for (int i = 0; option_info[i].o_desc; i++)
1164 int os = option_info[i].o_set;
1165 int ob = option_info[i].o_bit;
1167 /* Set the "default" options */
1168 if (!option_info[i].o_var) continue;
1171 option_mask[os] |= (1L << ob);
1174 if (option_info[i].o_norm)
1177 option_flag[os] |= (1L << ob);
1181 option_flag[os] &= ~(1L << ob);
1185 /* Analyze the windows */
1186 for (int n = 0; n < 8; n++)
1188 /* Analyze the options */
1189 for (int i = 0; i < 32; i++)
1192 if (window_flag_desc[i])
1195 window_mask[n] |= (1L << i);
1201 * Set the "default" window flags
1202 * Window 1 : Display messages
1203 * Window 2 : Display inven/equip
1205 window_flag[1] = 1L << A_MAX;
1206 window_flag[2] = 1L << 0;
1208 /*** Pre-allocate space for the "format()" buffer ***/
1210 /* Hack -- Just call the "format()" function */
1211 (void)format("%s (%s).", "Mr.Hoge", MAINTAINER);
1217 * @brief オブジェクト配列を初期化する /
1218 * Initialize some other arrays
1221 static errr init_object_alloc(void)
1223 s16b aux[MAX_DEPTH];
1224 (void)C_WIPE(&aux, MAX_DEPTH, s16b);
1226 s16b num[MAX_DEPTH];
1227 (void)C_WIPE(&num, MAX_DEPTH, s16b);
1229 /* Free the old "alloc_kind_table" (if it exists) */
1230 if (alloc_kind_table)
1232 C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
1235 /* Size of "alloc_kind_table" */
1236 alloc_kind_size = 0;
1238 /* Scan the objects */
1239 for (int i = 1; i < max_k_idx; i++)
1244 /* Scan allocation pairs */
1245 for (int j = 0; j < 4; j++)
1247 /* Count the "legal" entries */
1248 if (k_ptr->chance[j])
1250 /* Count the entries */
1253 /* Group by level */
1254 num[k_ptr->locale[j]]++;
1259 /* Collect the level indexes */
1260 for (int i = 1; i < MAX_DEPTH; i++)
1262 /* Group by level */
1263 num[i] += num[i - 1];
1266 if (!num[0]) quit(_("町のアイテムがない!", "No town objects!"));
1268 /*** Initialize object allocation info ***/
1270 /* Allocate the alloc_kind_table */
1271 C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
1273 /* Access the table entry */
1275 table = alloc_kind_table;
1277 /* Scan the objects */
1278 for (int i = 1; i < max_k_idx; i++)
1283 /* Scan allocation pairs */
1284 for (int j = 0; j < 4; j++)
1286 /* Count the "legal" entries */
1287 if (k_ptr->chance[j] == 0) continue;
1289 /* Extract the base level */
1290 int x = k_ptr->locale[j];
1292 /* Extract the base probability */
1293 int p = (100 / k_ptr->chance[j]);
1295 /* Skip entries preceding our locale */
1296 int y = (x > 0) ? num[x - 1] : 0;
1298 /* Skip previous entries at this locale */
1301 /* Load the entry */
1302 table[z].index = (KIND_OBJECT_IDX)i;
1303 table[z].level = (DEPTH)x;
1304 table[z].prob1 = (PROB)p;
1305 table[z].prob2 = (PROB)p;
1306 table[z].prob3 = (PROB)p;
1308 /* Another entry complete for this locale */
1318 * @brief モンスター配列と生成テーブルを初期化する /
1319 * Initialize some other arrays
1322 static errr init_alloc(void)
1324 monster_race *r_ptr;
1330 /* Allocate the "r_info" array */
1331 C_MAKE(elements, max_r_idx, tag_type);
1333 /* Scan the monsters */
1334 for (int i = 1; i < max_r_idx; i++)
1336 elements[i].tag = r_info[i].level;
1337 elements[i].index = i;
1340 tag_sort(elements, max_r_idx);
1342 /*** Initialize monster allocation info ***/
1344 /* Size of "alloc_race_table" */
1345 alloc_race_size = max_r_idx;
1347 /* Allocate the alloc_race_table */
1348 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1350 /* Scan the monsters */
1351 for (int i = 1; i < max_r_idx; i++)
1353 /* Get the i'th race */
1354 r_ptr = &r_info[elements[i].index];
1356 /* Count valid pairs */
1357 if (r_ptr->rarity == 0) continue;
1359 /* Extract the base level */
1360 int x = r_ptr->level;
1362 /* Extract the base probability */
1363 int p = (100 / r_ptr->rarity);
1365 /* Load the entry */
1366 alloc_race_table[i].index = (KIND_OBJECT_IDX)elements[i].index;
1367 alloc_race_table[i].level = (DEPTH)x;
1368 alloc_race_table[i].prob1 = (PROB)p;
1369 alloc_race_table[i].prob2 = (PROB)p;
1370 alloc_race_table[i].prob3 = (PROB)p;
1373 /* Free the "r_info" array */
1374 C_KILL(elements, max_r_idx, tag_type);
1376 #else /* SORT_R_INFO */
1379 s16b num[MAX_DEPTH];
1380 s16b aux[MAX_DEPTH];
1382 /*** Analyze monster allocation info ***/
1384 /* Clear the "aux" array */
1385 C_WIPE(&aux, MAX_DEPTH, s16b);
1387 /* Clear the "num" array */
1388 C_WIPE(&num, MAX_DEPTH, s16b);
1390 /* Size of "alloc_race_table" */
1391 alloc_race_size = 0;
1393 /* Scan the monsters */
1394 for (int i = 1; i < max_r_idx; i++)
1396 /* Get the i'th race */
1399 /* Legal monsters */
1402 /* Count the entries */
1405 /* Group by level */
1406 num[r_ptr->level]++;
1410 /* Collect the level indexes */
1411 for (int i = 1; i < MAX_DEPTH; i++)
1413 /* Group by level */
1414 num[i] += num[i - 1];
1416 if (!num[0]) quit(_("町のモンスターがない!", "No town monsters!"));
1418 /*** Initialize monster allocation info ***/
1420 /* Allocate the alloc_race_table */
1421 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1423 /* Access the table entry */
1424 table = alloc_race_table;
1426 /* Scan the monsters */
1427 for (int i = 1; i < max_r_idx; i++)
1429 /* Get the i'th race */
1432 /* Count valid pairs */
1437 /* Extract the base level */
1440 /* Extract the base probability */
1441 p = (100 / r_ptr->rarity);
1443 /* Skip entries preceding our locale */
1444 y = (x > 0) ? num[x - 1] : 0;
1446 /* Skip previous entries at this locale */
1449 /* Load the entry */
1456 /* Another entry complete for this locale */
1461 #endif /* SORT_R_INFO */
1463 (void)init_object_alloc();
1469 * @brief 画面左下にシステムメッセージを表示する /
1470 * Hack -- take notes on line 23
1473 static void note(concptr str)
1475 Term_erase(0, 23, 255);
1476 Term_putstr(20, 23, -1, TERM_WHITE, str);
1482 * @brief 全ゲームデータ読み込みのサブルーチン /
1483 * Hack -- Explain a broken "lib" folder and quit (see below).
1487 * This function is "messy" because various things
1488 * may or may not be initialized, but the "plog()" and "quit()"
1489 * functions are "supposed" to work under any conditions.
1492 static void init_angband_aux(concptr why)
1498 plog("'lib'ディレクトリが存在しないか壊れているようです。");
1501 plog("ひょっとするとアーカイブが正しく解凍されていないのかもしれません。");
1504 plog("該当する'README'ファイルを読んで確認してみて下さい。");
1506 /* Quit with error */
1510 plog("The 'lib' directory is probably missing or broken.");
1513 plog("Perhaps the archive was not extracted correctly.");
1516 plog("See the 'README' file for more information.");
1518 /* Quit with error */
1519 quit("Fatal Error.");
1526 * @brief 全ゲームデータ読み込みのメインルーチン /
1527 * Hack -- main Angband initialization entry point
1531 * This function is "messy" because various things
1532 * may or may not be initialized, but the "plog()" and "quit()"
1533 * functions are "supposed" to work under any conditions.
1534 * Verify some files, display the "news.txt" file, create
1535 * the high score file, initialize all internal arrays, and
1536 * load the basic "user pref files".
1537 * Be very careful to keep track of the order in which things
1538 * are initialized, in particular, the only thing *known* to
1539 * be available when this function is called is the "z-term.c"
1540 * package, and that may not be fully initialized until the
1541 * end of this function, when the default "user pref files"
1542 * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
1543 * Note that this function attempts to verify the "news" file,
1544 * and the game aborts (cleanly) on failure, since without the
1545 * "news" file, it is likely that the "lib" folder has not been
1546 * correctly located. Otherwise, the news file is displayed for
1548 * Note that this function attempts to verify (or create) the
1549 * "high score" file, and the game aborts (cleanly) on failure,
1550 * since one of the most common "extraction" failures involves
1551 * failing to extract all sub-directories (even empty ones), such
1552 * as by failing to use the "-d" option of "pkunzip", or failing
1553 * to use the "save empty directories" option with "Compact Pro".
1554 * This error will often be caught by the "high score" creation
1555 * code below, since the "lib/apex" directory, being empty in the
1556 * standard distributions, is most likely to be "lost", making it
1557 * impossible to create the high score file.
1558 * Note that various things are initialized by this function,
1559 * including everything that was once done by "init_some_arrays".
1560 * This initialization involves the parsing of special files
1561 * in the "lib/data" and sometimes the "lib/edit" directories.
1562 * Note that the "template" files are initialized first, since they
1563 * often contain errors. This means that macros and message recall
1564 * and things like that are not available until after they are done.
1565 * We load the default "user pref files" here in case any "color"
1566 * changes are needed before character creation.
1567 * Note that the "graf-xxx.prf" file must be loaded separately,
1568 * if needed, in the first (?) pass through "TERM_XTRA_REACT".
1571 void init_angband(player_type *player_ptr)
1573 /*** Verify the "news" file ***/
1575 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1577 /* Attempt to open the file */
1578 int fd = fd_open(buf, O_RDONLY);
1585 sprintf(why, _("'%s'ファイルにアクセスできません!", "Cannot access the '%s' file!"), buf);
1587 /* Crash and burn */
1588 init_angband_aux(why);
1593 /*** Display the "news" file ***/
1595 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1597 /* Open the News file */
1599 fp = my_fopen(buf, "r");
1604 /* Dump the file to the screen */
1606 while (0 == my_fgets(fp, buf, sizeof(buf)))
1608 /* Display and advance */
1609 Term_putstr(0, i++, -1, TERM_WHITE, buf);
1617 /*** Verify (or create) the "high score" file ***/
1618 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
1620 /* Attempt to open the high score file */
1621 fd = fd_open(buf, O_RDONLY);
1623 BIT_FLAGS file_permission = 0664;
1626 /* File type is "DATA" */
1627 FILE_TYPE(FILE_TYPE_DATA);
1629 /* Grab permissions */
1632 /* Create a new high score file */
1633 fd = fd_make(buf, file_permission);
1635 /* Drop permissions */
1643 sprintf(why, _("'%s'ファイルを作成できません!", "Cannot create the '%s' file!"), buf);
1645 /* Crash and burn */
1646 init_angband_aux(why);
1654 /*** Initialize some arrays ***/
1656 /* Initialize misc. values */
1657 note(_("[変数を初期化しています...(その他)", "[Initializing values... (misc)]"));
1658 if (init_misc(player_ptr)) quit(_("その他の変数を初期化できません", "Cannot initialize misc. values"));
1660 /* Initialize feature info */
1662 note("[データの初期化中... (地形)]");
1663 if (init_f_info()) quit("地形初期化不能");
1664 if (init_feat_variables()) quit("地形初期化不能");
1666 note("[Initializing arrays... (features)]");
1667 if (init_f_info()) quit("Cannot initialize features");
1668 if (init_feat_variables()) quit("Cannot initialize features");
1671 /* Initialize object info */
1672 note(_("[データの初期化中... (アイテム)]", "[Initializing arrays... (objects)]"));
1673 if (init_k_info()) quit(_("アイテム初期化不能", "Cannot initialize objects"));
1675 /* Initialize artifact info */
1676 note(_("[データの初期化中... (伝説のアイテム)]", "[Initializing arrays... (artifacts)]"));
1677 if (init_a_info()) quit(_("伝説のアイテム初期化不能", "Cannot initialize artifacts"));
1680 /* Initialize ego-item info */
1681 note(_("[データの初期化中... (名のあるアイテム)]", "[Initializing arrays... (ego-items)]"));
1682 if (init_e_info()) quit(_("名のあるアイテム初期化不能", "Cannot initialize ego-items"));
1685 /* Initialize monster info */
1686 note(_("[データの初期化中... (モンスター)]", "[Initializing arrays... (monsters)]"));
1687 if (init_r_info()) quit(_("モンスター初期化不能", "Cannot initialize monsters"));
1690 /* Initialize dungeon info */
1691 note(_("[データの初期化中... (ダンジョン)]", "[Initializing arrays... (dungeon)]"));
1692 if (init_d_info()) quit(_("ダンジョン初期化不能", "Cannot initialize dungeon"));
1694 for (int i = 1; i < current_world_ptr->max_d_idx; i++)
1695 if (d_info[i].final_guardian)
1696 r_info[d_info[i].final_guardian].flags7 |= RF7_GUARDIAN;
1699 /* Initialize magic info */
1700 note(_("[データの初期化中... (魔法)]", "[Initializing arrays... (magic)]"));
1701 if (init_m_info()) quit(_("魔法初期化不能", "Cannot initialize magic"));
1703 /* Initialize weapon_exp info */
1704 note(_("[データの初期化中... (熟練度)]", "[Initializing arrays... (skill)]"));
1705 if (init_s_info()) quit(_("熟練度初期化不能", "Cannot initialize skill"));
1707 /* Initialize wilderness array */
1708 note(_("[配列を初期化しています... (荒野)]", "[Initializing arrays... (wilderness)]"));
1710 if (init_wilderness()) quit(_("荒野を初期化できません", "Cannot initialize wilderness"));
1712 /* Initialize town array */
1713 note(_("[配列を初期化しています... (街)]", "[Initializing arrays... (towns)]"));
1714 if (init_towns()) quit(_("街を初期化できません", "Cannot initialize towns"));
1716 /* Initialize building array */
1717 note(_("[配列を初期化しています... (建物)]", "[Initializing arrays... (buildings)]"));
1718 if (init_buildings()) quit(_("建物を初期化できません", "Cannot initialize buildings"));
1720 /* Initialize quest array */
1721 note(_("[配列を初期化しています... (クエスト)]", "[Initializing arrays... (quests)]"));
1722 if (init_quests()) quit(_("クエストを初期化できません", "Cannot initialize quests"));
1724 /* Initialize vault info */
1725 if (init_v_info()) quit(_("vault 初期化不能", "Cannot initialize vaults"));
1727 /* Initialize some other arrays */
1728 note(_("[データの初期化中... (その他)]", "[Initializing arrays... (other)]"));
1729 if (init_other(player_ptr)) quit(_("その他のデータ初期化不能", "Cannot initialize other stuff"));
1731 /* Initialize some other arrays */
1732 note(_("[データの初期化中... (アロケーション)]", "[Initializing arrays... (alloc)]"));
1733 if (init_alloc()) quit(_("アロケーション・スタッフ初期化不能", "Cannot initialize alloc stuff"));
1735 /*** Load default user pref files ***/
1737 /* Initialize feature info */
1738 note(_("[ユーザー設定ファイルを初期化しています...]", "[Initializing user pref files...]"));
1740 /* Access the "basic" pref file */
1741 strcpy(buf, "pref.prf");
1743 /* Process that file */
1744 process_pref_file(player_ptr, buf);
1746 /* Access the "basic" system pref file */
1747 sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
1749 /* Process that file */
1750 process_pref_file(player_ptr, buf);
1752 note(_("[初期化終了]", "[Initialization complete]"));
1760 static void put_title(void)
1764 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,
1766 sprintf(title, _("変愚蛮怒 %d.%d.%d(%s)", "Hengband %d.%d.%d(%s)"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH,
1768 IS_STABLE_VERSION ? _("安定版", "Stable") : _("開発版", "Developing"));
1769 int col = (80 - strlen(title)) / 2;
1770 col = col < 0 ? 0 : col;
1771 prt(title, VER_INFO_ROW, col);
1776 * @brief サムチェック情報を出力 / Get check sum in string form
1777 * @return サムチェック情報の文字列
1779 concptr get_check_sum(void)
1781 return format("%02x%02x%02x%02x%02x%02x%02x%02x%02x",