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"
62 #ifdef CHECK_MODIFICATION_TIME
63 #include <sys/types.h>
65 #endif /* CHECK_MODIFICATION_TIME */
68 static void put_title(void);
71 * @brief 各データファイルを読み取るためのパスを取得する
72 * Find the default paths to all of our important sub-directories.
73 * @param path パス保管先の文字列
77 * The purpose of each sub-directory is described in "variable.c".
78 * All of the sub-directories should, by default, be located inside
79 * the main "lib" directory, whose location is very system dependant.
80 * This function takes a writable buffer, initially containing the
81 * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
82 * or a system dependant string, for example, ":lib:". The buffer
83 * must be large enough to contain at least 32 more characters.
84 * Various command line options may allow some of the important
85 * directories to be changed to user-specified directories, most
86 * importantly, the "info" and "user" and "save" directories,
87 * but this is done after this function, see "main.c".
88 * In general, the initial path should end in the appropriate "PATH_SEP"
89 * string. All of the "sub-directory" paths (created below or supplied
90 * by the user) will NOT end in the "PATH_SEP" string, see the special
91 * "path_build()" function in "util.c" for more information.
92 * Mega-Hack -- support fat raw files under NEXTSTEP, using special
93 * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
94 * requiring the directories to be created by hand by the user.
95 * Hack -- first we free all the strings, since this is known
96 * to succeed even if the strings have not been allocated yet,
97 * as long as the variables start out as "NULL". This allows
98 * this function to be called multiple times, for example, to
99 * try several base "path" values until a good one is found.
102 void init_file_paths(char *path)
106 #ifdef PRIVATE_USER_PATH
108 #endif /* PRIVATE_USER_PATH */
110 /*** Free everything ***/
112 /* Free the main path */
113 string_free(ANGBAND_DIR);
115 /* Free the sub-paths */
116 string_free(ANGBAND_DIR_APEX);
117 string_free(ANGBAND_DIR_BONE);
118 string_free(ANGBAND_DIR_DATA);
119 string_free(ANGBAND_DIR_EDIT);
120 string_free(ANGBAND_DIR_SCRIPT);
121 string_free(ANGBAND_DIR_FILE);
122 string_free(ANGBAND_DIR_HELP);
123 string_free(ANGBAND_DIR_INFO);
124 string_free(ANGBAND_DIR_SAVE);
125 string_free(ANGBAND_DIR_USER);
126 string_free(ANGBAND_DIR_XTRA);
128 /*** Prepare the "path" ***/
130 /* Hack -- save the main directory */
131 ANGBAND_DIR = string_make(path);
133 /* Prepare to append to the Base Path */
134 tail = path + strlen(path);
136 /*** Build the sub-directory names ***/
138 /* Build a path name */
139 strcpy(tail, "apex");
140 ANGBAND_DIR_APEX = string_make(path);
142 /* Build a path name */
143 strcpy(tail, "bone");
144 ANGBAND_DIR_BONE = string_make(path);
146 /* Build a path name */
147 strcpy(tail, "data");
148 ANGBAND_DIR_DATA = string_make(path);
150 /* Build a path name */
151 strcpy(tail, "edit");
152 ANGBAND_DIR_EDIT = string_make(path);
154 /* Build a path name */
155 strcpy(tail, "script");
156 ANGBAND_DIR_SCRIPT = string_make(path);
158 /* Build a path name */
159 strcpy(tail, "file");
160 ANGBAND_DIR_FILE = string_make(path);
162 /* Build a path name */
163 strcpy(tail, "help");
164 ANGBAND_DIR_HELP = string_make(path);
166 /* Build a path name */
167 strcpy(tail, "info");
168 ANGBAND_DIR_INFO = string_make(path);
170 /* Build a path name */
171 strcpy(tail, "pref");
172 ANGBAND_DIR_PREF = string_make(path);
174 /* Build a path name */
175 strcpy(tail, "save");
176 ANGBAND_DIR_SAVE = string_make(path);
178 #ifdef PRIVATE_USER_PATH
180 /* Build the path to the user specific directory */
181 path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
183 /* Build a relative path name */
184 ANGBAND_DIR_USER = string_make(buf);
186 #else /* PRIVATE_USER_PATH */
188 /* Build a path name */
189 strcpy(tail, "user");
190 ANGBAND_DIR_USER = string_make(path);
192 #endif /* PRIVATE_USER_PATH */
194 /* Build a path name */
195 strcpy(tail, "xtra");
196 ANGBAND_DIR_XTRA = string_make(path);
201 /* Allow "fat binary" usage with NeXT */
222 /* Use special directory */
225 /* Forget the old path name */
226 string_free(ANGBAND_DIR_DATA);
228 /* Build a new path name */
229 sprintf(tail, "data-%s", next);
230 ANGBAND_DIR_DATA = string_make(path);
240 * Hack -- help give useful error messages
242 int error_idx; /*!< データ読み込み/初期化時に汎用的にエラーコードを保存するグローバル変数 */
243 int error_line; /*!< データ読み込み/初期化時に汎用的にエラー行数を保存するグローバル変数 */
246 * エラーメッセージの名称定義 / Standard error message text
248 concptr err_str[PARSE_ERROR_MAX] =
265 "missing record header",
266 "non-sequential records",
267 "invalid flag specification",
268 "undefined directive",
270 "coordinates out of bounds",
272 "undefined terrain tag",
281 header v_head; /*!< Vault情報のヘッダ構造体 */
282 header f_head; /*!< 地形情報のヘッダ構造体 */
283 header k_head; /*!< ペースアイテム情報のヘッダ構造体 */
284 header a_head; /*!< 固定アーティファクト情報のヘッダ構造体 */
285 header e_head; /*!< アイテムエゴ情報のヘッダ構造体 */
286 header r_head; /*!< モンスター種族情報のヘッダ構造体 */
287 header d_head; /*!< ダンジョン情報のヘッダ構造体 */
288 header s_head; /*!< プレイヤー職業技能情報のヘッダ構造体 */
289 header m_head; /*!< プレイヤー職業魔法情報のヘッダ構造体 */
291 #ifdef CHECK_MODIFICATION_TIME
294 * @brief テキストファイルとrawファイルの更新時刻を比較する
295 * Find the default paths to all of our important sub-directories.
296 * @param fd ファイルディスクリプタ
297 * @param template_file ファイル名
298 * @return テキストの方が新しいか、rawファイルがなく更新の必要がある場合-1、更新の必要がない場合0。
300 static errr check_modification_date(int fd, concptr template_file)
302 struct stat txt_stat, raw_stat;
304 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, template_file);
306 /* Access stats on text file */
307 if (stat(buf, &txt_stat))
312 /* Access stats on raw file */
313 if (fstat(fd, &raw_stat))
318 /* Ensure text file is not newer than raw file */
319 if (txt_stat.st_mtime > raw_stat.st_mtime)
327 #endif /* CHECK_MODIFICATION_TIME */
329 /*** Initialize from binary image files ***/
332 * @brief rawファイルからのデータの読み取り処理
333 * Initialize the "*_info" array, by parsing a binary "image" file
334 * @param fd ファイルディスクリプタ
335 * @param head rawファイルのヘッダ
338 static errr init_info_raw(int fd, header *head)
342 /* Read and Verify the header */
343 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
344 (test.v_major != head->v_major) ||
345 (test.v_minor != head->v_minor) ||
346 (test.v_patch != head->v_patch) ||
347 (test.info_num != head->info_num) ||
348 (test.info_len != head->info_len) ||
349 (test.head_size != head->head_size) ||
350 (test.info_size != head->info_size))
356 /* Accept the header */
359 /* Allocate the "*_info" array */
360 C_MAKE(head->info_ptr, head->info_size, char);
362 /* Read the "*_info" array */
363 fd_read(fd, head->info_ptr, head->info_size);
367 /* Allocate the "*_name" array */
368 C_MAKE(head->name_ptr, head->name_size, char);
370 /* Read the "*_name" array */
371 fd_read(fd, head->name_ptr, head->name_size);
376 /* Allocate the "*_text" array */
377 C_MAKE(head->text_ptr, head->text_size, char);
379 /* Read the "*_text" array */
380 fd_read(fd, head->text_ptr, head->text_size);
385 /* Allocate the "*_tag" array */
386 C_MAKE(head->tag_ptr, head->tag_size, char);
388 /* Read the "*_tag" array */
389 fd_read(fd, head->tag_ptr, head->tag_size);
399 * Initialize the header of an *_info.raw file.
400 * @param head rawファイルのヘッダ
405 static void init_header(header *head, IDX num, int len)
407 /* Save the "version" */
408 head->v_major = FAKE_VER_MAJOR;
409 head->v_minor = FAKE_VER_MINOR;
410 head->v_patch = FAKE_VER_PATCH;
413 /* Save the "record" information */
414 head->info_num = (IDX)num;
415 head->info_len = len;
417 /* Save the size of "*_head" and "*_info" */
418 head->head_size = sizeof(header);
419 head->info_size = head->info_num * head->info_len;
424 * todo プリプロがゴミすぎて整理不可能
426 * Initialize the "*_info" array
427 * @param filename ファイル名(拡張子txt/raw)
428 * @param head 処理に用いるヘッダ構造体
429 * @param info データ保管先の構造体ポインタ
430 * @param name 名称用可変文字列の保管先
431 * @param text テキスト用可変文字列の保管先
432 * @param tag タグ用可変文字列の保管先
435 * Note that we let each entry have a unique "name" and "text" string,
436 * even if the string happens to be empty (everyone has a unique '\0').
438 static errr init_info(concptr filename, header *head, void **info, char **name, char **text, char **tag)
445 /*** Load the binary image file ***/
446 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
448 /* Attempt to open the "raw" file */
449 int fd = fd_open(buf, O_RDONLY);
451 /* Process existing "raw" file */
455 #ifdef CHECK_MODIFICATION_TIME
457 err = check_modification_date(fd, format("%s.txt", filename));
459 #endif /* CHECK_MODIFICATION_TIME */
461 /* Attempt to parse the "raw" file */
463 err = init_info_raw(fd, head);
467 /* Do we have to parse the *.txt file? */
468 BIT_FLAGS file_permission = 0644;
471 /*** Make the fake arrays ***/
473 /* Allocate the "*_info" array */
474 C_MAKE(head->info_ptr, head->info_size, char);
476 /* Hack -- make "fake" arrays */
477 if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
478 if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
479 if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
481 if (info) (*info) = head->info_ptr;
482 if (name) (*name) = head->name_ptr;
483 if (text) (*text) = head->text_ptr;
484 if (tag) (*tag) = head->tag_ptr;
486 /*** Load the ascii template file ***/
488 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
489 fp = my_fopen(buf, "r");
492 if (!fp) quit(format(_("'%s.txt'ファイルをオープンできません。", "Cannot open '%s.txt' file."), filename));
495 err = init_info_txt(fp, buf, head, head->parse_info_txt);
505 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "未知の");
507 msg_format("'%s.txt'ファイルの %d 行目にエラー。", filename, error_line);
508 msg_format("レコード %d は '%s' エラーがあります。", error_idx, oops);
509 msg_format("構文 '%s'。", buf);
513 quit(format("'%s.txt'ファイルにエラー", filename));
516 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
518 msg_format("Error %d at line %d of '%s.txt'.", err, error_line, filename);
519 msg_format("Record %d contains a '%s' error.", error_idx, oops);
520 msg_format("Parsing '%s'.", buf);
524 quit(format("Error in '%s.txt' file.", filename));
530 /*** Make final retouch on fake tags ***/
534 (*head->retouch)(head);
538 /*** Dump the binary image file ***/
540 /* File type is "DATA" */
541 FILE_TYPE(FILE_TYPE_DATA);
542 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));
606 if (info) *info = head->info_ptr;
607 if (name) *name = head->name_ptr;
608 if (text) *text = head->text_ptr;
609 if (tag) *tag = head->tag_ptr;
615 * @brief 地形情報読み込みのメインルーチン /
616 * Initialize the "f_info" array
619 static errr init_f_info(void)
621 /* Init the header */
622 init_header(&f_head, max_f_idx, sizeof(feature_type));
624 /* Save a pointer to the parsing function */
625 f_head.parse_info_txt = parse_f_info;
627 /* Save a pointer to the retouch fake tags */
628 f_head.retouch = retouch_f_info;
630 return init_info("f_info", &f_head,
631 (void*)&f_info, &f_name, NULL, &f_tag);
636 * @brief ベースアイテム情報読み込みのメインルーチン /
637 * Initialize the "k_info" array
640 static errr init_k_info(void)
642 /* Init the header */
643 init_header(&k_head, max_k_idx, sizeof(object_kind));
645 /* Save a pointer to the parsing function */
646 k_head.parse_info_txt = parse_k_info;
648 return init_info("k_info", &k_head,
649 (void*)&k_info, &k_name, &k_text, NULL);
654 * @brief 固定アーティファクト情報読み込みのメインルーチン /
655 * Initialize the "a_info" array
658 static errr init_a_info(void)
660 /* Init the header */
661 init_header(&a_head, max_a_idx, sizeof(artifact_type));
663 /* Save a pointer to the parsing function */
664 a_head.parse_info_txt = parse_a_info;
666 return init_info("a_info", &a_head,
667 (void*)&a_info, &a_name, &a_text, NULL);
672 * @brief 固定アーティファクト情報読み込みのメインルーチン /
673 * Initialize the "e_info" array
676 static errr init_e_info(void)
678 /* Init the header */
679 init_header(&e_head, max_e_idx, sizeof(ego_item_type));
681 /* Save a pointer to the parsing function */
682 e_head.parse_info_txt = parse_e_info;
684 return init_info("e_info", &e_head,
685 (void*)&e_info, &e_name, &e_text, NULL);
690 * @brief モンスター種族情報読み込みのメインルーチン /
691 * Initialize the "r_info" array
694 static errr init_r_info(void)
696 /* Init the header */
697 init_header(&r_head, max_r_idx, sizeof(monster_race));
699 /* Save a pointer to the parsing function */
700 r_head.parse_info_txt = parse_r_info;
702 return init_info("r_info", &r_head,
703 (void*)&r_info, &r_name, &r_text, NULL);
708 * @brief ダンジョン情報読み込みのメインルーチン /
709 * Initialize the "d_info" array
712 static errr init_d_info(void)
714 /* Init the header */
715 init_header(&d_head, current_world_ptr->max_d_idx, sizeof(dungeon_type));
717 /* Save a pointer to the parsing function */
718 d_head.parse_info_txt = parse_d_info;
720 return init_info("d_info", &d_head,
721 (void*)&d_info, &d_name, &d_text, NULL);
726 * @brief Vault情報読み込みのメインルーチン /
727 * Initialize the "v_info" array
730 * Note that we let each entry have a unique "name" and "text" string,
731 * even if the string happens to be empty (everyone has a unique '\0').
733 errr init_v_info(void)
735 /* Init the header */
736 init_header(&v_head, max_v_idx, sizeof(vault_type));
738 /* Save a pointer to the parsing function */
739 v_head.parse_info_txt = parse_v_info;
741 return init_info("v_info", &v_head,
742 (void*)&v_info, &v_name, &v_text, NULL);
747 * @brief 職業技能情報読み込みのメインルーチン /
748 * Initialize the "s_info" array
751 static errr init_s_info(void)
753 /* Init the header */
754 init_header(&s_head, MAX_CLASS, sizeof(skill_table));
756 /* Save a pointer to the parsing function */
757 s_head.parse_info_txt = parse_s_info;
759 return init_info("s_info", &s_head,
760 (void*)&s_info, NULL, NULL, NULL);
765 * @brief 職業魔法情報読み込みのメインルーチン /
766 * Initialize the "m_info" array
769 static errr init_m_info(void)
771 /* Init the header */
772 init_header(&m_head, MAX_CLASS, sizeof(player_magic));
774 /* Save a pointer to the parsing function */
775 m_head.parse_info_txt = parse_m_info;
777 return init_info("m_info", &m_head,
778 (void*)&m_info, NULL, NULL, NULL);
783 * @brief 基本情報読み込みのメインルーチン /
784 * Initialize misc. values
785 * @param player_ptr プレーヤーへの参照ポインタ
788 static errr init_misc(player_type *player_ptr)
790 return process_dungeon_file(player_ptr, "misc.txt", 0, 0, 0, 0);
795 * @brief 町情報読み込みのメインルーチン /
796 * Initialize town array
799 static errr init_towns(void)
801 /* Allocate the towns */
802 C_MAKE(town_info, max_towns, town_type);
804 for (int i = 1; i < max_towns; i++)
806 /*** Prepare the Stores ***/
808 /* Allocate the stores */
809 C_MAKE(town_info[i].store, MAX_STORES, store_type);
811 /* Fill in each store */
812 for (int j = 0; j < MAX_STORES; j++)
814 /* Access the store */
815 store_type *st_ptr = &town_info[i].store[j];
817 if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME)) continue;
819 /* Assume full stock */
822 * 我が家が 20 ページまで使える隠し機能のための準備。
823 * オプションが有効でもそうでなくても一応スペースを作っておく。
827 st_ptr->stock_size = (STORE_INVEN_MAX * 10);
829 else if (j == STORE_MUSEUM)
831 st_ptr->stock_size = (STORE_INVEN_MAX * 50);
835 st_ptr->stock_size = STORE_INVEN_MAX;
838 /* Allocate the stock */
839 C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type);
841 /* No table for the black market or home */
842 if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM)) continue;
844 /* Assume full table */
845 st_ptr->table_size = STORE_CHOICES;
847 /* Allocate the stock */
848 C_MAKE(st_ptr->table, st_ptr->table_size, s16b);
850 /* Scan the choices */
851 for (int k = 0; k < STORE_CHOICES; k++)
853 KIND_OBJECT_IDX k_idx;
855 /* Extract the tval/sval codes */
856 int tv = store_table[j][k][0];
857 int sv = store_table[j][k][1];
860 for (k_idx = 1; k_idx < max_k_idx; k_idx++)
862 object_kind *k_ptr = &k_info[k_idx];
865 if ((k_ptr->tval == tv) && (k_ptr->sval == sv)) break;
869 if (k_idx == max_k_idx) continue;
871 /* Add that item index to the table */
872 st_ptr->table[st_ptr->table_num++] = k_idx;
881 * @brief 店情報初期化のメインルーチン /
882 * Initialize buildings
885 errr init_buildings(void)
887 for (int i = 0; i < MAX_BLDG; i++)
889 building[i].name[0] = '\0';
890 building[i].owner_name[0] = '\0';
891 building[i].owner_race[0] = '\0';
893 for (int j = 0; j < 8; j++)
895 building[i].act_names[j][0] = '\0';
896 building[i].member_costs[j] = 0;
897 building[i].other_costs[j] = 0;
898 building[i].letters[j] = 0;
899 building[i].actions[j] = 0;
900 building[i].action_restr[j] = 0;
903 for (int j = 0; j < MAX_CLASS; j++)
905 building[i].member_class[j] = 0;
908 for (int j = 0; j < MAX_RACES; j++)
910 building[i].member_race[j] = 0;
913 for (int j = 0; j < MAX_MAGIC + 1; j++)
915 building[i].member_realm[j] = 0;
924 * @brief クエスト情報初期化のメインルーチン /
925 * Initialize quest array
928 static errr init_quests(void)
930 /* Allocate the quests */
931 C_MAKE(quest, max_q_idx, quest_type);
933 /* Set all quest to "untaken" */
934 for (int i = 0; i < max_q_idx; i++)
936 quest[i].status = QUEST_STATUS_UNTAKEN;
942 /*! 地形タグ情報から地形IDを得られなかった場合にTRUEを返すグローバル変数 */
943 static bool feat_tag_is_not_found = FALSE;
946 * @brief 地形タグからIDを得る /
947 * Initialize quest array
950 s16b f_tag_to_index_in_init(concptr str)
952 FEAT_IDX feat = f_tag_to_index(str);
954 if (feat < 0) feat_tag_is_not_found = TRUE;
961 * @brief 地形の汎用定義をタグを通じて取得する /
962 * Initialize feature variables
965 static errr init_feat_variables(void)
967 feat_none = f_tag_to_index_in_init("NONE");
969 feat_floor = f_tag_to_index_in_init("FLOOR");
970 feat_glyph = f_tag_to_index_in_init("GLYPH");
971 feat_explosive_rune = f_tag_to_index_in_init("EXPLOSIVE_RUNE");
972 feat_mirror = f_tag_to_index_in_init("MIRROR");
974 feat_door[DOOR_DOOR].open = f_tag_to_index_in_init("OPEN_DOOR");
975 feat_door[DOOR_DOOR].broken = f_tag_to_index_in_init("BROKEN_DOOR");
976 feat_door[DOOR_DOOR].closed = f_tag_to_index_in_init("CLOSED_DOOR");
980 for (i = 1; i < MAX_LJ_DOORS; i++)
982 s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
984 feat_door[DOOR_DOOR].locked[i - 1] = door;
987 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
988 feat_door[DOOR_DOOR].num_locked = i - 1;
991 for (i = 0; i < MAX_LJ_DOORS; i++)
993 s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
995 feat_door[DOOR_DOOR].jammed[i] = door;
998 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
999 feat_door[DOOR_DOOR].num_jammed = i;
1002 feat_door[DOOR_GLASS_DOOR].open = f_tag_to_index_in_init("OPEN_GLASS_DOOR");
1003 feat_door[DOOR_GLASS_DOOR].broken = f_tag_to_index_in_init("BROKEN_GLASS_DOOR");
1004 feat_door[DOOR_GLASS_DOOR].closed = f_tag_to_index_in_init("CLOSED_GLASS_DOOR");
1006 /* Locked glass doors */
1007 for (i = 1; i < MAX_LJ_DOORS; i++)
1009 s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
1010 if (door < 0) break;
1011 feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door;
1014 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1015 feat_door[DOOR_GLASS_DOOR].num_locked = i - 1;
1017 /* Jammed glass doors */
1018 for (i = 0; i < MAX_LJ_DOORS; i++)
1020 s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
1021 if (door < 0) break;
1022 feat_door[DOOR_GLASS_DOOR].jammed[i] = door;
1025 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1026 feat_door[DOOR_GLASS_DOOR].num_jammed = i;
1029 feat_door[DOOR_CURTAIN].open = f_tag_to_index_in_init("OPEN_CURTAIN");
1030 feat_door[DOOR_CURTAIN].broken = feat_door[DOOR_CURTAIN].open;
1031 feat_door[DOOR_CURTAIN].closed = f_tag_to_index_in_init("CLOSED_CURTAIN");
1032 feat_door[DOOR_CURTAIN].locked[0] = feat_door[DOOR_CURTAIN].closed;
1033 feat_door[DOOR_CURTAIN].num_locked = 1;
1034 feat_door[DOOR_CURTAIN].jammed[0] = feat_door[DOOR_CURTAIN].closed;
1035 feat_door[DOOR_CURTAIN].num_jammed = 1;
1038 feat_up_stair = f_tag_to_index_in_init("UP_STAIR");
1039 feat_down_stair = f_tag_to_index_in_init("DOWN_STAIR");
1040 feat_entrance = f_tag_to_index_in_init("ENTRANCE");
1043 init_normal_traps();
1046 feat_trap_open = f_tag_to_index_in_init("TRAP_OPEN");
1047 feat_trap_armageddon = f_tag_to_index_in_init("TRAP_ARMAGEDDON");
1048 feat_trap_piranha = f_tag_to_index_in_init("TRAP_PIRANHA");
1051 feat_rubble = f_tag_to_index_in_init("RUBBLE");
1054 feat_magma_vein = f_tag_to_index_in_init("MAGMA_VEIN");
1055 feat_quartz_vein = f_tag_to_index_in_init("QUARTZ_VEIN");
1058 feat_granite = f_tag_to_index_in_init("GRANITE");
1059 feat_permanent = f_tag_to_index_in_init("PERMANENT");
1062 feat_glass_floor = f_tag_to_index_in_init("GLASS_FLOOR");
1065 feat_glass_wall = f_tag_to_index_in_init("GLASS_WALL");
1066 feat_permanent_glass_wall = f_tag_to_index_in_init("PERMANENT_GLASS_WALL");
1069 feat_pattern_start = f_tag_to_index_in_init("PATTERN_START");
1070 feat_pattern_1 = f_tag_to_index_in_init("PATTERN_1");
1071 feat_pattern_2 = f_tag_to_index_in_init("PATTERN_2");
1072 feat_pattern_3 = f_tag_to_index_in_init("PATTERN_3");
1073 feat_pattern_4 = f_tag_to_index_in_init("PATTERN_4");
1074 feat_pattern_end = f_tag_to_index_in_init("PATTERN_END");
1075 feat_pattern_old = f_tag_to_index_in_init("PATTERN_OLD");
1076 feat_pattern_exit = f_tag_to_index_in_init("PATTERN_EXIT");
1077 feat_pattern_corrupted = f_tag_to_index_in_init("PATTERN_CORRUPTED");
1080 feat_black_market = f_tag_to_index_in_init("BLACK_MARKET");
1081 feat_town = f_tag_to_index_in_init("TOWN");
1084 feat_deep_water = f_tag_to_index_in_init("DEEP_WATER");
1085 feat_shallow_water = f_tag_to_index_in_init("SHALLOW_WATER");
1086 feat_deep_lava = f_tag_to_index_in_init("DEEP_LAVA");
1087 feat_shallow_lava = f_tag_to_index_in_init("SHALLOW_LAVA");
1088 feat_heavy_cold_zone = f_tag_to_index_in_init("HEAVY_COLD_ZONE");
1089 feat_cold_zone = f_tag_to_index_in_init("COLD_ZONE");
1090 feat_heavy_electrical_zone = f_tag_to_index_in_init("HEAVY_ELECTRICAL_ZONE");
1091 feat_electrical_zone = f_tag_to_index_in_init("ELECTRICAL_ZONE");
1092 feat_deep_acid_puddle = f_tag_to_index_in_init("DEEP_ACID_PUDDLE");
1093 feat_shallow_acid_puddle = f_tag_to_index_in_init("SHALLOW_ACID_PUDDLE");
1094 feat_deep_poisonous_puddle = f_tag_to_index_in_init("DEEP_POISONOUS_PUDDLE");
1095 feat_shallow_poisonous_puddle = f_tag_to_index_in_init("SHALLOW_POISONOUS_PUDDLE");
1096 feat_dirt = f_tag_to_index_in_init("DIRT");
1097 feat_grass = f_tag_to_index_in_init("GRASS");
1098 feat_flower = f_tag_to_index_in_init("FLOWER");
1099 feat_brake = f_tag_to_index_in_init("BRAKE");
1100 feat_tree = f_tag_to_index_in_init("TREE");
1101 feat_mountain = f_tag_to_index_in_init("MOUNTAIN");
1102 feat_swamp = f_tag_to_index_in_init("SWAMP");
1104 feat_undetected = f_tag_to_index_in_init("UNDETECTED");
1106 init_wilderness_terrains();
1107 return feat_tag_is_not_found ? PARSE_ERROR_UNDEFINED_TERRAIN_TAG : 0;
1112 * @brief その他の初期情報更新 /
1113 * Initialize some other arrays
1116 static errr init_other(player_type *player_ptr)
1118 player_ptr->current_floor_ptr = &floor_info; // TODO:本当はこんなところで初期化したくない
1119 floor_type *floor_ptr = player_ptr->current_floor_ptr;
1121 /*** Prepare the "dungeon" information ***/
1123 /* Allocate and Wipe the object list */
1124 C_MAKE(floor_ptr->o_list, current_world_ptr->max_o_idx, object_type);
1126 /* Allocate and Wipe the monster list */
1127 C_MAKE(floor_ptr->m_list, current_world_ptr->max_m_idx, monster_type);
1129 /* Allocate and Wipe the monster process list */
1130 for (int i = 0; i < MAX_MTIMED; i++)
1132 C_MAKE(floor_ptr->mproc_list[i], current_world_ptr->max_m_idx, s16b);
1135 /* Allocate and Wipe the max dungeon level */
1136 C_MAKE(max_dlv, current_world_ptr->max_d_idx, DEPTH);
1138 for (int i = 0; i < MAX_HGT; i++)
1140 C_MAKE(floor_ptr->grid_array[i], MAX_WID, grid_type);
1143 /*** Prepare the various "bizarre" arrays ***/
1145 /* Macro variables */
1146 C_MAKE(macro__pat, MACRO_MAX, concptr);
1147 C_MAKE(macro__act, MACRO_MAX, concptr);
1148 C_MAKE(macro__cmd, MACRO_MAX, bool);
1150 /* Macro action buffer */
1151 C_MAKE(macro__buf, 1024, char);
1153 /* Quark variables */
1156 /* Message variables */
1157 C_MAKE(message__ptr, MESSAGE_MAX, u32b);
1158 C_MAKE(message__buf, MESSAGE_BUF, char);
1160 /* Hack -- No messages yet */
1161 message__tail = MESSAGE_BUF;
1163 /*** Prepare the options ***/
1165 /* Scan the options */
1166 for (int i = 0; option_info[i].o_desc; i++)
1168 int os = option_info[i].o_set;
1169 int ob = option_info[i].o_bit;
1171 /* Set the "default" options */
1172 if (option_info[i].o_var)
1175 option_mask[os] |= (1L << ob);
1178 if (option_info[i].o_norm)
1181 option_flag[os] |= (1L << ob);
1185 option_flag[os] &= ~(1L << ob);
1190 /* Analyze the windows */
1191 for (int n = 0; n < 8; n++)
1193 /* Analyze the options */
1194 for (int i = 0; i < 32; i++)
1197 if (window_flag_desc[i])
1200 window_mask[n] |= (1L << i);
1206 * Set the "default" window flags
1207 * Window 1 : Display messages
1208 * Window 2 : Display inven/equip
1210 window_flag[1] = 1L << A_MAX;
1211 window_flag[2] = 1L << 0;
1213 /*** Pre-allocate space for the "format()" buffer ***/
1215 /* Hack -- Just call the "format()" function */
1216 (void)format("%s (%s).", "Mr.Hoge", MAINTAINER);
1222 * @brief オブジェクト配列を初期化する /
1223 * Initialize some other arrays
1226 static errr init_object_alloc(void)
1228 s16b aux[MAX_DEPTH];
1229 (void)C_WIPE(&aux, MAX_DEPTH, s16b);
1231 s16b num[MAX_DEPTH];
1232 (void)C_WIPE(&num, MAX_DEPTH, s16b);
1234 /* Free the old "alloc_kind_table" (if it exists) */
1235 if (alloc_kind_table)
1237 C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
1240 /* Size of "alloc_kind_table" */
1241 alloc_kind_size = 0;
1243 /* Scan the objects */
1244 for (int i = 1; i < max_k_idx; i++)
1249 /* Scan allocation pairs */
1250 for (int j = 0; j < 4; j++)
1252 /* Count the "legal" entries */
1253 if (k_ptr->chance[j])
1255 /* Count the entries */
1258 /* Group by level */
1259 num[k_ptr->locale[j]]++;
1264 /* Collect the level indexes */
1265 for (int i = 1; i < MAX_DEPTH; i++)
1267 /* Group by level */
1268 num[i] += num[i - 1];
1271 if (!num[0]) quit(_("町のアイテムがない!", "No town objects!"));
1273 /*** Initialize object allocation info ***/
1275 /* Allocate the alloc_kind_table */
1276 C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
1278 /* Access the table entry */
1280 table = alloc_kind_table;
1282 /* Scan the objects */
1283 for (int i = 1; i < max_k_idx; i++)
1288 /* Scan allocation pairs */
1289 for (int j = 0; j < 4; j++)
1291 /* Count the "legal" entries */
1292 if (k_ptr->chance[j] == 0) continue;
1294 /* Extract the base level */
1295 int x = k_ptr->locale[j];
1297 /* Extract the base probability */
1298 int p = (100 / k_ptr->chance[j]);
1300 /* Skip entries preceding our locale */
1301 int y = (x > 0) ? num[x - 1] : 0;
1303 /* Skip previous entries at this locale */
1306 /* Load the entry */
1307 table[z].index = (KIND_OBJECT_IDX)i;
1308 table[z].level = (DEPTH)x;
1309 table[z].prob1 = (PROB)p;
1310 table[z].prob2 = (PROB)p;
1311 table[z].prob3 = (PROB)p;
1313 /* Another entry complete for this locale */
1323 * @brief モンスター配列と生成テーブルを初期化する /
1324 * Initialize some other arrays
1327 static errr init_alloc(void)
1329 monster_race *r_ptr;
1335 /* Allocate the "r_info" array */
1336 C_MAKE(elements, max_r_idx, tag_type);
1338 /* Scan the monsters */
1339 for (int i = 1; i < max_r_idx; i++)
1341 elements[i].tag = r_info[i].level;
1342 elements[i].index = i;
1345 tag_sort(elements, max_r_idx);
1347 /*** Initialize monster allocation info ***/
1349 /* Size of "alloc_race_table" */
1350 alloc_race_size = max_r_idx;
1352 /* Allocate the alloc_race_table */
1353 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1355 /* Scan the monsters */
1356 for (int i = 1; i < max_r_idx; i++)
1358 /* Get the i'th race */
1359 r_ptr = &r_info[elements[i].index];
1361 /* Count valid pairs */
1362 if (r_ptr->rarity == 0) continue;
1364 /* Extract the base level */
1365 int x = r_ptr->level;
1367 /* Extract the base probability */
1368 int p = (100 / r_ptr->rarity);
1370 /* Load the entry */
1371 alloc_race_table[i].index = (KIND_OBJECT_IDX)elements[i].index;
1372 alloc_race_table[i].level = (DEPTH)x;
1373 alloc_race_table[i].prob1 = (PROB)p;
1374 alloc_race_table[i].prob2 = (PROB)p;
1375 alloc_race_table[i].prob3 = (PROB)p;
1378 /* Free the "r_info" array */
1379 C_KILL(elements, max_r_idx, tag_type);
1381 #else /* SORT_R_INFO */
1384 s16b num[MAX_DEPTH];
1385 s16b aux[MAX_DEPTH];
1387 /*** Analyze monster allocation info ***/
1389 /* Clear the "aux" array */
1390 C_WIPE(&aux, MAX_DEPTH, s16b);
1392 /* Clear the "num" array */
1393 C_WIPE(&num, MAX_DEPTH, s16b);
1395 /* Size of "alloc_race_table" */
1396 alloc_race_size = 0;
1398 /* Scan the monsters */
1399 for (int i = 1; i < max_r_idx; i++)
1401 /* Get the i'th race */
1404 /* Legal monsters */
1407 /* Count the entries */
1410 /* Group by level */
1411 num[r_ptr->level]++;
1415 /* Collect the level indexes */
1416 for (int i = 1; i < MAX_DEPTH; i++)
1418 /* Group by level */
1419 num[i] += num[i - 1];
1421 if (!num[0]) quit(_("町のモンスターがない!", "No town monsters!"));
1423 /*** Initialize monster allocation info ***/
1425 /* Allocate the alloc_race_table */
1426 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1428 /* Access the table entry */
1429 table = alloc_race_table;
1431 /* Scan the monsters */
1432 for (int i = 1; i < max_r_idx; i++)
1434 /* Get the i'th race */
1437 /* Count valid pairs */
1442 /* Extract the base level */
1445 /* Extract the base probability */
1446 p = (100 / r_ptr->rarity);
1448 /* Skip entries preceding our locale */
1449 y = (x > 0) ? num[x - 1] : 0;
1451 /* Skip previous entries at this locale */
1454 /* Load the entry */
1461 /* Another entry complete for this locale */
1466 #endif /* SORT_R_INFO */
1468 (void)init_object_alloc();
1474 * @brief 画面左下にシステムメッセージを表示する /
1475 * Hack -- take notes on line 23
1478 static void note(concptr str)
1480 Term_erase(0, 23, 255);
1481 Term_putstr(20, 23, -1, TERM_WHITE, str);
1487 * @brief 全ゲームデータ読み込みのサブルーチン /
1488 * Hack -- Explain a broken "lib" folder and quit (see below).
1492 * This function is "messy" because various things
1493 * may or may not be initialized, but the "plog()" and "quit()"
1494 * functions are "supposed" to work under any conditions.
1497 static void init_angband_aux(concptr why)
1503 plog("'lib'ディレクトリが存在しないか壊れているようです。");
1506 plog("ひょっとするとアーカイブが正しく解凍されていないのかもしれません。");
1509 plog("該当する'README'ファイルを読んで確認してみて下さい。");
1511 /* Quit with error */
1515 plog("The 'lib' directory is probably missing or broken.");
1518 plog("Perhaps the archive was not extracted correctly.");
1521 plog("See the 'README' file for more information.");
1523 /* Quit with error */
1524 quit("Fatal Error.");
1531 * @brief 全ゲームデータ読み込みのメインルーチン /
1532 * Hack -- main Angband initialization entry point
1536 * This function is "messy" because various things
1537 * may or may not be initialized, but the "plog()" and "quit()"
1538 * functions are "supposed" to work under any conditions.
1539 * Verify some files, display the "news.txt" file, create
1540 * the high score file, initialize all internal arrays, and
1541 * load the basic "user pref files".
1542 * Be very careful to keep track of the order in which things
1543 * are initialized, in particular, the only thing *known* to
1544 * be available when this function is called is the "z-term.c"
1545 * package, and that may not be fully initialized until the
1546 * end of this function, when the default "user pref files"
1547 * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
1548 * Note that this function attempts to verify the "news" file,
1549 * and the game aborts (cleanly) on failure, since without the
1550 * "news" file, it is likely that the "lib" folder has not been
1551 * correctly located. Otherwise, the news file is displayed for
1553 * Note that this function attempts to verify (or create) the
1554 * "high score" file, and the game aborts (cleanly) on failure,
1555 * since one of the most common "extraction" failures involves
1556 * failing to extract all sub-directories (even empty ones), such
1557 * as by failing to use the "-d" option of "pkunzip", or failing
1558 * to use the "save empty directories" option with "Compact Pro".
1559 * This error will often be caught by the "high score" creation
1560 * code below, since the "lib/apex" directory, being empty in the
1561 * standard distributions, is most likely to be "lost", making it
1562 * impossible to create the high score file.
1563 * Note that various things are initialized by this function,
1564 * including everything that was once done by "init_some_arrays".
1565 * This initialization involves the parsing of special files
1566 * in the "lib/data" and sometimes the "lib/edit" directories.
1567 * Note that the "template" files are initialized first, since they
1568 * often contain errors. This means that macros and message recall
1569 * and things like that are not available until after they are done.
1570 * We load the default "user pref files" here in case any "color"
1571 * changes are needed before character creation.
1572 * Note that the "graf-xxx.prf" file must be loaded separately,
1573 * if needed, in the first (?) pass through "TERM_XTRA_REACT".
1576 void init_angband(player_type *player_ptr)
1578 /*** Verify the "news" file ***/
1580 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1582 /* Attempt to open the file */
1583 int fd = fd_open(buf, O_RDONLY);
1590 sprintf(why, _("'%s'ファイルにアクセスできません!", "Cannot access the '%s' file!"), buf);
1592 /* Crash and burn */
1593 init_angband_aux(why);
1598 /*** Display the "news" file ***/
1600 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1602 /* Open the News file */
1604 fp = my_fopen(buf, "r");
1609 /* Dump the file to the screen */
1611 while (0 == my_fgets(fp, buf, sizeof(buf)))
1613 /* Display and advance */
1614 Term_putstr(0, i++, -1, TERM_WHITE, buf);
1622 /*** Verify (or create) the "high score" file ***/
1623 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
1625 /* Attempt to open the high score file */
1626 fd = fd_open(buf, O_RDONLY);
1628 BIT_FLAGS file_permission = 0664;
1631 /* File type is "DATA" */
1632 FILE_TYPE(FILE_TYPE_DATA);
1634 /* Grab permissions */
1637 /* Create a new high score file */
1638 fd = fd_make(buf, file_permission);
1640 /* Drop permissions */
1648 sprintf(why, _("'%s'ファイルを作成できません!", "Cannot create the '%s' file!"), buf);
1650 /* Crash and burn */
1651 init_angband_aux(why);
1659 /*** Initialize some arrays ***/
1661 /* Initialize misc. values */
1662 note(_("[変数を初期化しています...(その他)", "[Initializing values... (misc)]"));
1663 if (init_misc(player_ptr)) quit(_("その他の変数を初期化できません", "Cannot initialize misc. values"));
1665 /* Initialize feature info */
1667 note("[データの初期化中... (地形)]");
1668 if (init_f_info()) quit("地形初期化不能");
1669 if (init_feat_variables()) quit("地形初期化不能");
1671 note("[Initializing arrays... (features)]");
1672 if (init_f_info()) quit("Cannot initialize features");
1673 if (init_feat_variables()) quit("Cannot initialize features");
1676 /* Initialize object info */
1677 note(_("[データの初期化中... (アイテム)]", "[Initializing arrays... (objects)]"));
1678 if (init_k_info()) quit(_("アイテム初期化不能", "Cannot initialize objects"));
1680 /* Initialize artifact info */
1681 note(_("[データの初期化中... (伝説のアイテム)]", "[Initializing arrays... (artifacts)]"));
1682 if (init_a_info()) quit(_("伝説のアイテム初期化不能", "Cannot initialize artifacts"));
1685 /* Initialize ego-item info */
1686 note(_("[データの初期化中... (名のあるアイテム)]", "[Initializing arrays... (ego-items)]"));
1687 if (init_e_info()) quit(_("名のあるアイテム初期化不能", "Cannot initialize ego-items"));
1690 /* Initialize monster info */
1691 note(_("[データの初期化中... (モンスター)]", "[Initializing arrays... (monsters)]"));
1692 if (init_r_info()) quit(_("モンスター初期化不能", "Cannot initialize monsters"));
1695 /* Initialize dungeon info */
1696 note(_("[データの初期化中... (ダンジョン)]", "[Initializing arrays... (dungeon)]"));
1697 if (init_d_info()) quit(_("ダンジョン初期化不能", "Cannot initialize dungeon"));
1699 for (int i = 1; i < current_world_ptr->max_d_idx; i++)
1700 if (d_info[i].final_guardian)
1701 r_info[d_info[i].final_guardian].flags7 |= RF7_GUARDIAN;
1704 /* Initialize magic info */
1705 note(_("[データの初期化中... (魔法)]", "[Initializing arrays... (magic)]"));
1706 if (init_m_info()) quit(_("魔法初期化不能", "Cannot initialize magic"));
1708 /* Initialize weapon_exp info */
1709 note(_("[データの初期化中... (熟練度)]", "[Initializing arrays... (skill)]"));
1710 if (init_s_info()) quit(_("熟練度初期化不能", "Cannot initialize skill"));
1712 /* Initialize wilderness array */
1713 note(_("[配列を初期化しています... (荒野)]", "[Initializing arrays... (wilderness)]"));
1715 if (init_wilderness()) quit(_("荒野を初期化できません", "Cannot initialize wilderness"));
1717 /* Initialize town array */
1718 note(_("[配列を初期化しています... (街)]", "[Initializing arrays... (towns)]"));
1719 if (init_towns()) quit(_("街を初期化できません", "Cannot initialize towns"));
1721 /* Initialize building array */
1722 note(_("[配列を初期化しています... (建物)]", "[Initializing arrays... (buildings)]"));
1723 if (init_buildings()) quit(_("建物を初期化できません", "Cannot initialize buildings"));
1725 /* Initialize quest array */
1726 note(_("[配列を初期化しています... (クエスト)]", "[Initializing arrays... (quests)]"));
1727 if (init_quests()) quit(_("クエストを初期化できません", "Cannot initialize quests"));
1729 /* Initialize vault info */
1730 if (init_v_info()) quit(_("vault 初期化不能", "Cannot initialize vaults"));
1732 /* Initialize some other arrays */
1733 note(_("[データの初期化中... (その他)]", "[Initializing arrays... (other)]"));
1734 if (init_other(player_ptr)) quit(_("その他のデータ初期化不能", "Cannot initialize other stuff"));
1736 /* Initialize some other arrays */
1737 note(_("[データの初期化中... (アロケーション)]", "[Initializing arrays... (alloc)]"));
1738 if (init_alloc()) quit(_("アロケーション・スタッフ初期化不能", "Cannot initialize alloc stuff"));
1740 /*** Load default user pref files ***/
1742 /* Initialize feature info */
1743 note(_("[ユーザー設定ファイルを初期化しています...]", "[Initializing user pref files...]"));
1745 /* Access the "basic" pref file */
1746 strcpy(buf, "pref.prf");
1748 /* Process that file */
1749 process_pref_file(player_ptr, buf);
1751 /* Access the "basic" system pref file */
1752 sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
1754 /* Process that file */
1755 process_pref_file(player_ptr, buf);
1757 note(_("[初期化終了]", "[Initialization complete]"));
1765 static void put_title(void)
1769 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,
1771 sprintf(title, _("変愚蛮怒 %d.%d.%d(%s)", "Hengband %d.%d.%d(%s)"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH,
1773 IS_STABLE_VERSION ? _("安定版", "Stable") : _("開発版", "Developing"));
1774 int col = (80 - strlen(title)) / 2;
1775 col = col < 0 ? 0 : col;
1776 prt(title, VER_INFO_ROW, col);
1781 * @brief サムチェック情報を出力 / Get check sum in string form
1782 * @return サムチェック情報の文字列
1784 concptr get_check_sum(void)
1786 return format("%02x%02x%02x%02x%02x%02x%02x%02x%02x",