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 static void put_title(void);
64 * @brief 各データファイルを読み取るためのパスを取得する
65 * Find the default paths to all of our important sub-directories.
66 * @param path パス保管先の文字列
70 * The purpose of each sub-directory is described in "variable.c".
71 * All of the sub-directories should, by default, be located inside
72 * the main "lib" directory, whose location is very system dependant.
73 * This function takes a writable buffer, initially containing the
74 * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
75 * or a system dependant string, for example, ":lib:". The buffer
76 * must be large enough to contain at least 32 more characters.
77 * Various command line options may allow some of the important
78 * directories to be changed to user-specified directories, most
79 * importantly, the "info" and "user" and "save" directories,
80 * but this is done after this function, see "main.c".
81 * In general, the initial path should end in the appropriate "PATH_SEP"
82 * string. All of the "sub-directory" paths (created below or supplied
83 * by the user) will NOT end in the "PATH_SEP" string, see the special
84 * "path_build()" function in "util.c" for more information.
85 * Mega-Hack -- support fat raw files under NEXTSTEP, using special
86 * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
87 * requiring the directories to be created by hand by the user.
88 * Hack -- first we free all the strings, since this is known
89 * to succeed even if the strings have not been allocated yet,
90 * as long as the variables start out as "NULL". This allows
91 * this function to be called multiple times, for example, to
92 * try several base "path" values until a good one is found.
95 void init_file_paths(char *path)
99 #ifdef PRIVATE_USER_PATH
101 #endif /* PRIVATE_USER_PATH */
103 /*** Free everything ***/
105 /* Free the main path */
106 string_free(ANGBAND_DIR);
108 /* Free the sub-paths */
109 string_free(ANGBAND_DIR_APEX);
110 string_free(ANGBAND_DIR_BONE);
111 string_free(ANGBAND_DIR_DATA);
112 string_free(ANGBAND_DIR_EDIT);
113 string_free(ANGBAND_DIR_SCRIPT);
114 string_free(ANGBAND_DIR_FILE);
115 string_free(ANGBAND_DIR_HELP);
116 string_free(ANGBAND_DIR_INFO);
117 string_free(ANGBAND_DIR_SAVE);
118 string_free(ANGBAND_DIR_USER);
119 string_free(ANGBAND_DIR_XTRA);
121 /*** Prepare the "path" ***/
123 /* Hack -- save the main directory */
124 ANGBAND_DIR = string_make(path);
126 /* Prepare to append to the Base Path */
127 tail = path + strlen(path);
129 /*** Build the sub-directory names ***/
131 /* Build a path name */
132 strcpy(tail, "apex");
133 ANGBAND_DIR_APEX = string_make(path);
135 /* Build a path name */
136 strcpy(tail, "bone");
137 ANGBAND_DIR_BONE = string_make(path);
139 /* Build a path name */
140 strcpy(tail, "data");
141 ANGBAND_DIR_DATA = string_make(path);
143 /* Build a path name */
144 strcpy(tail, "edit");
145 ANGBAND_DIR_EDIT = string_make(path);
147 /* Build a path name */
148 strcpy(tail, "script");
149 ANGBAND_DIR_SCRIPT = string_make(path);
151 /* Build a path name */
152 strcpy(tail, "file");
153 ANGBAND_DIR_FILE = string_make(path);
155 /* Build a path name */
156 strcpy(tail, "help");
157 ANGBAND_DIR_HELP = string_make(path);
159 /* Build a path name */
160 strcpy(tail, "info");
161 ANGBAND_DIR_INFO = string_make(path);
163 /* Build a path name */
164 strcpy(tail, "pref");
165 ANGBAND_DIR_PREF = string_make(path);
167 /* Build a path name */
168 strcpy(tail, "save");
169 ANGBAND_DIR_SAVE = string_make(path);
171 #ifdef PRIVATE_USER_PATH
173 /* Build the path to the user specific directory */
174 path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
176 /* Build a relative path name */
177 ANGBAND_DIR_USER = string_make(buf);
179 #else /* PRIVATE_USER_PATH */
181 /* Build a path name */
182 strcpy(tail, "user");
183 ANGBAND_DIR_USER = string_make(path);
185 #endif /* PRIVATE_USER_PATH */
187 /* Build a path name */
188 strcpy(tail, "xtra");
189 ANGBAND_DIR_XTRA = string_make(path);
194 /* Allow "fat binary" usage with NeXT */
215 /* Use special directory */
218 /* Forget the old path name */
219 string_free(ANGBAND_DIR_DATA);
221 /* Build a new path name */
222 sprintf(tail, "data-%s", next);
223 ANGBAND_DIR_DATA = string_make(path);
233 * Hack -- help give useful error messages
235 int error_idx; /*!< データ読み込み/初期化時に汎用的にエラーコードを保存するグローバル変数 */
236 int error_line; /*!< データ読み込み/初期化時に汎用的にエラー行数を保存するグローバル変数 */
239 * エラーメッセージの名称定義 / Standard error message text
241 concptr err_str[PARSE_ERROR_MAX] =
258 "missing record header",
259 "non-sequential records",
260 "invalid flag specification",
261 "undefined directive",
263 "coordinates out of bounds",
265 "undefined terrain tag",
274 header v_head; /*!< Vault情報のヘッダ構造体 */
275 header f_head; /*!< 地形情報のヘッダ構造体 */
276 header k_head; /*!< ペースアイテム情報のヘッダ構造体 */
277 header a_head; /*!< 固定アーティファクト情報のヘッダ構造体 */
278 header e_head; /*!< アイテムエゴ情報のヘッダ構造体 */
279 header r_head; /*!< モンスター種族情報のヘッダ構造体 */
280 header d_head; /*!< ダンジョン情報のヘッダ構造体 */
281 header s_head; /*!< プレイヤー職業技能情報のヘッダ構造体 */
282 header m_head; /*!< プレイヤー職業魔法情報のヘッダ構造体 */
284 #ifdef CHECK_MODIFICATION_TIME
287 * @brief テキストファイルとrawファイルの更新時刻を比較する
288 * Find the default paths to all of our important sub-directories.
289 * @param fd ファイルディスクリプタ
290 * @param template_file ファイル名
291 * @return テキストの方が新しいか、rawファイルがなく更新の必要がある場合-1、更新の必要がない場合0。
293 static errr check_modification_date(int fd, concptr template_file)
295 struct stat txt_stat, raw_stat;
297 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, template_file);
299 /* Access stats on text file */
300 if (stat(buf, &txt_stat))
305 /* Access stats on raw file */
306 if (fstat(fd, &raw_stat))
311 /* Ensure text file is not newer than raw file */
312 if (txt_stat.st_mtime > raw_stat.st_mtime)
320 #endif /* CHECK_MODIFICATION_TIME */
322 /*** Initialize from binary image files ***/
325 * @brief rawファイルからのデータの読み取り処理
326 * Initialize the "*_info" array, by parsing a binary "image" file
327 * @param fd ファイルディスクリプタ
328 * @param head rawファイルのヘッダ
331 static errr init_info_raw(int fd, header *head)
335 /* Read and Verify the header */
336 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
337 (test.v_major != head->v_major) ||
338 (test.v_minor != head->v_minor) ||
339 (test.v_patch != head->v_patch) ||
340 (test.info_num != head->info_num) ||
341 (test.info_len != head->info_len) ||
342 (test.head_size != head->head_size) ||
343 (test.info_size != head->info_size))
349 /* Accept the header */
352 /* Allocate the "*_info" array */
353 C_MAKE(head->info_ptr, head->info_size, char);
355 /* Read the "*_info" array */
356 fd_read(fd, head->info_ptr, head->info_size);
360 /* Allocate the "*_name" array */
361 C_MAKE(head->name_ptr, head->name_size, char);
363 /* Read the "*_name" array */
364 fd_read(fd, head->name_ptr, head->name_size);
369 /* Allocate the "*_text" array */
370 C_MAKE(head->text_ptr, head->text_size, char);
372 /* Read the "*_text" array */
373 fd_read(fd, head->text_ptr, head->text_size);
378 /* Allocate the "*_tag" array */
379 C_MAKE(head->tag_ptr, head->tag_size, char);
381 /* Read the "*_tag" array */
382 fd_read(fd, head->tag_ptr, head->tag_size);
392 * Initialize the header of an *_info.raw file.
393 * @param head rawファイルのヘッダ
398 static void init_header(header *head, IDX num, int len)
400 /* Save the "version" */
401 head->v_major = FAKE_VER_MAJOR;
402 head->v_minor = FAKE_VER_MINOR;
403 head->v_patch = FAKE_VER_PATCH;
406 /* Save the "record" information */
407 head->info_num = (IDX)num;
408 head->info_len = len;
410 /* Save the size of "*_head" and "*_info" */
411 head->head_size = sizeof(header);
412 head->info_size = head->info_num * head->info_len;
417 * todo プリプロがゴミすぎて整理不可能
419 * Initialize the "*_info" array
420 * @param filename ファイル名(拡張子txt/raw)
421 * @param head 処理に用いるヘッダ構造体
422 * @param info データ保管先の構造体ポインタ
423 * @param name 名称用可変文字列の保管先
424 * @param text テキスト用可変文字列の保管先
425 * @param tag タグ用可変文字列の保管先
428 * Note that we let each entry have a unique "name" and "text" string,
429 * even if the string happens to be empty (everyone has a unique '\0').
431 static errr init_info(concptr filename, header *head, void **info, char **name, char **text, char **tag)
438 /*** Load the binary image file ***/
439 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
441 /* Attempt to open the "raw" file */
442 int fd = fd_open(buf, O_RDONLY);
444 /* Process existing "raw" file */
448 #ifdef CHECK_MODIFICATION_TIME
450 err = check_modification_date(fd, format("%s.txt", filename));
452 #endif /* CHECK_MODIFICATION_TIME */
454 /* Attempt to parse the "raw" file */
456 err = init_info_raw(fd, head);
460 /* Do we have to parse the *.txt file? */
461 BIT_FLAGS file_permission = 0644;
464 /*** Make the fake arrays ***/
466 /* Allocate the "*_info" array */
467 C_MAKE(head->info_ptr, head->info_size, char);
469 /* Hack -- make "fake" arrays */
470 if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
471 if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
472 if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
474 if (info) (*info) = head->info_ptr;
475 if (name) (*name) = head->name_ptr;
476 if (text) (*text) = head->text_ptr;
477 if (tag) (*tag) = head->tag_ptr;
479 /*** Load the ascii template file ***/
481 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
482 fp = my_fopen(buf, "r");
485 if (!fp) quit(format(_("'%s.txt'ファイルをオープンできません。", "Cannot open '%s.txt' file."), filename));
488 err = init_info_txt(fp, buf, head, head->parse_info_txt);
498 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "未知の");
500 msg_format("'%s.txt'ファイルの %d 行目にエラー。", filename, error_line);
501 msg_format("レコード %d は '%s' エラーがあります。", error_idx, oops);
502 msg_format("構文 '%s'。", buf);
506 quit(format("'%s.txt'ファイルにエラー", filename));
509 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
511 msg_format("Error %d at line %d of '%s.txt'.", err, error_line, filename);
512 msg_format("Record %d contains a '%s' error.", error_idx, oops);
513 msg_format("Parsing '%s'.", buf);
517 quit(format("Error in '%s.txt' file.", filename));
523 /*** Make final retouch on fake tags ***/
527 (*head->retouch)(head);
531 /*** Dump the binary image file ***/
533 /* File type is "DATA" */
534 FILE_TYPE(FILE_TYPE_DATA);
535 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
538 /* Grab permissions */
541 /* Kill the old file */
544 /* Attempt to create the raw file */
545 fd = fd_make(buf, file_permission);
547 /* Drop permissions */
550 /* Dump to the file */
554 fd_write(fd, (concptr)(head), head->head_size);
556 /* Dump the "*_info" array */
557 fd_write(fd, head->info_ptr, head->info_size);
559 /* Dump the "*_name" array */
560 fd_write(fd, head->name_ptr, head->name_size);
562 /* Dump the "*_text" array */
563 fd_write(fd, head->text_ptr, head->text_size);
565 /* Dump the "*_tag" array */
566 fd_write(fd, head->tag_ptr, head->tag_size);
572 /*** Kill the fake arrays ***/
574 /* Free the "*_info" array */
575 C_KILL(head->info_ptr, head->info_size, char);
577 /* Hack -- Free the "fake" arrays */
578 if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char);
579 if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char);
580 if (tag) C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char);
582 /*** Load the binary image file ***/
583 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
585 /* Attempt to open the "raw" file */
586 fd = fd_open(buf, O_RDONLY);
588 /* Process existing "raw" file */
589 if (fd < 0) quit(format(_("'%s_j.raw'ファイルをロードできません。", "Cannot load '%s.raw' file."), filename));
591 /* Attempt to parse the "raw" file */
592 err = init_info_raw(fd, head);
596 if (err) quit(format(_("'%s_j.raw'ファイルを解析できません。", "Cannot parse '%s.raw' file."), filename));
599 if (info) *info = head->info_ptr;
600 if (name) *name = head->name_ptr;
601 if (text) *text = head->text_ptr;
602 if (tag) *tag = head->tag_ptr;
608 * @brief 地形情報読み込みのメインルーチン /
609 * Initialize the "f_info" array
612 static errr init_f_info(void)
614 /* Init the header */
615 init_header(&f_head, max_f_idx, sizeof(feature_type));
617 /* Save a pointer to the parsing function */
618 f_head.parse_info_txt = parse_f_info;
620 /* Save a pointer to the retouch fake tags */
621 f_head.retouch = retouch_f_info;
623 return init_info("f_info", &f_head,
624 (void*)&f_info, &f_name, NULL, &f_tag);
629 * @brief ベースアイテム情報読み込みのメインルーチン /
630 * Initialize the "k_info" array
633 static errr init_k_info(void)
635 /* Init the header */
636 init_header(&k_head, max_k_idx, sizeof(object_kind));
638 /* Save a pointer to the parsing function */
639 k_head.parse_info_txt = parse_k_info;
641 return init_info("k_info", &k_head,
642 (void*)&k_info, &k_name, &k_text, NULL);
647 * @brief 固定アーティファクト情報読み込みのメインルーチン /
648 * Initialize the "a_info" array
651 static errr init_a_info(void)
653 /* Init the header */
654 init_header(&a_head, max_a_idx, sizeof(artifact_type));
656 /* Save a pointer to the parsing function */
657 a_head.parse_info_txt = parse_a_info;
659 return init_info("a_info", &a_head,
660 (void*)&a_info, &a_name, &a_text, NULL);
665 * @brief 固定アーティファクト情報読み込みのメインルーチン /
666 * Initialize the "e_info" array
669 static errr init_e_info(void)
671 /* Init the header */
672 init_header(&e_head, max_e_idx, sizeof(ego_item_type));
674 /* Save a pointer to the parsing function */
675 e_head.parse_info_txt = parse_e_info;
677 return init_info("e_info", &e_head,
678 (void*)&e_info, &e_name, &e_text, NULL);
683 * @brief モンスター種族情報読み込みのメインルーチン /
684 * Initialize the "r_info" array
687 static errr init_r_info(void)
689 /* Init the header */
690 init_header(&r_head, max_r_idx, sizeof(monster_race));
692 /* Save a pointer to the parsing function */
693 r_head.parse_info_txt = parse_r_info;
695 return init_info("r_info", &r_head,
696 (void*)&r_info, &r_name, &r_text, NULL);
701 * @brief ダンジョン情報読み込みのメインルーチン /
702 * Initialize the "d_info" array
705 static errr init_d_info(void)
707 /* Init the header */
708 init_header(&d_head, current_world_ptr->max_d_idx, sizeof(dungeon_type));
710 /* Save a pointer to the parsing function */
711 d_head.parse_info_txt = parse_d_info;
713 return init_info("d_info", &d_head,
714 (void*)&d_info, &d_name, &d_text, NULL);
719 * @brief Vault情報読み込みのメインルーチン /
720 * Initialize the "v_info" array
723 * Note that we let each entry have a unique "name" and "text" string,
724 * even if the string happens to be empty (everyone has a unique '\0').
726 errr init_v_info(void)
728 /* Init the header */
729 init_header(&v_head, max_v_idx, sizeof(vault_type));
731 /* Save a pointer to the parsing function */
732 v_head.parse_info_txt = parse_v_info;
734 return init_info("v_info", &v_head,
735 (void*)&v_info, &v_name, &v_text, NULL);
740 * @brief 職業技能情報読み込みのメインルーチン /
741 * Initialize the "s_info" array
744 static errr init_s_info(void)
746 /* Init the header */
747 init_header(&s_head, MAX_CLASS, sizeof(skill_table));
749 /* Save a pointer to the parsing function */
750 s_head.parse_info_txt = parse_s_info;
752 return init_info("s_info", &s_head,
753 (void*)&s_info, NULL, NULL, NULL);
758 * @brief 職業魔法情報読み込みのメインルーチン /
759 * Initialize the "m_info" array
762 static errr init_m_info(void)
764 /* Init the header */
765 init_header(&m_head, MAX_CLASS, sizeof(player_magic));
767 /* Save a pointer to the parsing function */
768 m_head.parse_info_txt = parse_m_info;
770 return init_info("m_info", &m_head,
771 (void*)&m_info, NULL, NULL, NULL);
776 * @brief 基本情報読み込みのメインルーチン /
777 * Initialize misc. values
778 * @param player_ptr プレーヤーへの参照ポインタ
781 static errr init_misc(player_type *player_ptr)
783 return process_dungeon_file(player_ptr, "misc.txt", 0, 0, 0, 0);
788 * @brief 町情報読み込みのメインルーチン /
789 * Initialize town array
792 static errr init_towns(void)
794 /* Allocate the towns */
795 C_MAKE(town_info, max_towns, town_type);
797 for (int i = 1; i < max_towns; i++)
799 /*** Prepare the Stores ***/
801 /* Allocate the stores */
802 C_MAKE(town_info[i].store, MAX_STORES, store_type);
804 /* Fill in each store */
805 for (int j = 0; j < MAX_STORES; j++)
807 /* Access the store */
808 store_type *st_ptr = &town_info[i].store[j];
810 if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME)) continue;
812 /* Assume full stock */
815 * 我が家が 20 ページまで使える隠し機能のための準備。
816 * オプションが有効でもそうでなくても一応スペースを作っておく。
820 st_ptr->stock_size = (STORE_INVEN_MAX * 10);
822 else if (j == STORE_MUSEUM)
824 st_ptr->stock_size = (STORE_INVEN_MAX * 50);
828 st_ptr->stock_size = STORE_INVEN_MAX;
831 /* Allocate the stock */
832 C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type);
834 /* No table for the black market or home */
835 if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM)) continue;
837 /* Assume full table */
838 st_ptr->table_size = STORE_CHOICES;
840 /* Allocate the stock */
841 C_MAKE(st_ptr->table, st_ptr->table_size, s16b);
843 /* Scan the choices */
844 for (int k = 0; k < STORE_CHOICES; k++)
846 KIND_OBJECT_IDX k_idx;
848 /* Extract the tval/sval codes */
849 int tv = store_table[j][k][0];
850 int sv = store_table[j][k][1];
853 for (k_idx = 1; k_idx < max_k_idx; k_idx++)
855 object_kind *k_ptr = &k_info[k_idx];
858 if ((k_ptr->tval == tv) && (k_ptr->sval == sv)) break;
862 if (k_idx == max_k_idx) continue;
864 /* Add that item index to the table */
865 st_ptr->table[st_ptr->table_num++] = k_idx;
874 * @brief 店情報初期化のメインルーチン /
875 * Initialize buildings
878 errr init_buildings(void)
880 for (int i = 0; i < MAX_BLDG; i++)
882 building[i].name[0] = '\0';
883 building[i].owner_name[0] = '\0';
884 building[i].owner_race[0] = '\0';
886 for (int j = 0; j < 8; j++)
888 building[i].act_names[j][0] = '\0';
889 building[i].member_costs[j] = 0;
890 building[i].other_costs[j] = 0;
891 building[i].letters[j] = 0;
892 building[i].actions[j] = 0;
893 building[i].action_restr[j] = 0;
896 for (int j = 0; j < MAX_CLASS; j++)
898 building[i].member_class[j] = 0;
901 for (int j = 0; j < MAX_RACES; j++)
903 building[i].member_race[j] = 0;
906 for (int j = 0; j < MAX_MAGIC + 1; j++)
908 building[i].member_realm[j] = 0;
917 * @brief クエスト情報初期化のメインルーチン /
918 * Initialize quest array
921 static errr init_quests(void)
923 /* Allocate the quests */
924 C_MAKE(quest, max_q_idx, quest_type);
926 /* Set all quest to "untaken" */
927 for (int i = 0; i < max_q_idx; i++)
929 quest[i].status = QUEST_STATUS_UNTAKEN;
935 /*! 地形タグ情報から地形IDを得られなかった場合にTRUEを返すグローバル変数 */
936 static bool feat_tag_is_not_found = FALSE;
939 * @brief 地形タグからIDを得る /
940 * Initialize quest array
943 s16b f_tag_to_index_in_init(concptr str)
945 FEAT_IDX feat = f_tag_to_index(str);
947 if (feat < 0) feat_tag_is_not_found = TRUE;
954 * @brief 地形の汎用定義をタグを通じて取得する /
955 * Initialize feature variables
958 static errr init_feat_variables(void)
960 feat_none = f_tag_to_index_in_init("NONE");
962 feat_floor = f_tag_to_index_in_init("FLOOR");
963 feat_glyph = f_tag_to_index_in_init("GLYPH");
964 feat_explosive_rune = f_tag_to_index_in_init("EXPLOSIVE_RUNE");
965 feat_mirror = f_tag_to_index_in_init("MIRROR");
967 feat_door[DOOR_DOOR].open = f_tag_to_index_in_init("OPEN_DOOR");
968 feat_door[DOOR_DOOR].broken = f_tag_to_index_in_init("BROKEN_DOOR");
969 feat_door[DOOR_DOOR].closed = f_tag_to_index_in_init("CLOSED_DOOR");
973 for (i = 1; i < MAX_LJ_DOORS; i++)
975 s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
977 feat_door[DOOR_DOOR].locked[i - 1] = door;
980 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
981 feat_door[DOOR_DOOR].num_locked = i - 1;
984 for (i = 0; i < MAX_LJ_DOORS; i++)
986 s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
988 feat_door[DOOR_DOOR].jammed[i] = door;
991 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
992 feat_door[DOOR_DOOR].num_jammed = i;
995 feat_door[DOOR_GLASS_DOOR].open = f_tag_to_index_in_init("OPEN_GLASS_DOOR");
996 feat_door[DOOR_GLASS_DOOR].broken = f_tag_to_index_in_init("BROKEN_GLASS_DOOR");
997 feat_door[DOOR_GLASS_DOOR].closed = f_tag_to_index_in_init("CLOSED_GLASS_DOOR");
999 /* Locked glass doors */
1000 for (i = 1; i < MAX_LJ_DOORS; i++)
1002 s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
1003 if (door < 0) break;
1004 feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door;
1007 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1008 feat_door[DOOR_GLASS_DOOR].num_locked = i - 1;
1010 /* Jammed glass doors */
1011 for (i = 0; i < MAX_LJ_DOORS; i++)
1013 s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
1014 if (door < 0) break;
1015 feat_door[DOOR_GLASS_DOOR].jammed[i] = door;
1018 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1019 feat_door[DOOR_GLASS_DOOR].num_jammed = i;
1022 feat_door[DOOR_CURTAIN].open = f_tag_to_index_in_init("OPEN_CURTAIN");
1023 feat_door[DOOR_CURTAIN].broken = feat_door[DOOR_CURTAIN].open;
1024 feat_door[DOOR_CURTAIN].closed = f_tag_to_index_in_init("CLOSED_CURTAIN");
1025 feat_door[DOOR_CURTAIN].locked[0] = feat_door[DOOR_CURTAIN].closed;
1026 feat_door[DOOR_CURTAIN].num_locked = 1;
1027 feat_door[DOOR_CURTAIN].jammed[0] = feat_door[DOOR_CURTAIN].closed;
1028 feat_door[DOOR_CURTAIN].num_jammed = 1;
1031 feat_up_stair = f_tag_to_index_in_init("UP_STAIR");
1032 feat_down_stair = f_tag_to_index_in_init("DOWN_STAIR");
1033 feat_entrance = f_tag_to_index_in_init("ENTRANCE");
1036 init_normal_traps();
1039 feat_trap_open = f_tag_to_index_in_init("TRAP_OPEN");
1040 feat_trap_armageddon = f_tag_to_index_in_init("TRAP_ARMAGEDDON");
1041 feat_trap_piranha = f_tag_to_index_in_init("TRAP_PIRANHA");
1044 feat_rubble = f_tag_to_index_in_init("RUBBLE");
1047 feat_magma_vein = f_tag_to_index_in_init("MAGMA_VEIN");
1048 feat_quartz_vein = f_tag_to_index_in_init("QUARTZ_VEIN");
1051 feat_granite = f_tag_to_index_in_init("GRANITE");
1052 feat_permanent = f_tag_to_index_in_init("PERMANENT");
1055 feat_glass_floor = f_tag_to_index_in_init("GLASS_FLOOR");
1058 feat_glass_wall = f_tag_to_index_in_init("GLASS_WALL");
1059 feat_permanent_glass_wall = f_tag_to_index_in_init("PERMANENT_GLASS_WALL");
1062 feat_pattern_start = f_tag_to_index_in_init("PATTERN_START");
1063 feat_pattern_1 = f_tag_to_index_in_init("PATTERN_1");
1064 feat_pattern_2 = f_tag_to_index_in_init("PATTERN_2");
1065 feat_pattern_3 = f_tag_to_index_in_init("PATTERN_3");
1066 feat_pattern_4 = f_tag_to_index_in_init("PATTERN_4");
1067 feat_pattern_end = f_tag_to_index_in_init("PATTERN_END");
1068 feat_pattern_old = f_tag_to_index_in_init("PATTERN_OLD");
1069 feat_pattern_exit = f_tag_to_index_in_init("PATTERN_EXIT");
1070 feat_pattern_corrupted = f_tag_to_index_in_init("PATTERN_CORRUPTED");
1073 feat_black_market = f_tag_to_index_in_init("BLACK_MARKET");
1074 feat_town = f_tag_to_index_in_init("TOWN");
1077 feat_deep_water = f_tag_to_index_in_init("DEEP_WATER");
1078 feat_shallow_water = f_tag_to_index_in_init("SHALLOW_WATER");
1079 feat_deep_lava = f_tag_to_index_in_init("DEEP_LAVA");
1080 feat_shallow_lava = f_tag_to_index_in_init("SHALLOW_LAVA");
1081 feat_heavy_cold_zone = f_tag_to_index_in_init("HEAVY_COLD_ZONE");
1082 feat_cold_zone = f_tag_to_index_in_init("COLD_ZONE");
1083 feat_heavy_electrical_zone = f_tag_to_index_in_init("HEAVY_ELECTRICAL_ZONE");
1084 feat_electrical_zone = f_tag_to_index_in_init("ELECTRICAL_ZONE");
1085 feat_deep_acid_puddle = f_tag_to_index_in_init("DEEP_ACID_PUDDLE");
1086 feat_shallow_acid_puddle = f_tag_to_index_in_init("SHALLOW_ACID_PUDDLE");
1087 feat_deep_poisonous_puddle = f_tag_to_index_in_init("DEEP_POISONOUS_PUDDLE");
1088 feat_shallow_poisonous_puddle = f_tag_to_index_in_init("SHALLOW_POISONOUS_PUDDLE");
1089 feat_dirt = f_tag_to_index_in_init("DIRT");
1090 feat_grass = f_tag_to_index_in_init("GRASS");
1091 feat_flower = f_tag_to_index_in_init("FLOWER");
1092 feat_brake = f_tag_to_index_in_init("BRAKE");
1093 feat_tree = f_tag_to_index_in_init("TREE");
1094 feat_mountain = f_tag_to_index_in_init("MOUNTAIN");
1095 feat_swamp = f_tag_to_index_in_init("SWAMP");
1097 feat_undetected = f_tag_to_index_in_init("UNDETECTED");
1099 init_wilderness_terrains();
1100 return feat_tag_is_not_found ? PARSE_ERROR_UNDEFINED_TERRAIN_TAG : 0;
1105 * @brief その他の初期情報更新 /
1106 * Initialize some other arrays
1109 static errr init_other(player_type *player_ptr)
1111 player_ptr->current_floor_ptr = &floor_info; // TODO:本当はこんなところで初期化したくない
1112 floor_type *floor_ptr = player_ptr->current_floor_ptr;
1114 /*** Prepare the "dungeon" information ***/
1116 /* Allocate and Wipe the object list */
1117 C_MAKE(floor_ptr->o_list, current_world_ptr->max_o_idx, object_type);
1119 /* Allocate and Wipe the monster list */
1120 C_MAKE(floor_ptr->m_list, current_world_ptr->max_m_idx, monster_type);
1122 /* Allocate and Wipe the monster process list */
1123 for (int i = 0; i < MAX_MTIMED; i++)
1125 C_MAKE(floor_ptr->mproc_list[i], current_world_ptr->max_m_idx, s16b);
1128 /* Allocate and Wipe the max dungeon level */
1129 C_MAKE(max_dlv, current_world_ptr->max_d_idx, DEPTH);
1131 for (int i = 0; i < MAX_HGT; i++)
1133 C_MAKE(floor_ptr->grid_array[i], MAX_WID, grid_type);
1136 /*** Prepare the various "bizarre" arrays ***/
1138 /* Macro variables */
1139 C_MAKE(macro__pat, MACRO_MAX, concptr);
1140 C_MAKE(macro__act, MACRO_MAX, concptr);
1141 C_MAKE(macro__cmd, MACRO_MAX, bool);
1143 /* Macro action buffer */
1144 C_MAKE(macro__buf, 1024, char);
1146 /* Quark variables */
1149 /* Message variables */
1150 C_MAKE(message__ptr, MESSAGE_MAX, u32b);
1151 C_MAKE(message__buf, MESSAGE_BUF, char);
1153 /* Hack -- No messages yet */
1154 message__tail = MESSAGE_BUF;
1156 /*** Prepare the options ***/
1158 /* Scan the options */
1159 for (int i = 0; option_info[i].o_desc; i++)
1161 int os = option_info[i].o_set;
1162 int ob = option_info[i].o_bit;
1164 /* Set the "default" options */
1165 if (option_info[i].o_var)
1168 option_mask[os] |= (1L << ob);
1171 if (option_info[i].o_norm)
1174 option_flag[os] |= (1L << ob);
1178 option_flag[os] &= ~(1L << ob);
1183 /* Analyze the windows */
1184 for (int n = 0; n < 8; n++)
1186 /* Analyze the options */
1187 for (int i = 0; i < 32; i++)
1190 if (window_flag_desc[i])
1193 window_mask[n] |= (1L << i);
1199 * Set the "default" window flags
1200 * Window 1 : Display messages
1201 * Window 2 : Display inven/equip
1203 window_flag[1] = 1L << A_MAX;
1204 window_flag[2] = 1L << 0;
1206 /*** Pre-allocate space for the "format()" buffer ***/
1208 /* Hack -- Just call the "format()" function */
1209 (void)format("%s (%s).", "Mr.Hoge", MAINTAINER);
1215 * @brief オブジェクト配列を初期化する /
1216 * Initialize some other arrays
1219 static errr init_object_alloc(void)
1221 s16b aux[MAX_DEPTH];
1222 (void)C_WIPE(&aux, MAX_DEPTH, s16b);
1224 s16b num[MAX_DEPTH];
1225 (void)C_WIPE(&num, MAX_DEPTH, s16b);
1227 /* Free the old "alloc_kind_table" (if it exists) */
1228 if (alloc_kind_table)
1230 C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
1233 /* Size of "alloc_kind_table" */
1234 alloc_kind_size = 0;
1236 /* Scan the objects */
1237 for (int i = 1; i < max_k_idx; i++)
1242 /* Scan allocation pairs */
1243 for (int j = 0; j < 4; j++)
1245 /* Count the "legal" entries */
1246 if (k_ptr->chance[j])
1248 /* Count the entries */
1251 /* Group by level */
1252 num[k_ptr->locale[j]]++;
1257 /* Collect the level indexes */
1258 for (int i = 1; i < MAX_DEPTH; i++)
1260 /* Group by level */
1261 num[i] += num[i - 1];
1264 if (!num[0]) quit(_("町のアイテムがない!", "No town objects!"));
1266 /*** Initialize object allocation info ***/
1268 /* Allocate the alloc_kind_table */
1269 C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
1271 /* Access the table entry */
1273 table = alloc_kind_table;
1275 /* Scan the objects */
1276 for (int i = 1; i < max_k_idx; i++)
1281 /* Scan allocation pairs */
1282 for (int j = 0; j < 4; j++)
1284 /* Count the "legal" entries */
1285 if (k_ptr->chance[j] == 0) continue;
1287 /* Extract the base level */
1288 int x = k_ptr->locale[j];
1290 /* Extract the base probability */
1291 int p = (100 / k_ptr->chance[j]);
1293 /* Skip entries preceding our locale */
1294 int y = (x > 0) ? num[x - 1] : 0;
1296 /* Skip previous entries at this locale */
1299 /* Load the entry */
1300 table[z].index = (KIND_OBJECT_IDX)i;
1301 table[z].level = (DEPTH)x;
1302 table[z].prob1 = (PROB)p;
1303 table[z].prob2 = (PROB)p;
1304 table[z].prob3 = (PROB)p;
1306 /* Another entry complete for this locale */
1316 * @brief モンスター配列と生成テーブルを初期化する /
1317 * Initialize some other arrays
1320 static errr init_alloc(void)
1322 monster_race *r_ptr;
1328 /* Allocate the "r_info" array */
1329 C_MAKE(elements, max_r_idx, tag_type);
1331 /* Scan the monsters */
1332 for (int i = 1; i < max_r_idx; i++)
1334 elements[i].tag = r_info[i].level;
1335 elements[i].index = i;
1338 tag_sort(elements, max_r_idx);
1340 /*** Initialize monster allocation info ***/
1342 /* Size of "alloc_race_table" */
1343 alloc_race_size = max_r_idx;
1345 /* Allocate the alloc_race_table */
1346 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1348 /* Scan the monsters */
1349 for (int i = 1; i < max_r_idx; i++)
1351 /* Get the i'th race */
1352 r_ptr = &r_info[elements[i].index];
1354 /* Count valid pairs */
1355 if (r_ptr->rarity == 0) continue;
1357 /* Extract the base level */
1358 int x = r_ptr->level;
1360 /* Extract the base probability */
1361 int p = (100 / r_ptr->rarity);
1363 /* Load the entry */
1364 alloc_race_table[i].index = (KIND_OBJECT_IDX)elements[i].index;
1365 alloc_race_table[i].level = (DEPTH)x;
1366 alloc_race_table[i].prob1 = (PROB)p;
1367 alloc_race_table[i].prob2 = (PROB)p;
1368 alloc_race_table[i].prob3 = (PROB)p;
1371 /* Free the "r_info" array */
1372 C_KILL(elements, max_r_idx, tag_type);
1374 #else /* SORT_R_INFO */
1377 s16b num[MAX_DEPTH];
1378 s16b aux[MAX_DEPTH];
1380 /*** Analyze monster allocation info ***/
1382 /* Clear the "aux" array */
1383 C_WIPE(&aux, MAX_DEPTH, s16b);
1385 /* Clear the "num" array */
1386 C_WIPE(&num, MAX_DEPTH, s16b);
1388 /* Size of "alloc_race_table" */
1389 alloc_race_size = 0;
1391 /* Scan the monsters */
1392 for (int i = 1; i < max_r_idx; i++)
1394 /* Get the i'th race */
1397 /* Legal monsters */
1400 /* Count the entries */
1403 /* Group by level */
1404 num[r_ptr->level]++;
1408 /* Collect the level indexes */
1409 for (int i = 1; i < MAX_DEPTH; i++)
1411 /* Group by level */
1412 num[i] += num[i - 1];
1414 if (!num[0]) quit(_("町のモンスターがない!", "No town monsters!"));
1416 /*** Initialize monster allocation info ***/
1418 /* Allocate the alloc_race_table */
1419 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1421 /* Access the table entry */
1422 table = alloc_race_table;
1424 /* Scan the monsters */
1425 for (int i = 1; i < max_r_idx; i++)
1427 /* Get the i'th race */
1430 /* Count valid pairs */
1435 /* Extract the base level */
1438 /* Extract the base probability */
1439 p = (100 / r_ptr->rarity);
1441 /* Skip entries preceding our locale */
1442 y = (x > 0) ? num[x - 1] : 0;
1444 /* Skip previous entries at this locale */
1447 /* Load the entry */
1454 /* Another entry complete for this locale */
1459 #endif /* SORT_R_INFO */
1461 (void)init_object_alloc();
1467 * @brief 画面左下にシステムメッセージを表示する /
1468 * Hack -- take notes on line 23
1471 static void note(concptr str)
1473 Term_erase(0, 23, 255);
1474 Term_putstr(20, 23, -1, TERM_WHITE, str);
1480 * @brief 全ゲームデータ読み込みのサブルーチン /
1481 * Hack -- Explain a broken "lib" folder and quit (see below).
1485 * This function is "messy" because various things
1486 * may or may not be initialized, but the "plog()" and "quit()"
1487 * functions are "supposed" to work under any conditions.
1490 static void init_angband_aux(concptr why)
1496 plog("'lib'ディレクトリが存在しないか壊れているようです。");
1499 plog("ひょっとするとアーカイブが正しく解凍されていないのかもしれません。");
1502 plog("該当する'README'ファイルを読んで確認してみて下さい。");
1504 /* Quit with error */
1508 plog("The 'lib' directory is probably missing or broken.");
1511 plog("Perhaps the archive was not extracted correctly.");
1514 plog("See the 'README' file for more information.");
1516 /* Quit with error */
1517 quit("Fatal Error.");
1524 * @brief 全ゲームデータ読み込みのメインルーチン /
1525 * Hack -- main Angband initialization entry point
1529 * This function is "messy" because various things
1530 * may or may not be initialized, but the "plog()" and "quit()"
1531 * functions are "supposed" to work under any conditions.
1532 * Verify some files, display the "news.txt" file, create
1533 * the high score file, initialize all internal arrays, and
1534 * load the basic "user pref files".
1535 * Be very careful to keep track of the order in which things
1536 * are initialized, in particular, the only thing *known* to
1537 * be available when this function is called is the "z-term.c"
1538 * package, and that may not be fully initialized until the
1539 * end of this function, when the default "user pref files"
1540 * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
1541 * Note that this function attempts to verify the "news" file,
1542 * and the game aborts (cleanly) on failure, since without the
1543 * "news" file, it is likely that the "lib" folder has not been
1544 * correctly located. Otherwise, the news file is displayed for
1546 * Note that this function attempts to verify (or create) the
1547 * "high score" file, and the game aborts (cleanly) on failure,
1548 * since one of the most common "extraction" failures involves
1549 * failing to extract all sub-directories (even empty ones), such
1550 * as by failing to use the "-d" option of "pkunzip", or failing
1551 * to use the "save empty directories" option with "Compact Pro".
1552 * This error will often be caught by the "high score" creation
1553 * code below, since the "lib/apex" directory, being empty in the
1554 * standard distributions, is most likely to be "lost", making it
1555 * impossible to create the high score file.
1556 * Note that various things are initialized by this function,
1557 * including everything that was once done by "init_some_arrays".
1558 * This initialization involves the parsing of special files
1559 * in the "lib/data" and sometimes the "lib/edit" directories.
1560 * Note that the "template" files are initialized first, since they
1561 * often contain errors. This means that macros and message recall
1562 * and things like that are not available until after they are done.
1563 * We load the default "user pref files" here in case any "color"
1564 * changes are needed before character creation.
1565 * Note that the "graf-xxx.prf" file must be loaded separately,
1566 * if needed, in the first (?) pass through "TERM_XTRA_REACT".
1569 void init_angband(player_type *player_ptr)
1571 /*** Verify the "news" file ***/
1573 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1575 /* Attempt to open the file */
1576 int fd = fd_open(buf, O_RDONLY);
1583 sprintf(why, _("'%s'ファイルにアクセスできません!", "Cannot access the '%s' file!"), buf);
1585 /* Crash and burn */
1586 init_angband_aux(why);
1591 /*** Display the "news" file ***/
1593 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1595 /* Open the News file */
1597 fp = my_fopen(buf, "r");
1602 /* Dump the file to the screen */
1604 while (0 == my_fgets(fp, buf, sizeof(buf)))
1606 /* Display and advance */
1607 Term_putstr(0, i++, -1, TERM_WHITE, buf);
1615 /*** Verify (or create) the "high score" file ***/
1616 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
1618 /* Attempt to open the high score file */
1619 fd = fd_open(buf, O_RDONLY);
1621 BIT_FLAGS file_permission = 0664;
1624 /* File type is "DATA" */
1625 FILE_TYPE(FILE_TYPE_DATA);
1627 /* Grab permissions */
1630 /* Create a new high score file */
1631 fd = fd_make(buf, file_permission);
1633 /* Drop permissions */
1641 sprintf(why, _("'%s'ファイルを作成できません!", "Cannot create the '%s' file!"), buf);
1643 /* Crash and burn */
1644 init_angband_aux(why);
1652 /*** Initialize some arrays ***/
1654 /* Initialize misc. values */
1655 note(_("[変数を初期化しています...(その他)", "[Initializing values... (misc)]"));
1656 if (init_misc(player_ptr)) quit(_("その他の変数を初期化できません", "Cannot initialize misc. values"));
1658 /* Initialize feature info */
1660 note("[データの初期化中... (地形)]");
1661 if (init_f_info()) quit("地形初期化不能");
1662 if (init_feat_variables()) quit("地形初期化不能");
1664 note("[Initializing arrays... (features)]");
1665 if (init_f_info()) quit("Cannot initialize features");
1666 if (init_feat_variables()) quit("Cannot initialize features");
1669 /* Initialize object info */
1670 note(_("[データの初期化中... (アイテム)]", "[Initializing arrays... (objects)]"));
1671 if (init_k_info()) quit(_("アイテム初期化不能", "Cannot initialize objects"));
1673 /* Initialize artifact info */
1674 note(_("[データの初期化中... (伝説のアイテム)]", "[Initializing arrays... (artifacts)]"));
1675 if (init_a_info()) quit(_("伝説のアイテム初期化不能", "Cannot initialize artifacts"));
1678 /* Initialize ego-item info */
1679 note(_("[データの初期化中... (名のあるアイテム)]", "[Initializing arrays... (ego-items)]"));
1680 if (init_e_info()) quit(_("名のあるアイテム初期化不能", "Cannot initialize ego-items"));
1683 /* Initialize monster info */
1684 note(_("[データの初期化中... (モンスター)]", "[Initializing arrays... (monsters)]"));
1685 if (init_r_info()) quit(_("モンスター初期化不能", "Cannot initialize monsters"));
1688 /* Initialize dungeon info */
1689 note(_("[データの初期化中... (ダンジョン)]", "[Initializing arrays... (dungeon)]"));
1690 if (init_d_info()) quit(_("ダンジョン初期化不能", "Cannot initialize dungeon"));
1692 for (int i = 1; i < current_world_ptr->max_d_idx; i++)
1693 if (d_info[i].final_guardian)
1694 r_info[d_info[i].final_guardian].flags7 |= RF7_GUARDIAN;
1697 /* Initialize magic info */
1698 note(_("[データの初期化中... (魔法)]", "[Initializing arrays... (magic)]"));
1699 if (init_m_info()) quit(_("魔法初期化不能", "Cannot initialize magic"));
1701 /* Initialize weapon_exp info */
1702 note(_("[データの初期化中... (熟練度)]", "[Initializing arrays... (skill)]"));
1703 if (init_s_info()) quit(_("熟練度初期化不能", "Cannot initialize skill"));
1705 /* Initialize wilderness array */
1706 note(_("[配列を初期化しています... (荒野)]", "[Initializing arrays... (wilderness)]"));
1708 if (init_wilderness()) quit(_("荒野を初期化できません", "Cannot initialize wilderness"));
1710 /* Initialize town array */
1711 note(_("[配列を初期化しています... (街)]", "[Initializing arrays... (towns)]"));
1712 if (init_towns()) quit(_("街を初期化できません", "Cannot initialize towns"));
1714 /* Initialize building array */
1715 note(_("[配列を初期化しています... (建物)]", "[Initializing arrays... (buildings)]"));
1716 if (init_buildings()) quit(_("建物を初期化できません", "Cannot initialize buildings"));
1718 /* Initialize quest array */
1719 note(_("[配列を初期化しています... (クエスト)]", "[Initializing arrays... (quests)]"));
1720 if (init_quests()) quit(_("クエストを初期化できません", "Cannot initialize quests"));
1722 /* Initialize vault info */
1723 if (init_v_info()) quit(_("vault 初期化不能", "Cannot initialize vaults"));
1725 /* Initialize some other arrays */
1726 note(_("[データの初期化中... (その他)]", "[Initializing arrays... (other)]"));
1727 if (init_other(player_ptr)) quit(_("その他のデータ初期化不能", "Cannot initialize other stuff"));
1729 /* Initialize some other arrays */
1730 note(_("[データの初期化中... (アロケーション)]", "[Initializing arrays... (alloc)]"));
1731 if (init_alloc()) quit(_("アロケーション・スタッフ初期化不能", "Cannot initialize alloc stuff"));
1733 /*** Load default user pref files ***/
1735 /* Initialize feature info */
1736 note(_("[ユーザー設定ファイルを初期化しています...]", "[Initializing user pref files...]"));
1738 /* Access the "basic" pref file */
1739 strcpy(buf, "pref.prf");
1741 /* Process that file */
1742 process_pref_file(player_ptr, buf);
1744 /* Access the "basic" system pref file */
1745 sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
1747 /* Process that file */
1748 process_pref_file(player_ptr, buf);
1750 note(_("[初期化終了]", "[Initialization complete]"));
1758 static void put_title(void)
1762 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,
1764 sprintf(title, _("変愚蛮怒 %d.%d.%d(%s)", "Hengband %d.%d.%d(%s)"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH,
1766 IS_STABLE_VERSION ? _("安定版", "Stable") : _("開発版", "Developing"));
1767 int col = (80 - strlen(title)) / 2;
1768 col = col < 0 ? 0 : col;
1769 prt(title, VER_INFO_ROW, col);
1774 * @brief サムチェック情報を出力 / Get check sum in string form
1775 * @return サムチェック情報の文字列
1777 concptr get_check_sum(void)
1779 return format("%02x%02x%02x%02x%02x%02x%02x%02x%02x",