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.
35 #include "io/uid-checker.h"
37 #include "core/system-variables.h"
38 #include "core/angband-version.h"
39 #include "io/read-pref-file.h"
43 #include "market/building.h"
48 #include "market/store.h"
50 #include "dungeon/dungeon-file.h"
53 #include "floor/floor.h"
54 #include "floor/floor-town.h"
55 #include "dungeon/dungeon.h"
56 #include "rooms-vault.h"
57 #include "player-skill.h"
58 #include "player-class.h"
59 #include "object/object-kind.h"
60 #include "object/object-ego.h"
61 #include "rooms-vault.h"
62 #include "world/world.h"
63 #include "market/articles-on-sale.h"
64 #include "market/store-util.h"
66 #include <sys/types.h>
69 static void put_title(void);
72 * @brief 各データファイルを読み取るためのパスを取得する
73 * Find the default paths to all of our important sub-directories.
74 * @param path パス保管先の文字列
78 * The purpose of each sub-directory is described in "variable.c".
79 * All of the sub-directories should, by default, be located inside
80 * the main "lib" directory, whose location is very system dependant.
81 * This function takes a writable buffer, initially containing the
82 * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
83 * or a system dependant string, for example, ":lib:". The buffer
84 * must be large enough to contain at least 32 more characters.
85 * Various command line options may allow some of the important
86 * directories to be changed to user-specified directories, most
87 * importantly, the "info" and "user" and "save" directories,
88 * but this is done after this function, see "main.c".
89 * In general, the initial path should end in the appropriate "PATH_SEP"
90 * string. All of the "sub-directory" paths (created below or supplied
91 * by the user) will NOT end in the "PATH_SEP" string, see the special
92 * "path_build()" function in "util.c" for more information.
93 * Mega-Hack -- support fat raw files under NEXTSTEP, using special
94 * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
95 * requiring the directories to be created by hand by the user.
96 * Hack -- first we free all the strings, since this is known
97 * to succeed even if the strings have not been allocated yet,
98 * as long as the variables start out as "NULL". This allows
99 * this function to be called multiple times, for example, to
100 * try several base "path" values until a good one is found.
103 void init_file_paths(char *path)
107 #ifdef PRIVATE_USER_PATH
109 #endif /* PRIVATE_USER_PATH */
111 /*** Free everything ***/
113 /* Free the main path */
114 string_free(ANGBAND_DIR);
116 /* Free the sub-paths */
117 string_free(ANGBAND_DIR_APEX);
118 string_free(ANGBAND_DIR_BONE);
119 string_free(ANGBAND_DIR_DATA);
120 string_free(ANGBAND_DIR_EDIT);
121 string_free(ANGBAND_DIR_SCRIPT);
122 string_free(ANGBAND_DIR_FILE);
123 string_free(ANGBAND_DIR_HELP);
124 string_free(ANGBAND_DIR_INFO);
125 string_free(ANGBAND_DIR_SAVE);
126 string_free(ANGBAND_DIR_USER);
127 string_free(ANGBAND_DIR_XTRA);
129 /*** Prepare the "path" ***/
131 /* Hack -- save the main directory */
132 ANGBAND_DIR = string_make(path);
134 /* Prepare to append to the Base Path */
135 tail = path + strlen(path);
137 /*** Build the sub-directory names ***/
139 /* Build a path name */
140 strcpy(tail, "apex");
141 ANGBAND_DIR_APEX = string_make(path);
143 /* Build a path name */
144 strcpy(tail, "bone");
145 ANGBAND_DIR_BONE = string_make(path);
147 /* Build a path name */
148 strcpy(tail, "data");
149 ANGBAND_DIR_DATA = string_make(path);
151 /* Build a path name */
152 strcpy(tail, "edit");
153 ANGBAND_DIR_EDIT = string_make(path);
155 /* Build a path name */
156 strcpy(tail, "script");
157 ANGBAND_DIR_SCRIPT = string_make(path);
159 /* Build a path name */
160 strcpy(tail, "file");
161 ANGBAND_DIR_FILE = string_make(path);
163 /* Build a path name */
164 strcpy(tail, "help");
165 ANGBAND_DIR_HELP = string_make(path);
167 /* Build a path name */
168 strcpy(tail, "info");
169 ANGBAND_DIR_INFO = string_make(path);
171 /* Build a path name */
172 strcpy(tail, "pref");
173 ANGBAND_DIR_PREF = string_make(path);
175 /* Build a path name */
176 strcpy(tail, "save");
177 ANGBAND_DIR_SAVE = string_make(path);
179 #ifdef PRIVATE_USER_PATH
181 /* Build the path to the user specific directory */
182 path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
184 /* Build a relative path name */
185 ANGBAND_DIR_USER = string_make(buf);
187 #else /* PRIVATE_USER_PATH */
189 /* Build a path name */
190 strcpy(tail, "user");
191 ANGBAND_DIR_USER = string_make(path);
193 #endif /* PRIVATE_USER_PATH */
195 /* Build a path name */
196 strcpy(tail, "xtra");
197 ANGBAND_DIR_XTRA = string_make(path);
202 * Hack -- help give useful error messages
204 int error_idx; /*!< データ読み込み/初期化時に汎用的にエラーコードを保存するグローバル変数 */
205 int error_line; /*!< データ読み込み/初期化時に汎用的にエラー行数を保存するグローバル変数 */
208 * エラーメッセージの名称定義 / Standard error message text
210 concptr err_str[PARSE_ERROR_MAX] =
227 "missing record header",
228 "non-sequential records",
229 "invalid flag specification",
230 "undefined directive",
232 "coordinates out of bounds",
234 "undefined terrain tag",
243 header v_head; /*!< Vault情報のヘッダ構造体 */
244 header f_head; /*!< 地形情報のヘッダ構造体 */
245 header k_head; /*!< ペースアイテム情報のヘッダ構造体 */
246 header a_head; /*!< 固定アーティファクト情報のヘッダ構造体 */
247 header e_head; /*!< アイテムエゴ情報のヘッダ構造体 */
248 header r_head; /*!< モンスター種族情報のヘッダ構造体 */
249 header d_head; /*!< ダンジョン情報のヘッダ構造体 */
250 header s_head; /*!< プレイヤー職業技能情報のヘッダ構造体 */
251 header m_head; /*!< プレイヤー職業魔法情報のヘッダ構造体 */
254 * @brief テキストファイルとrawファイルの更新時刻を比較する
255 * Find the default paths to all of our important sub-directories.
256 * @param fd ファイルディスクリプタ
257 * @param template_file ファイル名
258 * @return テキストの方が新しいか、rawファイルがなく更新の必要がある場合-1、更新の必要がない場合0。
260 static errr check_modification_date(int fd, concptr template_file)
262 struct stat txt_stat, raw_stat;
264 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, template_file);
266 /* Access stats on text file */
267 if (stat(buf, &txt_stat))
272 /* Access stats on raw file */
273 if (fstat(fd, &raw_stat))
278 /* Ensure text file is not newer than raw file */
279 if (txt_stat.st_mtime > raw_stat.st_mtime)
288 /*** Initialize from binary image files ***/
291 * @brief rawファイルからのデータの読み取り処理
292 * Initialize the "*_info" array, by parsing a binary "image" file
293 * @param fd ファイルディスクリプタ
294 * @param head rawファイルのヘッダ
297 static errr init_info_raw(int fd, header *head)
301 /* Read and Verify the header */
302 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
303 (test.v_major != head->v_major) ||
304 (test.v_minor != head->v_minor) ||
305 (test.v_patch != head->v_patch) ||
306 (test.info_num != head->info_num) ||
307 (test.info_len != head->info_len) ||
308 (test.head_size != head->head_size) ||
309 (test.info_size != head->info_size))
315 /* Accept the header */
318 /* Allocate the "*_info" array */
319 C_MAKE(head->info_ptr, head->info_size, char);
321 /* Read the "*_info" array */
322 fd_read(fd, head->info_ptr, head->info_size);
326 /* Allocate the "*_name" array */
327 C_MAKE(head->name_ptr, head->name_size, char);
329 /* Read the "*_name" array */
330 fd_read(fd, head->name_ptr, head->name_size);
335 /* Allocate the "*_text" array */
336 C_MAKE(head->text_ptr, head->text_size, char);
338 /* Read the "*_text" array */
339 fd_read(fd, head->text_ptr, head->text_size);
344 /* Allocate the "*_tag" array */
345 C_MAKE(head->tag_ptr, head->tag_size, char);
347 /* Read the "*_tag" array */
348 fd_read(fd, head->tag_ptr, head->tag_size);
358 * Initialize the header of an *_info.raw file.
359 * @param head rawファイルのヘッダ
364 static void init_header(header *head, IDX num, int len)
366 /* Save the "version" */
367 head->v_major = FAKE_VER_MAJOR;
368 head->v_minor = FAKE_VER_MINOR;
369 head->v_patch = FAKE_VER_PATCH;
372 /* Save the "record" information */
373 head->info_num = (IDX)num;
374 head->info_len = len;
376 /* Save the size of "*_head" and "*_info" */
377 head->head_size = sizeof(header);
378 head->info_size = head->info_num * head->info_len;
382 static void update_header(header *head, void **info, char **name, char **text, char **tag)
384 if (info) *info = head->info_ptr;
385 if (name) *name = head->name_ptr;
386 if (text) *text = head->text_ptr;
387 if (tag) *tag = head->tag_ptr;
393 * Initialize the "*_info" array
394 * @param filename ファイル名(拡張子txt/raw)
395 * @param head 処理に用いるヘッダ構造体
396 * @param info データ保管先の構造体ポインタ
397 * @param name 名称用可変文字列の保管先
398 * @param text テキスト用可変文字列の保管先
399 * @param tag タグ用可変文字列の保管先
402 * Note that we let each entry have a unique "name" and "text" string,
403 * even if the string happens to be empty (everyone has a unique '\0').
405 static errr init_info(concptr filename, header *head, void **info, char **name, char **text, char **tag)
410 /*** Load the binary image file ***/
411 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
413 /* Attempt to open the "raw" file */
414 int fd = fd_open(buf, O_RDONLY);
416 /* Process existing "raw" file */
420 err = check_modification_date(fd, format("%s.txt", filename));
422 /* Attempt to parse the "raw" file */
424 err = init_info_raw(fd, head);
428 /* Do we have to parse the *.txt file? */
429 BIT_FLAGS file_permission = 0644;
432 update_header(head, info, name, text, tag);
436 /*** Make the fake arrays ***/
437 C_MAKE(head->info_ptr, head->info_size, char);
439 /* Hack -- make "fake" arrays */
440 if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
441 if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
442 if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
444 if (info) (*info) = head->info_ptr;
445 if (name) (*name) = head->name_ptr;
446 if (text) (*text) = head->text_ptr;
447 if (tag) (*tag) = head->tag_ptr;
449 /*** Load the ascii template file ***/
450 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
452 fp = my_fopen(buf, "r");
455 if (!fp) quit(format(_("'%s.txt'ファイルをオープンできません。", "Cannot open '%s.txt' file."), filename));
458 err = init_info_txt(fp, buf, head, head->parse_info_txt);
468 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "未知の");
470 msg_format("'%s.txt'ファイルの %d 行目にエラー。", filename, error_line);
471 msg_format("レコード %d は '%s' エラーがあります。", error_idx, oops);
472 msg_format("構文 '%s'。", buf);
476 quit(format("'%s.txt'ファイルにエラー", filename));
479 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
481 msg_format("Error %d at line %d of '%s.txt'.", err, error_line, filename);
482 msg_format("Record %d contains a '%s' error.", error_idx, oops);
483 msg_format("Parsing '%s'.", buf);
487 quit(format("Error in '%s.txt' file.", filename));
491 /*** Make final retouch on fake tags ***/
494 (*head->retouch)(head);
497 /*** Dump the binary image file ***/
498 /* File type is "DATA" */
499 FILE_TYPE(FILE_TYPE_DATA);
500 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
502 /* Grab permissions */
505 /* Kill the old file */
508 /* Attempt to create the raw file */
509 fd = fd_make(buf, file_permission);
511 /* Drop permissions */
514 /* Dump to the file */
518 fd_write(fd, (concptr)(head), head->head_size);
520 /* Dump the "*_info" array */
521 fd_write(fd, head->info_ptr, head->info_size);
523 /* Dump the "*_name" array */
524 fd_write(fd, head->name_ptr, head->name_size);
526 /* Dump the "*_text" array */
527 fd_write(fd, head->text_ptr, head->text_size);
529 /* Dump the "*_tag" array */
530 fd_write(fd, head->tag_ptr, head->tag_size);
536 /*** Kill the fake arrays ***/
538 /* Free the "*_info" array */
539 C_KILL(head->info_ptr, head->info_size, char);
541 /* Hack -- Free the "fake" arrays */
542 if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char);
543 if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char);
544 if (tag) C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char);
546 /*** Load the binary image file ***/
547 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
549 /* Attempt to open the "raw" file */
550 fd = fd_open(buf, O_RDONLY);
552 /* Process existing "raw" file */
553 if (fd < 0) quit(format(_("'%s_j.raw'ファイルをロードできません。", "Cannot load '%s.raw' file."), filename));
555 /* Attempt to parse the "raw" file */
556 err = init_info_raw(fd, head);
560 if (err) quit(format(_("'%s_j.raw'ファイルを解析できません。", "Cannot parse '%s.raw' file."), filename));
562 update_header(head, info, name, text, tag);
568 * @brief 地形情報読み込みのメインルーチン /
569 * Initialize the "f_info" array
572 static errr init_f_info(void)
574 /* Init the header */
575 init_header(&f_head, max_f_idx, sizeof(feature_type));
577 /* Save a pointer to the parsing function */
578 f_head.parse_info_txt = parse_f_info;
580 /* Save a pointer to the retouch fake tags */
581 f_head.retouch = retouch_f_info;
583 return init_info("f_info", &f_head,
584 (void*)&f_info, &f_name, NULL, &f_tag);
589 * @brief ベースアイテム情報読み込みのメインルーチン /
590 * Initialize the "k_info" array
593 static errr init_k_info(void)
595 /* Init the header */
596 init_header(&k_head, max_k_idx, sizeof(object_kind));
598 /* Save a pointer to the parsing function */
599 k_head.parse_info_txt = parse_k_info;
601 return init_info("k_info", &k_head,
602 (void*)&k_info, &k_name, &k_text, NULL);
607 * @brief 固定アーティファクト情報読み込みのメインルーチン /
608 * Initialize the "a_info" array
611 static errr init_a_info(void)
613 /* Init the header */
614 init_header(&a_head, max_a_idx, sizeof(artifact_type));
616 /* Save a pointer to the parsing function */
617 a_head.parse_info_txt = parse_a_info;
619 return init_info("a_info", &a_head,
620 (void*)&a_info, &a_name, &a_text, NULL);
625 * @brief 固定アーティファクト情報読み込みのメインルーチン /
626 * Initialize the "e_info" array
629 static errr init_e_info(void)
631 /* Init the header */
632 init_header(&e_head, max_e_idx, sizeof(ego_item_type));
634 /* Save a pointer to the parsing function */
635 e_head.parse_info_txt = parse_e_info;
637 return init_info("e_info", &e_head,
638 (void*)&e_info, &e_name, &e_text, NULL);
643 * @brief モンスター種族情報読み込みのメインルーチン /
644 * Initialize the "r_info" array
647 static errr init_r_info(void)
649 /* Init the header */
650 init_header(&r_head, max_r_idx, sizeof(monster_race));
652 /* Save a pointer to the parsing function */
653 r_head.parse_info_txt = parse_r_info;
655 return init_info("r_info", &r_head,
656 (void*)&r_info, &r_name, &r_text, NULL);
661 * @brief ダンジョン情報読み込みのメインルーチン /
662 * Initialize the "d_info" array
665 static errr init_d_info(void)
667 /* Init the header */
668 init_header(&d_head, current_world_ptr->max_d_idx, sizeof(dungeon_type));
670 /* Save a pointer to the parsing function */
671 d_head.parse_info_txt = parse_d_info;
673 return init_info("d_info", &d_head,
674 (void*)&d_info, &d_name, &d_text, NULL);
679 * @brief Vault情報読み込みのメインルーチン /
680 * Initialize the "v_info" array
683 * Note that we let each entry have a unique "name" and "text" string,
684 * even if the string happens to be empty (everyone has a unique '\0').
686 errr init_v_info(void)
688 /* Init the header */
689 init_header(&v_head, max_v_idx, sizeof(vault_type));
691 /* Save a pointer to the parsing function */
692 v_head.parse_info_txt = parse_v_info;
694 return init_info("v_info", &v_head,
695 (void*)&v_info, &v_name, &v_text, NULL);
700 * @brief 職業技能情報読み込みのメインルーチン /
701 * Initialize the "s_info" array
704 static errr init_s_info(void)
706 /* Init the header */
707 init_header(&s_head, MAX_CLASS, sizeof(skill_table));
709 /* Save a pointer to the parsing function */
710 s_head.parse_info_txt = parse_s_info;
712 return init_info("s_info", &s_head,
713 (void*)&s_info, NULL, NULL, NULL);
718 * @brief 職業魔法情報読み込みのメインルーチン /
719 * Initialize the "m_info" array
722 static errr init_m_info(void)
724 /* Init the header */
725 init_header(&m_head, MAX_CLASS, sizeof(player_magic));
727 /* Save a pointer to the parsing function */
728 m_head.parse_info_txt = parse_m_info;
730 return init_info("m_info", &m_head,
731 (void*)&m_info, NULL, NULL, NULL);
736 * @brief 基本情報読み込みのメインルーチン /
737 * Initialize misc. values
738 * @param player_ptr プレーヤーへの参照ポインタ
741 static errr init_misc(player_type *player_ptr)
743 return process_dungeon_file(player_ptr, "misc.txt", 0, 0, 0, 0);
748 * @brief 町情報読み込みのメインルーチン /
749 * Initialize town array
752 static errr init_towns(void)
754 /* Allocate the towns */
755 C_MAKE(town_info, max_towns, town_type);
757 for (int i = 1; i < max_towns; i++)
759 /*** Prepare the Stores ***/
761 /* Allocate the stores */
762 C_MAKE(town_info[i].store, MAX_STORES, store_type);
764 /* Fill in each store */
765 for (int j = 0; j < MAX_STORES; j++)
767 /* Access the store */
768 store_type *store_ptr = &town_info[i].store[j];
770 if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME)) continue;
772 /* Assume full stock */
775 * 我が家が 20 ページまで使える隠し機能のための準備。
776 * オプションが有効でもそうでなくても一応スペースを作っておく。
780 store_ptr->stock_size = (STORE_INVEN_MAX * 10);
782 else if (j == STORE_MUSEUM)
784 store_ptr->stock_size = (STORE_INVEN_MAX * 50);
788 store_ptr->stock_size = STORE_INVEN_MAX;
791 /* Allocate the stock */
792 C_MAKE(store_ptr->stock, store_ptr->stock_size, object_type);
794 /* No table for the black market or home */
795 if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM)) continue;
797 /* Assume full table */
798 store_ptr->table_size = STORE_CHOICES;
800 /* Allocate the stock */
801 C_MAKE(store_ptr->table, store_ptr->table_size, s16b);
803 /* Scan the choices */
804 for (int k = 0; k < STORE_CHOICES; k++)
806 KIND_OBJECT_IDX k_idx;
808 /* Extract the tval/sval codes */
809 int tv = store_table[j][k][0];
810 int sv = store_table[j][k][1];
813 for (k_idx = 1; k_idx < max_k_idx; k_idx++)
815 object_kind *k_ptr = &k_info[k_idx];
818 if ((k_ptr->tval == tv) && (k_ptr->sval == sv)) break;
822 if (k_idx == max_k_idx) continue;
824 /* Add that item index to the table */
825 store_ptr->table[store_ptr->table_num++] = k_idx;
834 * @brief 店情報初期化のメインルーチン /
835 * Initialize buildings
838 errr init_buildings(void)
840 for (int i = 0; i < MAX_BLDG; i++)
842 building[i].name[0] = '\0';
843 building[i].owner_name[0] = '\0';
844 building[i].owner_race[0] = '\0';
846 for (int j = 0; j < 8; j++)
848 building[i].act_names[j][0] = '\0';
849 building[i].member_costs[j] = 0;
850 building[i].other_costs[j] = 0;
851 building[i].letters[j] = 0;
852 building[i].actions[j] = 0;
853 building[i].action_restr[j] = 0;
856 for (int j = 0; j < MAX_CLASS; j++)
858 building[i].member_class[j] = 0;
861 for (int j = 0; j < MAX_RACES; j++)
863 building[i].member_race[j] = 0;
866 for (int j = 0; j < MAX_MAGIC + 1; j++)
868 building[i].member_realm[j] = 0;
877 * @brief クエスト情報初期化のメインルーチン /
878 * Initialize quest array
881 static errr init_quests(void)
883 /* Allocate the quests */
884 C_MAKE(quest, max_q_idx, quest_type);
886 /* Set all quest to "untaken" */
887 for (int i = 0; i < max_q_idx; i++)
889 quest[i].status = QUEST_STATUS_UNTAKEN;
895 /*! 地形タグ情報から地形IDを得られなかった場合にTRUEを返すグローバル変数 */
896 static bool feat_tag_is_not_found = FALSE;
899 * @brief 地形タグからIDを得る /
900 * Initialize quest array
903 s16b f_tag_to_index_in_init(concptr str)
905 FEAT_IDX feat = f_tag_to_index(str);
907 if (feat < 0) feat_tag_is_not_found = TRUE;
914 * @brief 地形の汎用定義をタグを通じて取得する /
915 * Initialize feature variables
918 static errr init_feat_variables(void)
920 feat_none = f_tag_to_index_in_init("NONE");
922 feat_floor = f_tag_to_index_in_init("FLOOR");
923 feat_glyph = f_tag_to_index_in_init("GLYPH");
924 feat_explosive_rune = f_tag_to_index_in_init("EXPLOSIVE_RUNE");
925 feat_mirror = f_tag_to_index_in_init("MIRROR");
927 feat_door[DOOR_DOOR].open = f_tag_to_index_in_init("OPEN_DOOR");
928 feat_door[DOOR_DOOR].broken = f_tag_to_index_in_init("BROKEN_DOOR");
929 feat_door[DOOR_DOOR].closed = f_tag_to_index_in_init("CLOSED_DOOR");
933 for (i = 1; i < MAX_LJ_DOORS; i++)
935 s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
937 feat_door[DOOR_DOOR].locked[i - 1] = door;
940 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
941 feat_door[DOOR_DOOR].num_locked = i - 1;
944 for (i = 0; i < MAX_LJ_DOORS; i++)
946 s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
948 feat_door[DOOR_DOOR].jammed[i] = door;
951 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
952 feat_door[DOOR_DOOR].num_jammed = i;
955 feat_door[DOOR_GLASS_DOOR].open = f_tag_to_index_in_init("OPEN_GLASS_DOOR");
956 feat_door[DOOR_GLASS_DOOR].broken = f_tag_to_index_in_init("BROKEN_GLASS_DOOR");
957 feat_door[DOOR_GLASS_DOOR].closed = f_tag_to_index_in_init("CLOSED_GLASS_DOOR");
959 /* Locked glass doors */
960 for (i = 1; i < MAX_LJ_DOORS; i++)
962 s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
964 feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door;
967 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
968 feat_door[DOOR_GLASS_DOOR].num_locked = i - 1;
970 /* Jammed glass doors */
971 for (i = 0; i < MAX_LJ_DOORS; i++)
973 s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
975 feat_door[DOOR_GLASS_DOOR].jammed[i] = door;
978 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
979 feat_door[DOOR_GLASS_DOOR].num_jammed = i;
982 feat_door[DOOR_CURTAIN].open = f_tag_to_index_in_init("OPEN_CURTAIN");
983 feat_door[DOOR_CURTAIN].broken = feat_door[DOOR_CURTAIN].open;
984 feat_door[DOOR_CURTAIN].closed = f_tag_to_index_in_init("CLOSED_CURTAIN");
985 feat_door[DOOR_CURTAIN].locked[0] = feat_door[DOOR_CURTAIN].closed;
986 feat_door[DOOR_CURTAIN].num_locked = 1;
987 feat_door[DOOR_CURTAIN].jammed[0] = feat_door[DOOR_CURTAIN].closed;
988 feat_door[DOOR_CURTAIN].num_jammed = 1;
991 feat_up_stair = f_tag_to_index_in_init("UP_STAIR");
992 feat_down_stair = f_tag_to_index_in_init("DOWN_STAIR");
993 feat_entrance = f_tag_to_index_in_init("ENTRANCE");
999 feat_trap_open = f_tag_to_index_in_init("TRAP_OPEN");
1000 feat_trap_armageddon = f_tag_to_index_in_init("TRAP_ARMAGEDDON");
1001 feat_trap_piranha = f_tag_to_index_in_init("TRAP_PIRANHA");
1004 feat_rubble = f_tag_to_index_in_init("RUBBLE");
1007 feat_magma_vein = f_tag_to_index_in_init("MAGMA_VEIN");
1008 feat_quartz_vein = f_tag_to_index_in_init("QUARTZ_VEIN");
1011 feat_granite = f_tag_to_index_in_init("GRANITE");
1012 feat_permanent = f_tag_to_index_in_init("PERMANENT");
1015 feat_glass_floor = f_tag_to_index_in_init("GLASS_FLOOR");
1018 feat_glass_wall = f_tag_to_index_in_init("GLASS_WALL");
1019 feat_permanent_glass_wall = f_tag_to_index_in_init("PERMANENT_GLASS_WALL");
1022 feat_pattern_start = f_tag_to_index_in_init("PATTERN_START");
1023 feat_pattern_1 = f_tag_to_index_in_init("PATTERN_1");
1024 feat_pattern_2 = f_tag_to_index_in_init("PATTERN_2");
1025 feat_pattern_3 = f_tag_to_index_in_init("PATTERN_3");
1026 feat_pattern_4 = f_tag_to_index_in_init("PATTERN_4");
1027 feat_pattern_end = f_tag_to_index_in_init("PATTERN_END");
1028 feat_pattern_old = f_tag_to_index_in_init("PATTERN_OLD");
1029 feat_pattern_exit = f_tag_to_index_in_init("PATTERN_EXIT");
1030 feat_pattern_corrupted = f_tag_to_index_in_init("PATTERN_CORRUPTED");
1033 feat_black_market = f_tag_to_index_in_init("BLACK_MARKET");
1034 feat_town = f_tag_to_index_in_init("TOWN");
1037 feat_deep_water = f_tag_to_index_in_init("DEEP_WATER");
1038 feat_shallow_water = f_tag_to_index_in_init("SHALLOW_WATER");
1039 feat_deep_lava = f_tag_to_index_in_init("DEEP_LAVA");
1040 feat_shallow_lava = f_tag_to_index_in_init("SHALLOW_LAVA");
1041 feat_heavy_cold_zone = f_tag_to_index_in_init("HEAVY_COLD_ZONE");
1042 feat_cold_zone = f_tag_to_index_in_init("COLD_ZONE");
1043 feat_heavy_electrical_zone = f_tag_to_index_in_init("HEAVY_ELECTRICAL_ZONE");
1044 feat_electrical_zone = f_tag_to_index_in_init("ELECTRICAL_ZONE");
1045 feat_deep_acid_puddle = f_tag_to_index_in_init("DEEP_ACID_PUDDLE");
1046 feat_shallow_acid_puddle = f_tag_to_index_in_init("SHALLOW_ACID_PUDDLE");
1047 feat_deep_poisonous_puddle = f_tag_to_index_in_init("DEEP_POISONOUS_PUDDLE");
1048 feat_shallow_poisonous_puddle = f_tag_to_index_in_init("SHALLOW_POISONOUS_PUDDLE");
1049 feat_dirt = f_tag_to_index_in_init("DIRT");
1050 feat_grass = f_tag_to_index_in_init("GRASS");
1051 feat_flower = f_tag_to_index_in_init("FLOWER");
1052 feat_brake = f_tag_to_index_in_init("BRAKE");
1053 feat_tree = f_tag_to_index_in_init("TREE");
1054 feat_mountain = f_tag_to_index_in_init("MOUNTAIN");
1055 feat_swamp = f_tag_to_index_in_init("SWAMP");
1057 feat_undetected = f_tag_to_index_in_init("UNDETECTED");
1059 init_wilderness_terrains();
1060 return feat_tag_is_not_found ? PARSE_ERROR_UNDEFINED_TERRAIN_TAG : 0;
1065 * @brief その他の初期情報更新 /
1066 * Initialize some other arrays
1069 static errr init_other(player_type *player_ptr)
1071 player_ptr->current_floor_ptr = &floor_info; // TODO:本当はこんなところで初期化したくない
1072 floor_type *floor_ptr = player_ptr->current_floor_ptr;
1074 /*** Prepare the "dungeon" information ***/
1076 /* Allocate and Wipe the object list */
1077 C_MAKE(floor_ptr->o_list, current_world_ptr->max_o_idx, object_type);
1079 /* Allocate and Wipe the monster list */
1080 C_MAKE(floor_ptr->m_list, current_world_ptr->max_m_idx, monster_type);
1082 /* Allocate and Wipe the monster process list */
1083 for (int i = 0; i < MAX_MTIMED; i++)
1085 C_MAKE(floor_ptr->mproc_list[i], current_world_ptr->max_m_idx, s16b);
1088 /* Allocate and Wipe the max dungeon level */
1089 C_MAKE(max_dlv, current_world_ptr->max_d_idx, DEPTH);
1091 for (int i = 0; i < MAX_HGT; i++)
1093 C_MAKE(floor_ptr->grid_array[i], MAX_WID, grid_type);
1096 /*** Prepare the various "bizarre" arrays ***/
1098 /* Macro variables */
1099 C_MAKE(macro__pat, MACRO_MAX, concptr);
1100 C_MAKE(macro__act, MACRO_MAX, concptr);
1101 C_MAKE(macro__cmd, MACRO_MAX, bool);
1103 /* Macro action buffer */
1104 C_MAKE(macro__buf, 1024, char);
1106 /* Quark variables */
1109 /* Message variables */
1110 C_MAKE(message__ptr, MESSAGE_MAX, u32b);
1111 C_MAKE(message__buf, MESSAGE_BUF, char);
1113 /* Hack -- No messages yet */
1114 message__tail = MESSAGE_BUF;
1116 /*** Prepare the options ***/
1118 /* Scan the options */
1119 for (int i = 0; option_info[i].o_desc; i++)
1121 int os = option_info[i].o_set;
1122 int ob = option_info[i].o_bit;
1124 /* Set the "default" options */
1125 if (!option_info[i].o_var) continue;
1128 option_mask[os] |= (1L << ob);
1131 if (option_info[i].o_norm)
1134 option_flag[os] |= (1L << ob);
1138 option_flag[os] &= ~(1L << ob);
1142 /* Analyze the windows */
1143 for (int n = 0; n < 8; n++)
1145 /* Analyze the options */
1146 for (int i = 0; i < 32; i++)
1149 if (window_flag_desc[i])
1152 window_mask[n] |= (1L << i);
1158 * Set the "default" window flags
1159 * Window 1 : Display messages
1160 * Window 2 : Display inven/equip
1162 window_flag[1] = 1L << A_MAX;
1163 window_flag[2] = 1L << 0;
1165 /*** Pre-allocate space for the "format()" buffer ***/
1167 /* Hack -- Just call the "format()" function */
1168 (void)format("%s (%s).", "Mr.Hoge", MAINTAINER);
1174 * @brief オブジェクト配列を初期化する /
1175 * Initialize some other arrays
1178 static errr init_object_alloc(void)
1180 s16b aux[MAX_DEPTH];
1181 (void)C_WIPE(&aux, MAX_DEPTH, s16b);
1183 s16b num[MAX_DEPTH];
1184 (void)C_WIPE(&num, MAX_DEPTH, s16b);
1186 /* Free the old "alloc_kind_table" (if it exists) */
1187 if (alloc_kind_table)
1189 C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
1192 /* Size of "alloc_kind_table" */
1193 alloc_kind_size = 0;
1195 /* Scan the objects */
1196 for (int i = 1; i < max_k_idx; i++)
1201 /* Scan allocation pairs */
1202 for (int j = 0; j < 4; j++)
1204 /* Count the "legal" entries */
1205 if (k_ptr->chance[j])
1207 /* Count the entries */
1210 /* Group by level */
1211 num[k_ptr->locale[j]]++;
1216 /* Collect the level indexes */
1217 for (int i = 1; i < MAX_DEPTH; i++)
1219 /* Group by level */
1220 num[i] += num[i - 1];
1223 if (!num[0]) quit(_("町のアイテムがない!", "No town objects!"));
1225 /*** Initialize object allocation info ***/
1227 /* Allocate the alloc_kind_table */
1228 C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
1230 /* Access the table entry */
1232 table = alloc_kind_table;
1234 /* Scan the objects */
1235 for (int i = 1; i < max_k_idx; i++)
1240 /* Scan allocation pairs */
1241 for (int j = 0; j < 4; j++)
1243 /* Count the "legal" entries */
1244 if (k_ptr->chance[j] == 0) continue;
1246 /* Extract the base level */
1247 int x = k_ptr->locale[j];
1249 /* Extract the base probability */
1250 int p = (100 / k_ptr->chance[j]);
1252 /* Skip entries preceding our locale */
1253 int y = (x > 0) ? num[x - 1] : 0;
1255 /* Skip previous entries at this locale */
1258 /* Load the entry */
1259 table[z].index = (KIND_OBJECT_IDX)i;
1260 table[z].level = (DEPTH)x;
1261 table[z].prob1 = (PROB)p;
1262 table[z].prob2 = (PROB)p;
1263 table[z].prob3 = (PROB)p;
1265 /* Another entry complete for this locale */
1275 * @brief モンスター配列と生成テーブルを初期化する /
1276 * Initialize some other arrays
1279 static errr init_alloc(void)
1281 monster_race *r_ptr;
1284 /* Allocate the "r_info" array */
1285 C_MAKE(elements, max_r_idx, tag_type);
1287 /* Scan the monsters */
1288 for (int i = 1; i < max_r_idx; i++)
1290 elements[i].tag = r_info[i].level;
1291 elements[i].index = i;
1294 tag_sort(elements, max_r_idx);
1296 /*** Initialize monster allocation info ***/
1298 /* Size of "alloc_race_table" */
1299 alloc_race_size = max_r_idx;
1301 /* Allocate the alloc_race_table */
1302 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1304 /* Scan the monsters */
1305 for (int i = 1; i < max_r_idx; i++)
1307 /* Get the i'th race */
1308 r_ptr = &r_info[elements[i].index];
1310 /* Count valid pairs */
1311 if (r_ptr->rarity == 0) continue;
1313 /* Extract the base level */
1314 int x = r_ptr->level;
1316 /* Extract the base probability */
1317 int p = (100 / r_ptr->rarity);
1319 /* Load the entry */
1320 alloc_race_table[i].index = (KIND_OBJECT_IDX)elements[i].index;
1321 alloc_race_table[i].level = (DEPTH)x;
1322 alloc_race_table[i].prob1 = (PROB)p;
1323 alloc_race_table[i].prob2 = (PROB)p;
1324 alloc_race_table[i].prob3 = (PROB)p;
1327 /* Free the "r_info" array */
1328 C_KILL(elements, max_r_idx, tag_type);
1329 (void)init_object_alloc();
1335 * @brief 画面左下にシステムメッセージを表示する /
1336 * Hack -- take notes on line 23
1339 static void note(concptr str)
1341 Term_erase(0, 23, 255);
1342 Term_putstr(20, 23, -1, TERM_WHITE, str);
1348 * @brief 全ゲームデータ読み込みのサブルーチン /
1349 * Hack -- Explain a broken "lib" folder and quit (see below).
1353 * This function is "messy" because various things
1354 * may or may not be initialized, but the "plog()" and "quit()"
1355 * functions are "supposed" to work under any conditions.
1358 static void init_angband_aux(concptr why)
1364 plog("'lib'ディレクトリが存在しないか壊れているようです。");
1367 plog("ひょっとするとアーカイブが正しく解凍されていないのかもしれません。");
1370 plog("該当する'README'ファイルを読んで確認してみて下さい。");
1372 /* Quit with error */
1376 plog("The 'lib' directory is probably missing or broken.");
1379 plog("Perhaps the archive was not extracted correctly.");
1382 plog("See the 'README' file for more information.");
1384 /* Quit with error */
1385 quit("Fatal Error.");
1392 * @brief 全ゲームデータ読み込みのメインルーチン /
1393 * Hack -- main Angband initialization entry point
1397 * This function is "messy" because various things
1398 * may or may not be initialized, but the "plog()" and "quit()"
1399 * functions are "supposed" to work under any conditions.
1400 * Verify some files, display the "news.txt" file, create
1401 * the high score file, initialize all internal arrays, and
1402 * load the basic "user pref files".
1403 * Be very careful to keep track of the order in which things
1404 * are initialized, in particular, the only thing *known* to
1405 * be available when this function is called is the "z-term.c"
1406 * package, and that may not be fully initialized until the
1407 * end of this function, when the default "user pref files"
1408 * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
1409 * Note that this function attempts to verify the "news" file,
1410 * and the game aborts (cleanly) on failure, since without the
1411 * "news" file, it is likely that the "lib" folder has not been
1412 * correctly located. Otherwise, the news file is displayed for
1414 * Note that this function attempts to verify (or create) the
1415 * "high score" file, and the game aborts (cleanly) on failure,
1416 * since one of the most common "extraction" failures involves
1417 * failing to extract all sub-directories (even empty ones), such
1418 * as by failing to use the "-d" option of "pkunzip", or failing
1419 * to use the "save empty directories" option with "Compact Pro".
1420 * This error will often be caught by the "high score" creation
1421 * code below, since the "lib/apex" directory, being empty in the
1422 * standard distributions, is most likely to be "lost", making it
1423 * impossible to create the high score file.
1424 * Note that various things are initialized by this function,
1425 * including everything that was once done by "init_some_arrays".
1426 * This initialization involves the parsing of special files
1427 * in the "lib/data" and sometimes the "lib/edit" directories.
1428 * Note that the "template" files are initialized first, since they
1429 * often contain errors. This means that macros and message recall
1430 * and things like that are not available until after they are done.
1431 * We load the default "user pref files" here in case any "color"
1432 * changes are needed before character creation.
1433 * Note that the "graf-xxx.prf" file must be loaded separately,
1434 * if needed, in the first (?) pass through "TERM_XTRA_REACT".
1437 void init_angband(player_type *player_ptr, void(*process_autopick_file_command)(char*))
1439 /*** Verify the "news" file ***/
1441 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1443 /* Attempt to open the file */
1444 int fd = fd_open(buf, O_RDONLY);
1451 sprintf(why, _("'%s'ファイルにアクセスできません!", "Cannot access the '%s' file!"), buf);
1453 /* Crash and burn */
1454 init_angband_aux(why);
1459 /*** Display the "news" file ***/
1461 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1463 /* Open the News file */
1465 fp = my_fopen(buf, "r");
1470 /* Dump the file to the screen */
1472 while (0 == my_fgets(fp, buf, sizeof(buf)))
1474 /* Display and advance */
1475 Term_putstr(0, i++, -1, TERM_WHITE, buf);
1483 /*** Verify (or create) the "high score" file ***/
1484 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
1486 /* Attempt to open the high score file */
1487 fd = fd_open(buf, O_RDONLY);
1489 BIT_FLAGS file_permission = 0664;
1492 /* File type is "DATA" */
1493 FILE_TYPE(FILE_TYPE_DATA);
1495 /* Grab permissions */
1498 /* Create a new high score file */
1499 fd = fd_make(buf, file_permission);
1501 /* Drop permissions */
1509 sprintf(why, _("'%s'ファイルを作成できません!", "Cannot create the '%s' file!"), buf);
1511 /* Crash and burn */
1512 init_angband_aux(why);
1520 /*** Initialize some arrays ***/
1522 /* Initialize misc. values */
1523 note(_("[変数を初期化しています...(その他)", "[Initializing values... (misc)]"));
1524 if (init_misc(player_ptr)) quit(_("その他の変数を初期化できません", "Cannot initialize misc. values"));
1526 /* Initialize feature info */
1528 note("[データの初期化中... (地形)]");
1529 if (init_f_info()) quit("地形初期化不能");
1530 if (init_feat_variables()) quit("地形初期化不能");
1532 note("[Initializing arrays... (features)]");
1533 if (init_f_info()) quit("Cannot initialize features");
1534 if (init_feat_variables()) quit("Cannot initialize features");
1537 /* Initialize object info */
1538 note(_("[データの初期化中... (アイテム)]", "[Initializing arrays... (objects)]"));
1539 if (init_k_info()) quit(_("アイテム初期化不能", "Cannot initialize objects"));
1541 /* Initialize artifact info */
1542 note(_("[データの初期化中... (伝説のアイテム)]", "[Initializing arrays... (artifacts)]"));
1543 if (init_a_info()) quit(_("伝説のアイテム初期化不能", "Cannot initialize artifacts"));
1546 /* Initialize ego-item info */
1547 note(_("[データの初期化中... (名のあるアイテム)]", "[Initializing arrays... (ego-items)]"));
1548 if (init_e_info()) quit(_("名のあるアイテム初期化不能", "Cannot initialize ego-items"));
1551 /* Initialize monster info */
1552 note(_("[データの初期化中... (モンスター)]", "[Initializing arrays... (monsters)]"));
1553 if (init_r_info()) quit(_("モンスター初期化不能", "Cannot initialize monsters"));
1556 /* Initialize dungeon info */
1557 note(_("[データの初期化中... (ダンジョン)]", "[Initializing arrays... (dungeon)]"));
1558 if (init_d_info()) quit(_("ダンジョン初期化不能", "Cannot initialize dungeon"));
1560 for (int i = 1; i < current_world_ptr->max_d_idx; i++)
1561 if (d_info[i].final_guardian)
1562 r_info[d_info[i].final_guardian].flags7 |= RF7_GUARDIAN;
1565 /* Initialize magic info */
1566 note(_("[データの初期化中... (魔法)]", "[Initializing arrays... (magic)]"));
1567 if (init_m_info()) quit(_("魔法初期化不能", "Cannot initialize magic"));
1569 /* Initialize weapon_exp info */
1570 note(_("[データの初期化中... (熟練度)]", "[Initializing arrays... (skill)]"));
1571 if (init_s_info()) quit(_("熟練度初期化不能", "Cannot initialize skill"));
1573 /* Initialize wilderness array */
1574 note(_("[配列を初期化しています... (荒野)]", "[Initializing arrays... (wilderness)]"));
1576 if (init_wilderness()) quit(_("荒野を初期化できません", "Cannot initialize wilderness"));
1578 /* Initialize town array */
1579 note(_("[配列を初期化しています... (街)]", "[Initializing arrays... (towns)]"));
1580 if (init_towns()) quit(_("街を初期化できません", "Cannot initialize towns"));
1582 /* Initialize building array */
1583 note(_("[配列を初期化しています... (建物)]", "[Initializing arrays... (buildings)]"));
1584 if (init_buildings()) quit(_("建物を初期化できません", "Cannot initialize buildings"));
1586 /* Initialize quest array */
1587 note(_("[配列を初期化しています... (クエスト)]", "[Initializing arrays... (quests)]"));
1588 if (init_quests()) quit(_("クエストを初期化できません", "Cannot initialize quests"));
1590 /* Initialize vault info */
1591 if (init_v_info()) quit(_("vault 初期化不能", "Cannot initialize vaults"));
1593 /* Initialize some other arrays */
1594 note(_("[データの初期化中... (その他)]", "[Initializing arrays... (other)]"));
1595 if (init_other(player_ptr)) quit(_("その他のデータ初期化不能", "Cannot initialize other stuff"));
1597 /* Initialize some other arrays */
1598 note(_("[データの初期化中... (アロケーション)]", "[Initializing arrays... (alloc)]"));
1599 if (init_alloc()) quit(_("アロケーション・スタッフ初期化不能", "Cannot initialize alloc stuff"));
1601 /*** Load default user pref files ***/
1603 /* Initialize feature info */
1604 note(_("[ユーザー設定ファイルを初期化しています...]", "[Initializing user pref files...]"));
1606 /* Access the "basic" pref file */
1607 strcpy(buf, "pref.prf");
1609 /* Process that file */
1610 process_pref_file(player_ptr, buf, process_autopick_file_command);
1612 /* Access the "basic" system pref file */
1613 sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
1615 /* Process that file */
1616 process_pref_file(player_ptr, buf, process_autopick_file_command);
1618 note(_("[初期化終了]", "[Initialization complete]"));
1626 static void put_title(void)
1630 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,
1632 sprintf(title, _("変愚蛮怒 %d.%d.%d(%s)", "Hengband %d.%d.%d(%s)"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH,
1634 IS_STABLE_VERSION ? _("安定版", "Stable") : _("開発版", "Developing"));
1635 int col = (80 - strlen(title)) / 2;
1636 col = col < 0 ? 0 : col;
1637 prt(title, VER_INFO_ROW, col);
1642 * @brief サムチェック情報を出力 / Get check sum in string form
1643 * @return サムチェック情報の文字列
1645 concptr get_check_sum(void)
1647 return format("%02x%02x%02x%02x%02x%02x%02x%02x%02x",