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 #include <sys/types.h>
64 static void put_title(void);
67 * @brief 各データファイルを読み取るためのパスを取得する
68 * Find the default paths to all of our important sub-directories.
69 * @param path パス保管先の文字列
73 * The purpose of each sub-directory is described in "variable.c".
74 * All of the sub-directories should, by default, be located inside
75 * the main "lib" directory, whose location is very system dependant.
76 * This function takes a writable buffer, initially containing the
77 * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
78 * or a system dependant string, for example, ":lib:". The buffer
79 * must be large enough to contain at least 32 more characters.
80 * Various command line options may allow some of the important
81 * directories to be changed to user-specified directories, most
82 * importantly, the "info" and "user" and "save" directories,
83 * but this is done after this function, see "main.c".
84 * In general, the initial path should end in the appropriate "PATH_SEP"
85 * string. All of the "sub-directory" paths (created below or supplied
86 * by the user) will NOT end in the "PATH_SEP" string, see the special
87 * "path_build()" function in "util.c" for more information.
88 * Mega-Hack -- support fat raw files under NEXTSTEP, using special
89 * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
90 * requiring the directories to be created by hand by the user.
91 * Hack -- first we free all the strings, since this is known
92 * to succeed even if the strings have not been allocated yet,
93 * as long as the variables start out as "NULL". This allows
94 * this function to be called multiple times, for example, to
95 * try several base "path" values until a good one is found.
98 void init_file_paths(char *path)
102 #ifdef PRIVATE_USER_PATH
104 #endif /* PRIVATE_USER_PATH */
106 /*** Free everything ***/
108 /* Free the main path */
109 string_free(ANGBAND_DIR);
111 /* Free the sub-paths */
112 string_free(ANGBAND_DIR_APEX);
113 string_free(ANGBAND_DIR_BONE);
114 string_free(ANGBAND_DIR_DATA);
115 string_free(ANGBAND_DIR_EDIT);
116 string_free(ANGBAND_DIR_SCRIPT);
117 string_free(ANGBAND_DIR_FILE);
118 string_free(ANGBAND_DIR_HELP);
119 string_free(ANGBAND_DIR_INFO);
120 string_free(ANGBAND_DIR_SAVE);
121 string_free(ANGBAND_DIR_USER);
122 string_free(ANGBAND_DIR_XTRA);
124 /*** Prepare the "path" ***/
126 /* Hack -- save the main directory */
127 ANGBAND_DIR = string_make(path);
129 /* Prepare to append to the Base Path */
130 tail = path + strlen(path);
132 /*** Build the sub-directory names ***/
134 /* Build a path name */
135 strcpy(tail, "apex");
136 ANGBAND_DIR_APEX = string_make(path);
138 /* Build a path name */
139 strcpy(tail, "bone");
140 ANGBAND_DIR_BONE = string_make(path);
142 /* Build a path name */
143 strcpy(tail, "data");
144 ANGBAND_DIR_DATA = string_make(path);
146 /* Build a path name */
147 strcpy(tail, "edit");
148 ANGBAND_DIR_EDIT = string_make(path);
150 /* Build a path name */
151 strcpy(tail, "script");
152 ANGBAND_DIR_SCRIPT = string_make(path);
154 /* Build a path name */
155 strcpy(tail, "file");
156 ANGBAND_DIR_FILE = string_make(path);
158 /* Build a path name */
159 strcpy(tail, "help");
160 ANGBAND_DIR_HELP = string_make(path);
162 /* Build a path name */
163 strcpy(tail, "info");
164 ANGBAND_DIR_INFO = string_make(path);
166 /* Build a path name */
167 strcpy(tail, "pref");
168 ANGBAND_DIR_PREF = string_make(path);
170 /* Build a path name */
171 strcpy(tail, "save");
172 ANGBAND_DIR_SAVE = string_make(path);
174 #ifdef PRIVATE_USER_PATH
176 /* Build the path to the user specific directory */
177 path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
179 /* Build a relative path name */
180 ANGBAND_DIR_USER = string_make(buf);
182 #else /* PRIVATE_USER_PATH */
184 /* Build a path name */
185 strcpy(tail, "user");
186 ANGBAND_DIR_USER = string_make(path);
188 #endif /* PRIVATE_USER_PATH */
190 /* Build a path name */
191 strcpy(tail, "xtra");
192 ANGBAND_DIR_XTRA = string_make(path);
197 /* Allow "fat binary" usage with NeXT */
218 /* Use special directory */
221 /* Forget the old path name */
222 string_free(ANGBAND_DIR_DATA);
224 /* Build a new path name */
225 sprintf(tail, "data-%s", next);
226 ANGBAND_DIR_DATA = string_make(path);
236 * Hack -- help give useful error messages
238 int error_idx; /*!< データ読み込み/初期化時に汎用的にエラーコードを保存するグローバル変数 */
239 int error_line; /*!< データ読み込み/初期化時に汎用的にエラー行数を保存するグローバル変数 */
242 * エラーメッセージの名称定義 / Standard error message text
244 concptr err_str[PARSE_ERROR_MAX] =
261 "missing record header",
262 "non-sequential records",
263 "invalid flag specification",
264 "undefined directive",
266 "coordinates out of bounds",
268 "undefined terrain tag",
277 header v_head; /*!< Vault情報のヘッダ構造体 */
278 header f_head; /*!< 地形情報のヘッダ構造体 */
279 header k_head; /*!< ペースアイテム情報のヘッダ構造体 */
280 header a_head; /*!< 固定アーティファクト情報のヘッダ構造体 */
281 header e_head; /*!< アイテムエゴ情報のヘッダ構造体 */
282 header r_head; /*!< モンスター種族情報のヘッダ構造体 */
283 header d_head; /*!< ダンジョン情報のヘッダ構造体 */
284 header s_head; /*!< プレイヤー職業技能情報のヘッダ構造体 */
285 header m_head; /*!< プレイヤー職業魔法情報のヘッダ構造体 */
288 * @brief テキストファイルとrawファイルの更新時刻を比較する
289 * Find the default paths to all of our important sub-directories.
290 * @param fd ファイルディスクリプタ
291 * @param template_file ファイル名
292 * @return テキストの方が新しいか、rawファイルがなく更新の必要がある場合-1、更新の必要がない場合0。
294 static errr check_modification_date(int fd, concptr template_file)
296 struct stat txt_stat, raw_stat;
298 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, template_file);
300 /* Access stats on text file */
301 if (stat(buf, &txt_stat))
306 /* Access stats on raw file */
307 if (fstat(fd, &raw_stat))
312 /* Ensure text file is not newer than raw file */
313 if (txt_stat.st_mtime > raw_stat.st_mtime)
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;
416 static void update_header(header *head, void **info, char **name, char **text, char **tag)
418 if (info) *info = head->info_ptr;
419 if (name) *name = head->name_ptr;
420 if (text) *text = head->text_ptr;
421 if (tag) *tag = head->tag_ptr;
427 * Initialize the "*_info" array
428 * @param filename ファイル名(拡張子txt/raw)
429 * @param head 処理に用いるヘッダ構造体
430 * @param info データ保管先の構造体ポインタ
431 * @param name 名称用可変文字列の保管先
432 * @param text テキスト用可変文字列の保管先
433 * @param tag タグ用可変文字列の保管先
436 * Note that we let each entry have a unique "name" and "text" string,
437 * even if the string happens to be empty (everyone has a unique '\0').
439 static errr init_info(concptr filename, header *head, void **info, char **name, char **text, char **tag)
444 /*** Load the binary image file ***/
445 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
447 /* Attempt to open the "raw" file */
448 int fd = fd_open(buf, O_RDONLY);
450 /* Process existing "raw" file */
454 err = check_modification_date(fd, format("%s.txt", filename));
456 /* Attempt to parse the "raw" file */
458 err = init_info_raw(fd, head);
462 /* Do we have to parse the *.txt file? */
463 BIT_FLAGS file_permission = 0644;
466 update_header(head, info, name, text, tag);
470 /*** Make the fake arrays ***/
471 C_MAKE(head->info_ptr, head->info_size, char);
473 /* Hack -- make "fake" arrays */
474 if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
475 if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
476 if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
478 if (info) (*info) = head->info_ptr;
479 if (name) (*name) = head->name_ptr;
480 if (text) (*text) = head->text_ptr;
481 if (tag) (*tag) = head->tag_ptr;
483 /*** Load the ascii template file ***/
484 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
486 fp = my_fopen(buf, "r");
489 if (!fp) quit(format(_("'%s.txt'ファイルをオープンできません。", "Cannot open '%s.txt' file."), filename));
492 err = init_info_txt(fp, buf, head, head->parse_info_txt);
502 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "未知の");
504 msg_format("'%s.txt'ファイルの %d 行目にエラー。", filename, error_line);
505 msg_format("レコード %d は '%s' エラーがあります。", error_idx, oops);
506 msg_format("構文 '%s'。", buf);
510 quit(format("'%s.txt'ファイルにエラー", filename));
513 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
515 msg_format("Error %d at line %d of '%s.txt'.", err, error_line, filename);
516 msg_format("Record %d contains a '%s' error.", error_idx, oops);
517 msg_format("Parsing '%s'.", buf);
521 quit(format("Error in '%s.txt' file.", filename));
525 /*** Make final retouch on fake tags ***/
528 (*head->retouch)(head);
531 /*** Dump the binary image file ***/
532 /* File type is "DATA" */
533 FILE_TYPE(FILE_TYPE_DATA);
534 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
536 /* Grab permissions */
539 /* Kill the old file */
542 /* Attempt to create the raw file */
543 fd = fd_make(buf, file_permission);
545 /* Drop permissions */
548 /* Dump to the file */
552 fd_write(fd, (concptr)(head), head->head_size);
554 /* Dump the "*_info" array */
555 fd_write(fd, head->info_ptr, head->info_size);
557 /* Dump the "*_name" array */
558 fd_write(fd, head->name_ptr, head->name_size);
560 /* Dump the "*_text" array */
561 fd_write(fd, head->text_ptr, head->text_size);
563 /* Dump the "*_tag" array */
564 fd_write(fd, head->tag_ptr, head->tag_size);
570 /*** Kill the fake arrays ***/
572 /* Free the "*_info" array */
573 C_KILL(head->info_ptr, head->info_size, char);
575 /* Hack -- Free the "fake" arrays */
576 if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char);
577 if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char);
578 if (tag) C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char);
580 /*** Load the binary image file ***/
581 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename));
583 /* Attempt to open the "raw" file */
584 fd = fd_open(buf, O_RDONLY);
586 /* Process existing "raw" file */
587 if (fd < 0) quit(format(_("'%s_j.raw'ファイルをロードできません。", "Cannot load '%s.raw' file."), filename));
589 /* Attempt to parse the "raw" file */
590 err = init_info_raw(fd, head);
594 if (err) quit(format(_("'%s_j.raw'ファイルを解析できません。", "Cannot parse '%s.raw' file."), filename));
596 update_header(head, info, name, text, tag);
602 * @brief 地形情報読み込みのメインルーチン /
603 * Initialize the "f_info" array
606 static errr init_f_info(void)
608 /* Init the header */
609 init_header(&f_head, max_f_idx, sizeof(feature_type));
611 /* Save a pointer to the parsing function */
612 f_head.parse_info_txt = parse_f_info;
614 /* Save a pointer to the retouch fake tags */
615 f_head.retouch = retouch_f_info;
617 return init_info("f_info", &f_head,
618 (void*)&f_info, &f_name, NULL, &f_tag);
623 * @brief ベースアイテム情報読み込みのメインルーチン /
624 * Initialize the "k_info" array
627 static errr init_k_info(void)
629 /* Init the header */
630 init_header(&k_head, max_k_idx, sizeof(object_kind));
632 /* Save a pointer to the parsing function */
633 k_head.parse_info_txt = parse_k_info;
635 return init_info("k_info", &k_head,
636 (void*)&k_info, &k_name, &k_text, NULL);
641 * @brief 固定アーティファクト情報読み込みのメインルーチン /
642 * Initialize the "a_info" array
645 static errr init_a_info(void)
647 /* Init the header */
648 init_header(&a_head, max_a_idx, sizeof(artifact_type));
650 /* Save a pointer to the parsing function */
651 a_head.parse_info_txt = parse_a_info;
653 return init_info("a_info", &a_head,
654 (void*)&a_info, &a_name, &a_text, NULL);
659 * @brief 固定アーティファクト情報読み込みのメインルーチン /
660 * Initialize the "e_info" array
663 static errr init_e_info(void)
665 /* Init the header */
666 init_header(&e_head, max_e_idx, sizeof(ego_item_type));
668 /* Save a pointer to the parsing function */
669 e_head.parse_info_txt = parse_e_info;
671 return init_info("e_info", &e_head,
672 (void*)&e_info, &e_name, &e_text, NULL);
677 * @brief モンスター種族情報読み込みのメインルーチン /
678 * Initialize the "r_info" array
681 static errr init_r_info(void)
683 /* Init the header */
684 init_header(&r_head, max_r_idx, sizeof(monster_race));
686 /* Save a pointer to the parsing function */
687 r_head.parse_info_txt = parse_r_info;
689 return init_info("r_info", &r_head,
690 (void*)&r_info, &r_name, &r_text, NULL);
695 * @brief ダンジョン情報読み込みのメインルーチン /
696 * Initialize the "d_info" array
699 static errr init_d_info(void)
701 /* Init the header */
702 init_header(&d_head, current_world_ptr->max_d_idx, sizeof(dungeon_type));
704 /* Save a pointer to the parsing function */
705 d_head.parse_info_txt = parse_d_info;
707 return init_info("d_info", &d_head,
708 (void*)&d_info, &d_name, &d_text, NULL);
713 * @brief Vault情報読み込みのメインルーチン /
714 * Initialize the "v_info" array
717 * Note that we let each entry have a unique "name" and "text" string,
718 * even if the string happens to be empty (everyone has a unique '\0').
720 errr init_v_info(void)
722 /* Init the header */
723 init_header(&v_head, max_v_idx, sizeof(vault_type));
725 /* Save a pointer to the parsing function */
726 v_head.parse_info_txt = parse_v_info;
728 return init_info("v_info", &v_head,
729 (void*)&v_info, &v_name, &v_text, NULL);
734 * @brief 職業技能情報読み込みのメインルーチン /
735 * Initialize the "s_info" array
738 static errr init_s_info(void)
740 /* Init the header */
741 init_header(&s_head, MAX_CLASS, sizeof(skill_table));
743 /* Save a pointer to the parsing function */
744 s_head.parse_info_txt = parse_s_info;
746 return init_info("s_info", &s_head,
747 (void*)&s_info, NULL, NULL, NULL);
752 * @brief 職業魔法情報読み込みのメインルーチン /
753 * Initialize the "m_info" array
756 static errr init_m_info(void)
758 /* Init the header */
759 init_header(&m_head, MAX_CLASS, sizeof(player_magic));
761 /* Save a pointer to the parsing function */
762 m_head.parse_info_txt = parse_m_info;
764 return init_info("m_info", &m_head,
765 (void*)&m_info, NULL, NULL, NULL);
770 * @brief 基本情報読み込みのメインルーチン /
771 * Initialize misc. values
772 * @param player_ptr プレーヤーへの参照ポインタ
775 static errr init_misc(player_type *player_ptr)
777 return process_dungeon_file(player_ptr, "misc.txt", 0, 0, 0, 0);
782 * @brief 町情報読み込みのメインルーチン /
783 * Initialize town array
786 static errr init_towns(void)
788 /* Allocate the towns */
789 C_MAKE(town_info, max_towns, town_type);
791 for (int i = 1; i < max_towns; i++)
793 /*** Prepare the Stores ***/
795 /* Allocate the stores */
796 C_MAKE(town_info[i].store, MAX_STORES, store_type);
798 /* Fill in each store */
799 for (int j = 0; j < MAX_STORES; j++)
801 /* Access the store */
802 store_type *st_ptr = &town_info[i].store[j];
804 if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME)) continue;
806 /* Assume full stock */
809 * 我が家が 20 ページまで使える隠し機能のための準備。
810 * オプションが有効でもそうでなくても一応スペースを作っておく。
814 st_ptr->stock_size = (STORE_INVEN_MAX * 10);
816 else if (j == STORE_MUSEUM)
818 st_ptr->stock_size = (STORE_INVEN_MAX * 50);
822 st_ptr->stock_size = STORE_INVEN_MAX;
825 /* Allocate the stock */
826 C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type);
828 /* No table for the black market or home */
829 if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM)) continue;
831 /* Assume full table */
832 st_ptr->table_size = STORE_CHOICES;
834 /* Allocate the stock */
835 C_MAKE(st_ptr->table, st_ptr->table_size, s16b);
837 /* Scan the choices */
838 for (int k = 0; k < STORE_CHOICES; k++)
840 KIND_OBJECT_IDX k_idx;
842 /* Extract the tval/sval codes */
843 int tv = store_table[j][k][0];
844 int sv = store_table[j][k][1];
847 for (k_idx = 1; k_idx < max_k_idx; k_idx++)
849 object_kind *k_ptr = &k_info[k_idx];
852 if ((k_ptr->tval == tv) && (k_ptr->sval == sv)) break;
856 if (k_idx == max_k_idx) continue;
858 /* Add that item index to the table */
859 st_ptr->table[st_ptr->table_num++] = k_idx;
868 * @brief 店情報初期化のメインルーチン /
869 * Initialize buildings
872 errr init_buildings(void)
874 for (int i = 0; i < MAX_BLDG; i++)
876 building[i].name[0] = '\0';
877 building[i].owner_name[0] = '\0';
878 building[i].owner_race[0] = '\0';
880 for (int j = 0; j < 8; j++)
882 building[i].act_names[j][0] = '\0';
883 building[i].member_costs[j] = 0;
884 building[i].other_costs[j] = 0;
885 building[i].letters[j] = 0;
886 building[i].actions[j] = 0;
887 building[i].action_restr[j] = 0;
890 for (int j = 0; j < MAX_CLASS; j++)
892 building[i].member_class[j] = 0;
895 for (int j = 0; j < MAX_RACES; j++)
897 building[i].member_race[j] = 0;
900 for (int j = 0; j < MAX_MAGIC + 1; j++)
902 building[i].member_realm[j] = 0;
911 * @brief クエスト情報初期化のメインルーチン /
912 * Initialize quest array
915 static errr init_quests(void)
917 /* Allocate the quests */
918 C_MAKE(quest, max_q_idx, quest_type);
920 /* Set all quest to "untaken" */
921 for (int i = 0; i < max_q_idx; i++)
923 quest[i].status = QUEST_STATUS_UNTAKEN;
929 /*! 地形タグ情報から地形IDを得られなかった場合にTRUEを返すグローバル変数 */
930 static bool feat_tag_is_not_found = FALSE;
933 * @brief 地形タグからIDを得る /
934 * Initialize quest array
937 s16b f_tag_to_index_in_init(concptr str)
939 FEAT_IDX feat = f_tag_to_index(str);
941 if (feat < 0) feat_tag_is_not_found = TRUE;
948 * @brief 地形の汎用定義をタグを通じて取得する /
949 * Initialize feature variables
952 static errr init_feat_variables(void)
954 feat_none = f_tag_to_index_in_init("NONE");
956 feat_floor = f_tag_to_index_in_init("FLOOR");
957 feat_glyph = f_tag_to_index_in_init("GLYPH");
958 feat_explosive_rune = f_tag_to_index_in_init("EXPLOSIVE_RUNE");
959 feat_mirror = f_tag_to_index_in_init("MIRROR");
961 feat_door[DOOR_DOOR].open = f_tag_to_index_in_init("OPEN_DOOR");
962 feat_door[DOOR_DOOR].broken = f_tag_to_index_in_init("BROKEN_DOOR");
963 feat_door[DOOR_DOOR].closed = f_tag_to_index_in_init("CLOSED_DOOR");
967 for (i = 1; i < MAX_LJ_DOORS; i++)
969 s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
971 feat_door[DOOR_DOOR].locked[i - 1] = door;
974 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
975 feat_door[DOOR_DOOR].num_locked = i - 1;
978 for (i = 0; i < MAX_LJ_DOORS; i++)
980 s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
982 feat_door[DOOR_DOOR].jammed[i] = door;
985 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
986 feat_door[DOOR_DOOR].num_jammed = i;
989 feat_door[DOOR_GLASS_DOOR].open = f_tag_to_index_in_init("OPEN_GLASS_DOOR");
990 feat_door[DOOR_GLASS_DOOR].broken = f_tag_to_index_in_init("BROKEN_GLASS_DOOR");
991 feat_door[DOOR_GLASS_DOOR].closed = f_tag_to_index_in_init("CLOSED_GLASS_DOOR");
993 /* Locked glass doors */
994 for (i = 1; i < MAX_LJ_DOORS; i++)
996 s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
998 feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door;
1001 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1002 feat_door[DOOR_GLASS_DOOR].num_locked = i - 1;
1004 /* Jammed glass doors */
1005 for (i = 0; i < MAX_LJ_DOORS; i++)
1007 s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
1008 if (door < 0) break;
1009 feat_door[DOOR_GLASS_DOOR].jammed[i] = door;
1012 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1013 feat_door[DOOR_GLASS_DOOR].num_jammed = i;
1016 feat_door[DOOR_CURTAIN].open = f_tag_to_index_in_init("OPEN_CURTAIN");
1017 feat_door[DOOR_CURTAIN].broken = feat_door[DOOR_CURTAIN].open;
1018 feat_door[DOOR_CURTAIN].closed = f_tag_to_index_in_init("CLOSED_CURTAIN");
1019 feat_door[DOOR_CURTAIN].locked[0] = feat_door[DOOR_CURTAIN].closed;
1020 feat_door[DOOR_CURTAIN].num_locked = 1;
1021 feat_door[DOOR_CURTAIN].jammed[0] = feat_door[DOOR_CURTAIN].closed;
1022 feat_door[DOOR_CURTAIN].num_jammed = 1;
1025 feat_up_stair = f_tag_to_index_in_init("UP_STAIR");
1026 feat_down_stair = f_tag_to_index_in_init("DOWN_STAIR");
1027 feat_entrance = f_tag_to_index_in_init("ENTRANCE");
1030 init_normal_traps();
1033 feat_trap_open = f_tag_to_index_in_init("TRAP_OPEN");
1034 feat_trap_armageddon = f_tag_to_index_in_init("TRAP_ARMAGEDDON");
1035 feat_trap_piranha = f_tag_to_index_in_init("TRAP_PIRANHA");
1038 feat_rubble = f_tag_to_index_in_init("RUBBLE");
1041 feat_magma_vein = f_tag_to_index_in_init("MAGMA_VEIN");
1042 feat_quartz_vein = f_tag_to_index_in_init("QUARTZ_VEIN");
1045 feat_granite = f_tag_to_index_in_init("GRANITE");
1046 feat_permanent = f_tag_to_index_in_init("PERMANENT");
1049 feat_glass_floor = f_tag_to_index_in_init("GLASS_FLOOR");
1052 feat_glass_wall = f_tag_to_index_in_init("GLASS_WALL");
1053 feat_permanent_glass_wall = f_tag_to_index_in_init("PERMANENT_GLASS_WALL");
1056 feat_pattern_start = f_tag_to_index_in_init("PATTERN_START");
1057 feat_pattern_1 = f_tag_to_index_in_init("PATTERN_1");
1058 feat_pattern_2 = f_tag_to_index_in_init("PATTERN_2");
1059 feat_pattern_3 = f_tag_to_index_in_init("PATTERN_3");
1060 feat_pattern_4 = f_tag_to_index_in_init("PATTERN_4");
1061 feat_pattern_end = f_tag_to_index_in_init("PATTERN_END");
1062 feat_pattern_old = f_tag_to_index_in_init("PATTERN_OLD");
1063 feat_pattern_exit = f_tag_to_index_in_init("PATTERN_EXIT");
1064 feat_pattern_corrupted = f_tag_to_index_in_init("PATTERN_CORRUPTED");
1067 feat_black_market = f_tag_to_index_in_init("BLACK_MARKET");
1068 feat_town = f_tag_to_index_in_init("TOWN");
1071 feat_deep_water = f_tag_to_index_in_init("DEEP_WATER");
1072 feat_shallow_water = f_tag_to_index_in_init("SHALLOW_WATER");
1073 feat_deep_lava = f_tag_to_index_in_init("DEEP_LAVA");
1074 feat_shallow_lava = f_tag_to_index_in_init("SHALLOW_LAVA");
1075 feat_heavy_cold_zone = f_tag_to_index_in_init("HEAVY_COLD_ZONE");
1076 feat_cold_zone = f_tag_to_index_in_init("COLD_ZONE");
1077 feat_heavy_electrical_zone = f_tag_to_index_in_init("HEAVY_ELECTRICAL_ZONE");
1078 feat_electrical_zone = f_tag_to_index_in_init("ELECTRICAL_ZONE");
1079 feat_deep_acid_puddle = f_tag_to_index_in_init("DEEP_ACID_PUDDLE");
1080 feat_shallow_acid_puddle = f_tag_to_index_in_init("SHALLOW_ACID_PUDDLE");
1081 feat_deep_poisonous_puddle = f_tag_to_index_in_init("DEEP_POISONOUS_PUDDLE");
1082 feat_shallow_poisonous_puddle = f_tag_to_index_in_init("SHALLOW_POISONOUS_PUDDLE");
1083 feat_dirt = f_tag_to_index_in_init("DIRT");
1084 feat_grass = f_tag_to_index_in_init("GRASS");
1085 feat_flower = f_tag_to_index_in_init("FLOWER");
1086 feat_brake = f_tag_to_index_in_init("BRAKE");
1087 feat_tree = f_tag_to_index_in_init("TREE");
1088 feat_mountain = f_tag_to_index_in_init("MOUNTAIN");
1089 feat_swamp = f_tag_to_index_in_init("SWAMP");
1091 feat_undetected = f_tag_to_index_in_init("UNDETECTED");
1093 init_wilderness_terrains();
1094 return feat_tag_is_not_found ? PARSE_ERROR_UNDEFINED_TERRAIN_TAG : 0;
1099 * @brief その他の初期情報更新 /
1100 * Initialize some other arrays
1103 static errr init_other(player_type *player_ptr)
1105 player_ptr->current_floor_ptr = &floor_info; // TODO:本当はこんなところで初期化したくない
1106 floor_type *floor_ptr = player_ptr->current_floor_ptr;
1108 /*** Prepare the "dungeon" information ***/
1110 /* Allocate and Wipe the object list */
1111 C_MAKE(floor_ptr->o_list, current_world_ptr->max_o_idx, object_type);
1113 /* Allocate and Wipe the monster list */
1114 C_MAKE(floor_ptr->m_list, current_world_ptr->max_m_idx, monster_type);
1116 /* Allocate and Wipe the monster process list */
1117 for (int i = 0; i < MAX_MTIMED; i++)
1119 C_MAKE(floor_ptr->mproc_list[i], current_world_ptr->max_m_idx, s16b);
1122 /* Allocate and Wipe the max dungeon level */
1123 C_MAKE(max_dlv, current_world_ptr->max_d_idx, DEPTH);
1125 for (int i = 0; i < MAX_HGT; i++)
1127 C_MAKE(floor_ptr->grid_array[i], MAX_WID, grid_type);
1130 /*** Prepare the various "bizarre" arrays ***/
1132 /* Macro variables */
1133 C_MAKE(macro__pat, MACRO_MAX, concptr);
1134 C_MAKE(macro__act, MACRO_MAX, concptr);
1135 C_MAKE(macro__cmd, MACRO_MAX, bool);
1137 /* Macro action buffer */
1138 C_MAKE(macro__buf, 1024, char);
1140 /* Quark variables */
1143 /* Message variables */
1144 C_MAKE(message__ptr, MESSAGE_MAX, u32b);
1145 C_MAKE(message__buf, MESSAGE_BUF, char);
1147 /* Hack -- No messages yet */
1148 message__tail = MESSAGE_BUF;
1150 /*** Prepare the options ***/
1152 /* Scan the options */
1153 for (int i = 0; option_info[i].o_desc; i++)
1155 int os = option_info[i].o_set;
1156 int ob = option_info[i].o_bit;
1158 /* Set the "default" options */
1159 if (!option_info[i].o_var) continue;
1162 option_mask[os] |= (1L << ob);
1165 if (option_info[i].o_norm)
1168 option_flag[os] |= (1L << ob);
1172 option_flag[os] &= ~(1L << ob);
1176 /* Analyze the windows */
1177 for (int n = 0; n < 8; n++)
1179 /* Analyze the options */
1180 for (int i = 0; i < 32; i++)
1183 if (window_flag_desc[i])
1186 window_mask[n] |= (1L << i);
1192 * Set the "default" window flags
1193 * Window 1 : Display messages
1194 * Window 2 : Display inven/equip
1196 window_flag[1] = 1L << A_MAX;
1197 window_flag[2] = 1L << 0;
1199 /*** Pre-allocate space for the "format()" buffer ***/
1201 /* Hack -- Just call the "format()" function */
1202 (void)format("%s (%s).", "Mr.Hoge", MAINTAINER);
1208 * @brief オブジェクト配列を初期化する /
1209 * Initialize some other arrays
1212 static errr init_object_alloc(void)
1214 s16b aux[MAX_DEPTH];
1215 (void)C_WIPE(&aux, MAX_DEPTH, s16b);
1217 s16b num[MAX_DEPTH];
1218 (void)C_WIPE(&num, MAX_DEPTH, s16b);
1220 /* Free the old "alloc_kind_table" (if it exists) */
1221 if (alloc_kind_table)
1223 C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
1226 /* Size of "alloc_kind_table" */
1227 alloc_kind_size = 0;
1229 /* Scan the objects */
1230 for (int i = 1; i < max_k_idx; i++)
1235 /* Scan allocation pairs */
1236 for (int j = 0; j < 4; j++)
1238 /* Count the "legal" entries */
1239 if (k_ptr->chance[j])
1241 /* Count the entries */
1244 /* Group by level */
1245 num[k_ptr->locale[j]]++;
1250 /* Collect the level indexes */
1251 for (int i = 1; i < MAX_DEPTH; i++)
1253 /* Group by level */
1254 num[i] += num[i - 1];
1257 if (!num[0]) quit(_("町のアイテムがない!", "No town objects!"));
1259 /*** Initialize object allocation info ***/
1261 /* Allocate the alloc_kind_table */
1262 C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
1264 /* Access the table entry */
1266 table = alloc_kind_table;
1268 /* Scan the objects */
1269 for (int i = 1; i < max_k_idx; i++)
1274 /* Scan allocation pairs */
1275 for (int j = 0; j < 4; j++)
1277 /* Count the "legal" entries */
1278 if (k_ptr->chance[j] == 0) continue;
1280 /* Extract the base level */
1281 int x = k_ptr->locale[j];
1283 /* Extract the base probability */
1284 int p = (100 / k_ptr->chance[j]);
1286 /* Skip entries preceding our locale */
1287 int y = (x > 0) ? num[x - 1] : 0;
1289 /* Skip previous entries at this locale */
1292 /* Load the entry */
1293 table[z].index = (KIND_OBJECT_IDX)i;
1294 table[z].level = (DEPTH)x;
1295 table[z].prob1 = (PROB)p;
1296 table[z].prob2 = (PROB)p;
1297 table[z].prob3 = (PROB)p;
1299 /* Another entry complete for this locale */
1309 * @brief モンスター配列と生成テーブルを初期化する /
1310 * Initialize some other arrays
1313 static errr init_alloc(void)
1315 monster_race *r_ptr;
1318 /* Allocate the "r_info" array */
1319 C_MAKE(elements, max_r_idx, tag_type);
1321 /* Scan the monsters */
1322 for (int i = 1; i < max_r_idx; i++)
1324 elements[i].tag = r_info[i].level;
1325 elements[i].index = i;
1328 tag_sort(elements, max_r_idx);
1330 /*** Initialize monster allocation info ***/
1332 /* Size of "alloc_race_table" */
1333 alloc_race_size = max_r_idx;
1335 /* Allocate the alloc_race_table */
1336 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
1338 /* Scan the monsters */
1339 for (int i = 1; i < max_r_idx; i++)
1341 /* Get the i'th race */
1342 r_ptr = &r_info[elements[i].index];
1344 /* Count valid pairs */
1345 if (r_ptr->rarity == 0) continue;
1347 /* Extract the base level */
1348 int x = r_ptr->level;
1350 /* Extract the base probability */
1351 int p = (100 / r_ptr->rarity);
1353 /* Load the entry */
1354 alloc_race_table[i].index = (KIND_OBJECT_IDX)elements[i].index;
1355 alloc_race_table[i].level = (DEPTH)x;
1356 alloc_race_table[i].prob1 = (PROB)p;
1357 alloc_race_table[i].prob2 = (PROB)p;
1358 alloc_race_table[i].prob3 = (PROB)p;
1361 /* Free the "r_info" array */
1362 C_KILL(elements, max_r_idx, tag_type);
1363 (void)init_object_alloc();
1369 * @brief 画面左下にシステムメッセージを表示する /
1370 * Hack -- take notes on line 23
1373 static void note(concptr str)
1375 Term_erase(0, 23, 255);
1376 Term_putstr(20, 23, -1, TERM_WHITE, str);
1382 * @brief 全ゲームデータ読み込みのサブルーチン /
1383 * Hack -- Explain a broken "lib" folder and quit (see below).
1387 * This function is "messy" because various things
1388 * may or may not be initialized, but the "plog()" and "quit()"
1389 * functions are "supposed" to work under any conditions.
1392 static void init_angband_aux(concptr why)
1398 plog("'lib'ディレクトリが存在しないか壊れているようです。");
1401 plog("ひょっとするとアーカイブが正しく解凍されていないのかもしれません。");
1404 plog("該当する'README'ファイルを読んで確認してみて下さい。");
1406 /* Quit with error */
1410 plog("The 'lib' directory is probably missing or broken.");
1413 plog("Perhaps the archive was not extracted correctly.");
1416 plog("See the 'README' file for more information.");
1418 /* Quit with error */
1419 quit("Fatal Error.");
1426 * @brief 全ゲームデータ読み込みのメインルーチン /
1427 * Hack -- main Angband initialization entry point
1431 * This function is "messy" because various things
1432 * may or may not be initialized, but the "plog()" and "quit()"
1433 * functions are "supposed" to work under any conditions.
1434 * Verify some files, display the "news.txt" file, create
1435 * the high score file, initialize all internal arrays, and
1436 * load the basic "user pref files".
1437 * Be very careful to keep track of the order in which things
1438 * are initialized, in particular, the only thing *known* to
1439 * be available when this function is called is the "z-term.c"
1440 * package, and that may not be fully initialized until the
1441 * end of this function, when the default "user pref files"
1442 * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
1443 * Note that this function attempts to verify the "news" file,
1444 * and the game aborts (cleanly) on failure, since without the
1445 * "news" file, it is likely that the "lib" folder has not been
1446 * correctly located. Otherwise, the news file is displayed for
1448 * Note that this function attempts to verify (or create) the
1449 * "high score" file, and the game aborts (cleanly) on failure,
1450 * since one of the most common "extraction" failures involves
1451 * failing to extract all sub-directories (even empty ones), such
1452 * as by failing to use the "-d" option of "pkunzip", or failing
1453 * to use the "save empty directories" option with "Compact Pro".
1454 * This error will often be caught by the "high score" creation
1455 * code below, since the "lib/apex" directory, being empty in the
1456 * standard distributions, is most likely to be "lost", making it
1457 * impossible to create the high score file.
1458 * Note that various things are initialized by this function,
1459 * including everything that was once done by "init_some_arrays".
1460 * This initialization involves the parsing of special files
1461 * in the "lib/data" and sometimes the "lib/edit" directories.
1462 * Note that the "template" files are initialized first, since they
1463 * often contain errors. This means that macros and message recall
1464 * and things like that are not available until after they are done.
1465 * We load the default "user pref files" here in case any "color"
1466 * changes are needed before character creation.
1467 * Note that the "graf-xxx.prf" file must be loaded separately,
1468 * if needed, in the first (?) pass through "TERM_XTRA_REACT".
1471 void init_angband(player_type *player_ptr)
1473 /*** Verify the "news" file ***/
1475 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1477 /* Attempt to open the file */
1478 int fd = fd_open(buf, O_RDONLY);
1485 sprintf(why, _("'%s'ファイルにアクセスできません!", "Cannot access the '%s' file!"), buf);
1487 /* Crash and burn */
1488 init_angband_aux(why);
1493 /*** Display the "news" file ***/
1495 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
1497 /* Open the News file */
1499 fp = my_fopen(buf, "r");
1504 /* Dump the file to the screen */
1506 while (0 == my_fgets(fp, buf, sizeof(buf)))
1508 /* Display and advance */
1509 Term_putstr(0, i++, -1, TERM_WHITE, buf);
1517 /*** Verify (or create) the "high score" file ***/
1518 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
1520 /* Attempt to open the high score file */
1521 fd = fd_open(buf, O_RDONLY);
1523 BIT_FLAGS file_permission = 0664;
1526 /* File type is "DATA" */
1527 FILE_TYPE(FILE_TYPE_DATA);
1529 /* Grab permissions */
1532 /* Create a new high score file */
1533 fd = fd_make(buf, file_permission);
1535 /* Drop permissions */
1543 sprintf(why, _("'%s'ファイルを作成できません!", "Cannot create the '%s' file!"), buf);
1545 /* Crash and burn */
1546 init_angband_aux(why);
1554 /*** Initialize some arrays ***/
1556 /* Initialize misc. values */
1557 note(_("[変数を初期化しています...(その他)", "[Initializing values... (misc)]"));
1558 if (init_misc(player_ptr)) quit(_("その他の変数を初期化できません", "Cannot initialize misc. values"));
1560 /* Initialize feature info */
1562 note("[データの初期化中... (地形)]");
1563 if (init_f_info()) quit("地形初期化不能");
1564 if (init_feat_variables()) quit("地形初期化不能");
1566 note("[Initializing arrays... (features)]");
1567 if (init_f_info()) quit("Cannot initialize features");
1568 if (init_feat_variables()) quit("Cannot initialize features");
1571 /* Initialize object info */
1572 note(_("[データの初期化中... (アイテム)]", "[Initializing arrays... (objects)]"));
1573 if (init_k_info()) quit(_("アイテム初期化不能", "Cannot initialize objects"));
1575 /* Initialize artifact info */
1576 note(_("[データの初期化中... (伝説のアイテム)]", "[Initializing arrays... (artifacts)]"));
1577 if (init_a_info()) quit(_("伝説のアイテム初期化不能", "Cannot initialize artifacts"));
1580 /* Initialize ego-item info */
1581 note(_("[データの初期化中... (名のあるアイテム)]", "[Initializing arrays... (ego-items)]"));
1582 if (init_e_info()) quit(_("名のあるアイテム初期化不能", "Cannot initialize ego-items"));
1585 /* Initialize monster info */
1586 note(_("[データの初期化中... (モンスター)]", "[Initializing arrays... (monsters)]"));
1587 if (init_r_info()) quit(_("モンスター初期化不能", "Cannot initialize monsters"));
1590 /* Initialize dungeon info */
1591 note(_("[データの初期化中... (ダンジョン)]", "[Initializing arrays... (dungeon)]"));
1592 if (init_d_info()) quit(_("ダンジョン初期化不能", "Cannot initialize dungeon"));
1594 for (int i = 1; i < current_world_ptr->max_d_idx; i++)
1595 if (d_info[i].final_guardian)
1596 r_info[d_info[i].final_guardian].flags7 |= RF7_GUARDIAN;
1599 /* Initialize magic info */
1600 note(_("[データの初期化中... (魔法)]", "[Initializing arrays... (magic)]"));
1601 if (init_m_info()) quit(_("魔法初期化不能", "Cannot initialize magic"));
1603 /* Initialize weapon_exp info */
1604 note(_("[データの初期化中... (熟練度)]", "[Initializing arrays... (skill)]"));
1605 if (init_s_info()) quit(_("熟練度初期化不能", "Cannot initialize skill"));
1607 /* Initialize wilderness array */
1608 note(_("[配列を初期化しています... (荒野)]", "[Initializing arrays... (wilderness)]"));
1610 if (init_wilderness()) quit(_("荒野を初期化できません", "Cannot initialize wilderness"));
1612 /* Initialize town array */
1613 note(_("[配列を初期化しています... (街)]", "[Initializing arrays... (towns)]"));
1614 if (init_towns()) quit(_("街を初期化できません", "Cannot initialize towns"));
1616 /* Initialize building array */
1617 note(_("[配列を初期化しています... (建物)]", "[Initializing arrays... (buildings)]"));
1618 if (init_buildings()) quit(_("建物を初期化できません", "Cannot initialize buildings"));
1620 /* Initialize quest array */
1621 note(_("[配列を初期化しています... (クエスト)]", "[Initializing arrays... (quests)]"));
1622 if (init_quests()) quit(_("クエストを初期化できません", "Cannot initialize quests"));
1624 /* Initialize vault info */
1625 if (init_v_info()) quit(_("vault 初期化不能", "Cannot initialize vaults"));
1627 /* Initialize some other arrays */
1628 note(_("[データの初期化中... (その他)]", "[Initializing arrays... (other)]"));
1629 if (init_other(player_ptr)) quit(_("その他のデータ初期化不能", "Cannot initialize other stuff"));
1631 /* Initialize some other arrays */
1632 note(_("[データの初期化中... (アロケーション)]", "[Initializing arrays... (alloc)]"));
1633 if (init_alloc()) quit(_("アロケーション・スタッフ初期化不能", "Cannot initialize alloc stuff"));
1635 /*** Load default user pref files ***/
1637 /* Initialize feature info */
1638 note(_("[ユーザー設定ファイルを初期化しています...]", "[Initializing user pref files...]"));
1640 /* Access the "basic" pref file */
1641 strcpy(buf, "pref.prf");
1643 /* Process that file */
1644 process_pref_file(player_ptr, buf);
1646 /* Access the "basic" system pref file */
1647 sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
1649 /* Process that file */
1650 process_pref_file(player_ptr, buf);
1652 note(_("[初期化終了]", "[Initialization complete]"));
1660 static void put_title(void)
1664 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,
1666 sprintf(title, _("変愚蛮怒 %d.%d.%d(%s)", "Hengband %d.%d.%d(%s)"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH,
1668 IS_STABLE_VERSION ? _("安定版", "Stable") : _("開発版", "Developing"));
1669 int col = (80 - strlen(title)) / 2;
1670 col = col < 0 ? 0 : col;
1671 prt(title, VER_INFO_ROW, col);
1676 * @brief サムチェック情報を出力 / Get check sum in string form
1677 * @return サムチェック情報の文字列
1679 concptr get_check_sum(void)
1681 return format("%02x%02x%02x%02x%02x%02x%02x%02x%02x",