1 #include "main/info-initializer.h"
2 #include "dungeon/dungeon.h"
3 #include "grid/feature.h"
4 #include "info-reader/artifact-reader.h"
5 #include "info-reader/dungeon-reader.h"
6 #include "info-reader/ego-reader.h"
7 #include "info-reader/feature-reader.h"
8 #include "info-reader/fixed-map-parser.h"
9 #include "info-reader/general-parser.h"
10 #include "info-reader/kind-reader.h"
11 #include "info-reader/magic-reader.h"
12 #include "info-reader/race-reader.h"
13 #include "info-reader/skill-reader.h"
14 #include "info-reader/vault-reader.h"
15 #include "io/files-util.h"
16 #include "io/uid-checker.h"
17 #include "main/angband-headers.h"
18 #include "main/init-error-messages-table.h"
19 #include "monster-race/monster-race.h"
20 #include "object-enchant/object-ego.h"
21 #include "object/object-kind.h"
22 #include "player/player-class.h"
23 #include "player/player-skill.h"
24 #include "room/rooms-vault.h"
25 #include "system/angband-version.h"
26 #include "system/artifact-type-definition.h"
27 #include "util/angband-files.h"
28 #include "view/display-messages.h"
29 #include "world/world.h"
32 #include <sys/types.h>
36 * @brief 基本情報読み込みのメインルーチン /
37 * Initialize misc. values
38 * @param player_ptr プレーヤーへの参照ポインタ
41 errr init_misc(player_type *player_ptr) { return parse_fixed_map(player_ptr, "misc.txt", 0, 0, 0, 0); }
45 * Initialize the header of an *_info.raw file.
46 * @param head rawファイルのヘッダ
51 static void init_header(angband_header *head, IDX num)
54 head->info_num = (IDX)num;
58 * @brief 各種設定データをlib/edit/のテキストから読み込み
59 * Initialize the "*_info" array
60 * @param filename ファイル名(拡張子txt)
61 * @param head 処理に用いるヘッダ構造体
62 * @param info データ保管先の構造体ポインタ
65 * Note that we let each entry have a unique "name" and "text" string,
66 * even if the string happens to be empty (everyone has a unique '\0').
68 template <typename InfoType>
69 static errr init_info(concptr filename, angband_header &head, std::vector<InfoType> &info, parse_info_txt_func parser, void (*retouch)(angband_header *head))
72 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
74 FILE *fp = angband_fopen(buf, "r");
77 quit(format(_("'%s.txt'ファイルをオープンできません。", "Cannot open '%s.txt' file."), filename));
79 info = std::vector<InfoType>(head.info_num);
81 errr err = init_info_txt(fp, buf, &head, parser);
85 concptr oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : _("未知の", "unknown"));
87 msg_format("'%s.txt'ファイルの %d 行目にエラー。", filename, error_line);
89 msg_format("Error %d at line %d of '%s.txt'.", err, error_line, filename);
91 msg_format(_("レコード %d は '%s' エラーがあります。", "Record %d contains a '%s' error."), error_idx, oops);
92 msg_format(_("構文 '%s'。", "Parsing '%s'."), buf);
94 quit(format(_("'%s.txt'ファイルにエラー", "Error in '%s.txt' file."), filename));
104 * @brief 地形情報読み込みのメインルーチン /
105 * Initialize the "f_info" array
110 init_header(&f_head, max_f_idx);
111 return init_info("f_info", f_head, f_info, parse_f_info, retouch_f_info);
115 * @brief ベースアイテム情報読み込みのメインルーチン /
116 * Initialize the "k_info" array
121 init_header(&k_head, max_k_idx);
122 return init_info("k_info", k_head, k_info, parse_k_info, NULL);
126 * @brief 固定アーティファクト情報読み込みのメインルーチン /
127 * Initialize the "a_info" array
132 init_header(&a_head, max_a_idx);
133 return init_info("a_info", a_head, a_info, parse_a_info, NULL);
137 * @brief 固定アーティファクト情報読み込みのメインルーチン /
138 * Initialize the "e_info" array
143 init_header(&e_head, max_e_idx);
144 return init_info("e_info", e_head, e_info, parse_e_info, NULL);
148 * @brief モンスター種族情報読み込みのメインルーチン /
149 * Initialize the "r_info" array
154 init_header(&r_head, max_r_idx);
155 return init_info("r_info", r_head, r_info, parse_r_info, NULL);
159 * @brief ダンジョン情報読み込みのメインルーチン /
160 * Initialize the "d_info" array
165 init_header(&d_head, current_world_ptr->max_d_idx);
166 return init_info("d_info", d_head, d_info, parse_d_info, NULL);
170 * @brief Vault情報読み込みのメインルーチン /
171 * Initialize the "v_info" array
174 * Note that we let each entry have a unique "name" and "text" string,
175 * even if the string happens to be empty (everyone has a unique '\0').
179 init_header(&v_head, max_v_idx);
180 return init_info("v_info", v_head, v_info, parse_v_info, NULL);
184 * @brief 職業技能情報読み込みのメインルーチン /
185 * Initialize the "s_info" array
190 init_header(&s_head, MAX_CLASS);
191 return init_info("s_info", s_head, s_info, parse_s_info, NULL);
195 * @brief 職業魔法情報読み込みのメインルーチン /
196 * Initialize the "m_info" array
201 init_header(&m_head, MAX_CLASS);
202 return init_info("m_info", m_head, m_info, parse_m_info, NULL);