7 #include "dungeon-file.h"
8 #include "rooms-vault.h"
14 #include "player-skill.h"
15 #include "player-race.h"
20 #include "rooms-vault.h"
21 #include "objectkind.h"
22 #include "object-ego.h"
23 #include "monsterrace.h"
24 #include "floor-town.h"
27 dungeon_grid letter[255];
31 * @brief ゲームデータ初期化1 / Initialization (part 1) -BEN-
35 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
36 * This software may be copied and distributed for educational, research,
37 * and not for profit purposes provided that this copyright and statement
38 * are included in all such copies. Other copyrights may also apply.
39 * 2014 Deskull rearranged comment for Doxygen.\n
43 * This file is used to initialize various variables and arrays for the
44 * Angband game. Note the use of "fd_read()" and "fd_write()" to bypass
45 * the common limitation of "read()" and "write()" to only 32767 bytes
47 * Several of the arrays for Angband are built from "template" files in
48 * the "lib/file" directory, from which quick-load binary "image" files
49 * are constructed whenever they are not present in the "lib/data"
50 * directory, or if those files become obsolete, if we are allowed.
51 * Warning -- the "ascii" file parsers use a minor hack to collect the
52 * name and text information in a single pass. Thus, the game will not
53 * be able to load any template file with more than 20K of names or 60K
54 * of text, even though technically, up to 64K should be legal.
56 * Note that if "ALLOW_TEMPLATES" is not defined, then a lot of the code
57 * in this file is compiled out, and the game will not run unless valid
58 * "binary template files" already exist in "lib/data". Thus, one can
59 * compile Angband with ALLOW_TEMPLATES defined, run once to create the
60 * "*.raw" files in "lib/data", and then quit, and recompile without
61 * defining ALLOW_TEMPLATES, which will both save 20K and prevent people
62 * from changing the ascii template files in potentially dangerous ways.
63 * ノートとして記録:ALLOW_TEMPLATESが定義されていない場合、
64 * このファイルのコードの多くはコンパイル出力され、本ゲームは
65 * 正規の「バイナリテンプレートファイル」がlib/dataファイル内に
66 * 存在しない限り起動しなくなる。一方ALLOW_TEMPLATESが定義されている
67 * ならば1度ゲームが起動するごとに*.rawファイル群が作成され、終了時には
68 * ALLOW_TEMPLATEの定義に関係なくリコンパイルされる。これにより20K(バイト?)
69 * のデータが保存され、プレイヤーが潜在的に危険な方法でascii文字の
70 * テンプレートファイルを変更することを妨げることができる。
71 * The code could actually be removed and placed into a "stand-alone"
72 * program, but that feels a little silly, especially considering some
73 * of the platforms that we currently support.
78 #include "dungeon-file.h"
83 #include "cmd-activate.h"
87 #include "view-mainwindow.h"
88 #include "player-class.h"
90 #ifdef ALLOW_TEMPLATES
94 /*** Helper arrays for parsing ascii template files ***/
98 * Monster Blow Methods
100 static concptr r_info_blow_method[] =
132 * モンスターの打撃属性トークンの定義 /
133 * Monster Blow Effects
135 static concptr r_info_blow_effect[] =
180 static concptr f_info_flags[] =
304 static concptr r_info_flags1[] =
344 static concptr r_info_flags2[] =
384 static concptr r_info_flags3[] =
424 static concptr r_info_flags4[] =
461 * モンスター特性トークン(発動型能力1) /
464 static concptr r_a_ability_flags1[] =
501 * モンスター特性トークン(発動型能力2) /
504 static concptr r_a_ability_flags2[] =
521 "ANIM_DEAD", /* ToDo: Implement ANIM_DEAD */
542 * モンスター特性トークン(発動型能力3) /
545 static concptr r_a_ability_flags3[] =
584 * モンスター特性トークン(発動型能力4) /
587 static concptr r_a_ability_flags4[] =
629 static concptr r_info_flags7[] =
669 static concptr r_info_flags8[] =
701 "WILD_SWAMP", /* ToDo: Implement Swamp */
709 static concptr r_info_flags9[] =
747 * モンスター特性トークンの定義R(耐性) /
750 static concptr r_info_flagsr[] =
787 * オブジェクト基本特性トークンの定義 /
790 static concptr k_info_flags[] =
887 "XXX3", /* Fake flag for Smith */
888 "XXX4", /* Fake flag for Smith */
938 * オブジェクト生成特性トークンの定義 /
941 static concptr k_info_gen_flags[] =
981 static concptr d_info_flags1[] =
1018 * @brief データの可変文字列情報をテキストとして保管する /
1019 * Add a text to the text-storage and store offset to it.
1020 * @param offset 文字列保管ポインタからのオフセット
1021 * @param head テキスト保管ヘッダ情報の構造体参照ポインタ
1023 * @param normal_text テキストの正規化を行う
1026 * Returns FALSE when there isn't enough space available to store
1029 static bool add_text(u32b *offset, header *head, concptr buf, bool normal_text)
1031 /* Hack -- Verify space */
1032 if (head->text_size + strlen(buf) + 8 > FAKE_TEXT_SIZE)
1038 /* Advance and save the text index */
1039 *offset = ++head->text_size;
1042 /* Additional text */
1043 else if (normal_text)
1046 * If neither the end of the last line nor
1047 * the beginning of current line is not a space,
1048 * fill up a space as a correct separator of two words.
1050 if (head->text_size > 0 &&
1052 (*(head->text_ptr + head->text_size - 1) != ' ') &&
1053 ((head->text_size == 1) || !iskanji(*(head->text_ptr + head->text_size - 2))) &&
1054 (buf[0] != ' ') && !iskanji(buf[0])
1056 (*(head->text_ptr + head->text_size - 1) != ' ') &&
1061 /* Append a space */
1062 *(head->text_ptr + head->text_size) = ' ';
1064 /* Advance the index */
1069 strcpy(head->text_ptr + head->text_size, buf);
1070 head->text_size += strlen(buf);
1076 * @brief データの可変文字列情報を名前として保管する /
1077 * Add a name to the name-storage and return an offset to it.
1078 * @param offset 文字列保管ポインタからのオフセット
1079 * @param head テキスト保管ヘッダ情報の構造体参照ポインタ
1083 * Returns FALSE when there isn't enough space available to store
1086 static bool add_name(u32b *offset, header *head, concptr buf)
1088 /* Hack -- Verify space */
1089 if (head->name_size + strlen(buf) + 8 > FAKE_NAME_SIZE)
1095 /* Advance and save the name index */
1096 *offset = ++head->name_size;
1099 /* Append chars to the names */
1100 strcpy(head->name_ptr + head->name_size, buf);
1102 /* Advance the index */
1103 head->name_size += strlen(buf);
1111 * @brief データの可変文字列情報をタグとして保管する /
1112 * Add a tag to the tag-storage and return an offset to it.
1113 * @param offset 文字列保管ポインタからのオフセット
1114 * @param head テキスト保管ヘッダ情報の構造体参照ポインタ
1118 * Returns FALSE when there isn't enough space available to store
1121 static bool add_tag(STR_OFFSET *offset, header *head, concptr buf)
1125 /* Search for an existing (fake) tag */
1126 for (i = 1; i < head->tag_size; i += strlen(&head->tag_ptr[i]) + 1)
1129 if (streq(&head->tag_ptr[i], buf)) break;
1132 /* There was no existing tag */
1133 if (i >= head->tag_size)
1135 /* Hack -- Verify space */
1136 if (head->tag_size + strlen(buf) + 8 > FAKE_TAG_SIZE)
1139 /* Append chars to the tags */
1140 strcpy(head->tag_ptr + head->tag_size, buf);
1142 /* Point the new tag */
1145 /* Advance the index */
1146 head->tag_size += strlen(buf) + 1;
1154 /*** Initialize from ascii template files ***/
1158 * @brief パース関数に基づいてデータファイルからデータを読み取る /
1159 * Initialize an "*_info" array, by parsing an ascii "template" file
1160 * @param fp 読み取りに使うファイルポインタ
1161 * @param buf 読み取りに使うバッファ領域
1162 * @param head ヘッダ構造体
1163 * @param parse_info_txt_line パース関数
1166 errr init_info_txt(FILE *fp, char *buf, header *head, parse_info_txt_func parse_info_txt_line)
1168 /* Just before the first record */
1171 /* Just before the first line */
1174 /* Prepare the "fake" stuff */
1175 head->name_size = 0;
1176 head->text_size = 0;
1181 while (my_fgets(fp, buf, 1024) == 0)
1183 /* Advance the line number */
1186 /* Skip comments and blank lines */
1187 if (!buf[0] || (buf[0] == '#')) continue;
1189 /* Verify correct "colon" format */
1190 if (buf[1] != ':') return (PARSE_ERROR_GENERIC);
1193 /* Hack -- Process 'V' for "Version" */
1200 /* Mega Hack -- Calculate Check Sum */
1201 if (buf[0] != 'N' && buf[0] != 'D')
1204 for (i = 0; buf[i]; i++)
1206 head->v_extra += (byte)buf[i];
1207 head->v_extra ^= (1 << (i % 8));
1211 /* Parse the line */
1212 if ((err = (*parse_info_txt_line)(buf, head)) != 0)
1217 /* Complete the "name" and "text" sizes */
1218 if (head->name_size) head->name_size++;
1219 if (head->text_size) head->text_size++;
1227 * @brief Vault情報(v_info)のパース関数 /
1228 * Initialize the "v_info" array, by parsing an ascii "template" file
1230 * @param head ヘッダ構造体
1233 errr parse_v_info(char *buf, header *head)
1239 static vault_type *v_ptr = NULL;
1241 /* Process 'N' for "New/Number/Name" */
1244 /* Find the colon before the name */
1245 s = my_strchr(buf + 2, ':');
1247 /* Verify that colon */
1250 /* Nuke the colon, advance to the name */
1253 /* Paranoia -- require a name */
1259 /* Verify information */
1260 if (i <= error_idx) return (4);
1262 /* Verify information */
1263 if (i >= head->info_num) return (2);
1265 /* Save the index */
1268 /* Point at the "info" */
1271 /* Store the name */
1272 if (!add_name(&v_ptr->name, head, s)) return (7);
1275 /* There better be a current v_ptr */
1276 else if (!v_ptr) return (3);
1278 /* Process 'D' for "Description" */
1279 else if (buf[0] == 'D')
1281 /* Acquire the text */
1284 /* Store the text */
1285 if (!add_text(&v_ptr->text, head, s, FALSE)) return (7);
1288 /* Process 'X' for "Extra info" (one line only) */
1289 else if (buf[0] == 'X')
1291 EFFECT_ID typ, rat, hgt, wid;
1293 /* Scan for the values */
1294 if (4 != sscanf(buf + 2, "%d:%d:%d:%d",
1295 &typ, &rat, &hgt, &wid)) return 1;
1297 /* Save the values */
1298 v_ptr->typ = (ROOM_IDX)typ;
1299 v_ptr->rat = (PROB)rat;
1300 v_ptr->hgt = (POSITION)hgt;
1301 v_ptr->wid = (POSITION)wid;
1312 * @brief 職業技能情報(s_info)のパース関数 /
1313 * Initialize the "s_info" array, by parsing an ascii "template" file
1315 * @param head ヘッダ構造体
1318 errr parse_s_info(char *buf, header *head)
1323 static skill_table *s_ptr = NULL;
1326 /* Process 'N' for "New/Number/Name" */
1332 /* Verify information */
1333 if (i <= error_idx) return (4);
1335 /* Verify information */
1336 if (i >= head->info_num) return (2);
1338 /* Save the index */
1341 /* Point at the "info" */
1345 /* There better be a current s_ptr */
1346 else if (!s_ptr) return (3);
1348 /* Process 'W' for "Weapon exp" */
1349 else if (buf[0] == 'W')
1351 int tval, sval, start, max;
1352 const s16b exp_conv_table[] =
1354 WEAPON_EXP_UNSKILLED, WEAPON_EXP_BEGINNER, WEAPON_EXP_SKILLED,
1355 WEAPON_EXP_EXPERT, WEAPON_EXP_MASTER
1358 /* Scan for the values */
1359 if (4 != sscanf(buf + 2, "%d:%d:%d:%d",
1360 &tval, &sval, &start, &max)) return 1;
1362 if (start < EXP_LEVEL_UNSKILLED || start > EXP_LEVEL_MASTER
1363 || max < EXP_LEVEL_UNSKILLED || max > EXP_LEVEL_MASTER) return (8);
1365 /* Save the values */
1366 s_ptr->w_start[tval][sval] = exp_conv_table[start];
1367 s_ptr->w_max[tval][sval] = exp_conv_table[max];
1370 /* Process 'S' for "Skill exp" */
1371 else if (buf[0] == 'S')
1373 int num, start, max;
1375 /* Scan for the values */
1376 if (3 != sscanf(buf + 2, "%d:%d:%d",
1377 &num, &start, &max)) return 1;
1379 if (start < WEAPON_EXP_UNSKILLED || start > WEAPON_EXP_MASTER
1380 || max < WEAPON_EXP_UNSKILLED || max > WEAPON_EXP_MASTER) return (8);
1382 /* Save the values */
1383 s_ptr->s_start[num] = (SUB_EXP)start;
1384 s_ptr->s_max[num] = (SUB_EXP)max;
1396 * @brief 職業魔法情報(m_info)のパース関数 /
1397 * Initialize the "m_info" array, by parsing an ascii "template" file
1399 * @param head ヘッダ構造体
1402 errr parse_m_info(char *buf, header *head)
1409 static player_magic *m_ptr = NULL;
1412 static int realm, magic_idx = 0, readable = 0;
1415 /* Process 'N' for "New/Number/Name" */
1421 /* Verify information */
1422 if (i <= error_idx) return (4);
1424 /* Verify information */
1425 if (i >= head->info_num) return (2);
1427 /* Save the index */
1430 /* Point at the "info" */
1434 /* There better be a current m_ptr */
1435 else if (!m_ptr) return (3);
1437 /* Process 'I' for "Info" (one line only) */
1438 else if (buf[0] == 'I')
1441 int xtra, type, first, weight;
1443 /* Find the colon before the name */
1444 s = my_strchr(buf + 2, ':');
1446 /* Verify that colon */
1449 /* Nuke the colon, advance to the name */
1454 if (streq(book, "SORCERY")) m_ptr->spell_book = TV_SORCERY_BOOK;
1455 else if (streq(book, "LIFE")) m_ptr->spell_book = TV_LIFE_BOOK;
1456 else if (streq(book, "MUSIC")) m_ptr->spell_book = TV_MUSIC_BOOK;
1457 else if (streq(book, "HISSATSU")) m_ptr->spell_book = TV_HISSATSU_BOOK;
1458 else if (streq(book, "NONE")) m_ptr->spell_book = 0;
1463 /* Find the colon before the name */
1464 s = my_strchr(s, ':');
1466 /* Verify that colon */
1469 /* Nuke the colon, advance to the name */
1472 if (streq(stat, "STR")) m_ptr->spell_stat = A_STR;
1473 else if (streq(stat, "INT")) m_ptr->spell_stat = A_INT;
1474 else if (streq(stat, "WIS")) m_ptr->spell_stat = A_WIS;
1475 else if (streq(stat, "DEX")) m_ptr->spell_stat = A_DEX;
1476 else if (streq(stat, "CON")) m_ptr->spell_stat = A_CON;
1477 else if (streq(stat, "CHR")) m_ptr->spell_stat = A_CHR;
1481 /* Scan for the values */
1482 if (4 != sscanf(s, "%x:%d:%d:%d",
1483 (uint *)&xtra, &type, &first, &weight)) return 1;
1485 m_ptr->spell_xtra = xtra;
1486 m_ptr->spell_type = type;
1487 m_ptr->spell_first = first;
1488 m_ptr->spell_weight = weight;
1492 /* Process 'R' for "Realm" (one line only) */
1493 else if (buf[0] == 'R')
1495 /* Scan for the values */
1496 if (2 != sscanf(buf + 2, "%d:%d",
1497 &realm, &readable)) return 1;
1502 else if (buf[0] == 'T')
1504 int level, mana, fail, exp;
1506 if (!readable) return 1;
1507 /* Scan for the values */
1508 if (4 != sscanf(buf + 2, "%d:%d:%d:%d",
1509 &level, &mana, &fail, &exp)) return 1;
1511 m_ptr->info[realm][magic_idx].slevel = (PLAYER_LEVEL)level;
1512 m_ptr->info[realm][magic_idx].smana = (MANA_POINT)mana;
1513 m_ptr->info[realm][magic_idx].sfail = (PERCENTAGE)fail;
1514 m_ptr->info[realm][magic_idx].sexp = (EXP)exp;
1524 * @brief テキストトークンを走査してフラグを一つ得る(汎用) /
1525 * Grab one flag from a textual string
1526 * @param flags ビットフラグを追加する先の参照ポインタ
1527 * @param names トークン定義配列
1528 * @param what 参照元の文字列ポインタ
1531 static errr grab_one_flag(u32b *flags, concptr names[], concptr what)
1533 for (int i = 0; i < 32; i++)
1535 if (streq(what, names[i]))
1537 *flags |= (1L << i);
1547 * @brief テキストトークンを走査してフラグを一つ得る(地形情報向け) /
1548 * Grab one flag in an feature_type from a textual string
1549 * @param f_ptr 地形情報を保管する先の構造体参照ポインタ
1550 * @param what 参照元の文字列ポインタ
1553 static errr grab_one_feat_flag(feature_type *f_ptr, concptr what)
1556 for (int i = 0; i < FF_FLAG_MAX; i++)
1558 if (streq(what, f_info_flags[i]))
1560 add_flag(f_ptr->flags, i);
1565 msg_format(_("未知の地形フラグ '%s'。", "Unknown feature flag '%s'."), what);
1566 return PARSE_ERROR_GENERIC;
1571 * @brief テキストトークンを走査してフラグ(ステート)を一つ得る(地形情報向け2) /
1572 * Grab an action in an feature_type from a textual string
1573 * @param f_ptr 地形情報を保管する先の構造体参照ポインタ
1574 * @param what 参照元の文字列ポインタ
1575 * @param count ステートの保存先ID
1578 static errr grab_one_feat_action(feature_type *f_ptr, concptr what, int count)
1581 for (FF_FLAGS_IDX i = 0; i < FF_FLAG_MAX; i++)
1583 if (streq(what, f_info_flags[i]))
1585 f_ptr->state[count].action = i;
1590 msg_format(_("未知の地形アクション '%s'。", "Unknown feature action '%s'."), what);
1591 return PARSE_ERROR_GENERIC;
1596 * @brief 地形情報(f_info)のパース関数 /
1597 * Initialize the "f_info" array, by parsing an ascii "template" file
1599 * @param head ヘッダ構造体
1602 errr parse_f_info(char *buf, header *head)
1605 static feature_type *f_ptr = NULL;
1607 /* Process 'N' for "New/Number/Name" */
1612 /* Find the colon before the name */
1613 s = my_strchr(buf + 2, ':');
1617 /* Nuke the colon, advance to the name */
1624 /* Verify information */
1625 if (i <= error_idx) return (4);
1627 /* Verify information */
1628 if (i >= head->info_num) return (2);
1630 /* Save the index */
1633 /* Point at the "info" */
1636 /* Tag name is given */
1640 if (!add_tag(&f_ptr->tag, head, s)) return (7);
1643 /* Default "mimic" */
1644 f_ptr->mimic = (FEAT_IDX)i;
1646 /* Default "destroyed state" -- if not specified */
1647 f_ptr->destroyed = (FEAT_IDX)i;
1649 /* Default "states" */
1650 for (i = 0; i < MAX_FEAT_STATES; i++) f_ptr->state[i].action = FF_FLAG_MAX;
1653 /* There better be a current f_ptr */
1654 else if (!f_ptr) return (3);
1657 else if (buf[0] == 'J')
1659 /* Store the name */
1660 if (!add_name(&f_ptr->name, head, buf + 2)) return (7);
1663 else if (buf[0] == 'E')
1665 /* Ignore english name */
1668 else if (buf[0] == 'J')
1670 /* Ignore Japanese name */
1673 else if (buf[0] == 'E')
1675 /* Acquire the Text */
1678 /* Store the name */
1679 if (!add_name(&f_ptr->name, head, s)) return (7);
1684 /* Process 'M' for "Mimic" (one line only) */
1685 else if (buf[0] == 'M')
1689 if (!add_tag(&offset, head, buf + 2)) return PARSE_ERROR_OUT_OF_MEMORY;
1691 /* Record a fake tag index */
1692 f_ptr->mimic_tag = offset;
1696 /* Process 'G' for "Graphics" (one line only) */
1697 else if (buf[0] == 'G')
1701 char char_tmp[F_LIT_MAX];
1702 if (buf[1] != ':') return 1;
1703 if (!buf[2]) return 1;
1704 if (buf[3] != ':') return 1;
1705 if (!buf[4]) return 1;
1707 /* Extract the char */
1708 char_tmp[F_LIT_STANDARD] = buf[2];
1710 /* Extract the color */
1711 s_attr = color_char_to_attr(buf[4]);
1712 if (s_attr > 127) return 1;
1714 /* Save the standard values */
1715 f_ptr->d_attr[F_LIT_STANDARD] = s_attr;
1716 f_ptr->d_char[F_LIT_STANDARD] = char_tmp[F_LIT_STANDARD];
1718 /* Is this feature supports lighting? */
1721 /* G:c:a:LIT (default) */
1722 apply_default_feat_lighting(f_ptr->d_attr, f_ptr->d_char);
1724 /* G:c:a:lc:la:dc:da */
1725 if (!streq(buf + 6, "LIT"))
1727 char attr_lite_tmp[F_LIT_MAX - F_LIT_NS_BEGIN];
1729 if ((F_LIT_MAX - F_LIT_NS_BEGIN) * 2 != sscanf(buf + 6, "%c:%c:%c:%c",
1730 &char_tmp[F_LIT_LITE], &attr_lite_tmp[F_LIT_LITE - F_LIT_NS_BEGIN],
1731 &char_tmp[F_LIT_DARK], &attr_lite_tmp[F_LIT_DARK - F_LIT_NS_BEGIN])) return 1;
1732 if (buf[F_LIT_MAX * 4 + 1]) return 1;
1734 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
1736 switch (attr_lite_tmp[j - F_LIT_NS_BEGIN])
1739 /* Use default lighting */
1742 /* No lighting support */
1743 f_ptr->d_attr[j] = f_ptr->d_attr[F_LIT_STANDARD];
1746 /* Extract the color */
1747 f_ptr->d_attr[j] = color_char_to_attr(attr_lite_tmp[j - F_LIT_NS_BEGIN]);
1748 if (f_ptr->d_attr[j] > 127) return 1;
1751 f_ptr->d_char[j] = char_tmp[j];
1757 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
1759 f_ptr->d_attr[j] = s_attr;
1760 f_ptr->d_char[j] = char_tmp[F_LIT_STANDARD];
1766 /* Hack -- Process 'F' for flags */
1767 else if (buf[0] == 'F')
1769 /* Parse every entry textually */
1770 for (s = buf + 2; *s; )
1772 /* Find the end of this entry */
1773 for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
1775 /* Nuke and skip any dividers */
1779 while (*t == ' ' || *t == '|') t++;
1782 /* Hack -- Read feature subtype */
1783 if (1 == sscanf(s, "SUBTYPE_%d", &i))
1785 /* Extract a "subtype" */
1786 f_ptr->subtype = (FEAT_SUBTYPE)i;
1788 /* Start at next entry */
1794 /* Hack -- Read feature power */
1795 if (1 == sscanf(s, "POWER_%d", &i))
1797 /* Extract a "power" */
1798 f_ptr->power = (FEAT_POWER)i;
1800 /* Start at next entry */
1805 /* Parse this entry */
1806 if (0 != grab_one_feat_flag(f_ptr, s)) return (PARSE_ERROR_INVALID_FLAG);
1808 /* Start the next entry */
1813 /* Process 'W' for "More Info" (one line only) */
1814 else if (buf[0] == 'W')
1818 /* Scan for the value */
1819 if (1 != sscanf(buf + 2, "%d", &priority)) return (PARSE_ERROR_GENERIC);
1821 /* Save the value */
1822 f_ptr->priority = (FEAT_PRIORITY)priority;
1825 /* Process 'K' for "States" (up to four lines + default (which cannot be last)) */
1826 else if (buf[0] == 'K')
1830 /* Find the next empty state slot (if any) */
1831 for (i = 0; i < MAX_FEAT_STATES; i++) if (f_ptr->state[i].action == FF_FLAG_MAX) break;
1833 /* Oops, no more slots */
1834 if (i == MAX_FEAT_STATES) return PARSE_ERROR_GENERIC;
1836 /* Analyze the first field */
1837 for (s = t = buf + 2; *t && (*t != ':'); t++) /* loop */;
1839 /* Terminate the field (if necessary) */
1840 if (*t == ':') *t++ = '\0';
1842 /* Is this default entry? */
1843 if (streq(s, "DESTROYED"))
1845 if (!add_tag(&offset, head, t)) return PARSE_ERROR_OUT_OF_MEMORY;
1847 /* Record a fake tag index */
1848 f_ptr->destroyed_tag = offset;
1853 f_ptr->state[i].action = 0;
1855 /* Parse this entry */
1856 if (0 != grab_one_feat_action(f_ptr, s, i)) return PARSE_ERROR_INVALID_FLAG;
1858 if (!add_tag(&offset, head, t)) return PARSE_ERROR_OUT_OF_MEMORY;
1860 /* Record a fake tag index */
1861 f_ptr->state[i].result_tag = offset;
1871 * @brief 地形タグからIDを得る /
1872 * Convert a fake tag to a real feat index
1876 s16b f_tag_to_index(concptr str)
1880 /* Search for real index corresponding to this fake tag */
1881 for (i = 0; i < f_head.info_num; i++)
1883 if (streq(f_tag + f_info[i].tag, str))
1885 /* Return the index */
1896 * @brief 地形タグからIDを得る /
1897 * Search for real index corresponding to this fake tag
1898 * @param feat タグ文字列のオフセット
1899 * @return 地形ID。該当がないなら-1
1901 static FEAT_IDX search_real_feat(STR_OFFSET feat)
1903 /* Don't convert non-fake tag */
1909 /* Search for real index corresponding to this fake tag */
1910 for (FEAT_IDX i = 0; i < f_head.info_num; i++)
1912 if (feat == f_info[i].tag)
1914 /* Record real index */
1920 msg_format(_("未定義のタグ '%s'。", "%s is undefined."), f_tag + feat);
1926 * @brief 地形情報の各種タグからIDへ変換して結果を収める /
1927 * Retouch fake tags of f_info
1928 * @param head ヘッダ構造体
1931 void retouch_f_info(header *head)
1933 /* Convert fake tags to real feat indices */
1934 for (int i = 0; i < head->info_num; i++)
1936 feature_type *f_ptr = &f_info[i];
1939 k = search_real_feat(f_ptr->mimic_tag);
1940 f_ptr->mimic = k < 0 ? f_ptr->mimic : k;
1941 k = search_real_feat(f_ptr->destroyed_tag);
1942 f_ptr->destroyed = k < 0 ? f_ptr->destroyed : k;
1943 for (j = 0; j < MAX_FEAT_STATES; j++)
1945 k = search_real_feat(f_ptr->state[j].result_tag);
1946 f_ptr->state[j].result = k < 0 ? f_ptr->state[j].result : k;
1953 * @brief テキストトークンを走査してフラグを一つ得る(ベースアイテム用) /
1954 * Grab one flag in an object_kind from a textual string
1955 * @param k_ptr 保管先のベースアイテム構造体参照ポインタ
1956 * @param what 参照元の文字列ポインタ
1959 static errr grab_one_kind_flag(object_kind *k_ptr, concptr what)
1962 for (int i = 0; i < TR_FLAG_MAX; i++)
1964 if (streq(what, k_info_flags[i]))
1966 add_flag(k_ptr->flags, i);
1971 if (grab_one_flag(&k_ptr->gen_flags, k_info_gen_flags, what) == 0)
1974 msg_format(_("未知のアイテム・フラグ '%s'。", "Unknown object flag '%s'."), what);
1980 * @brief テキストトークンを走査してフラグを一つ得る(発動能力用) /
1981 * Grab one activation index flag
1982 * @param what 参照元の文字列ポインタ
1985 static byte grab_one_activation_flag(concptr what)
1987 for (int i = 0; ; i++)
1989 if (activation_info[i].flag == NULL) break;
1991 if (streq(what, activation_info[i].flag))
1993 return activation_info[i].index;
2003 msg_format(_("未知の発動・フラグ '%s'。", "Unknown activation flag '%s'."), what);
2009 * @brief ベースアイテム(k_info)のパース関数 /
2010 * Initialize the "k_info" array, by parsing an ascii "template" file
2012 * @param head ヘッダ構造体
2015 errr parse_k_info(char *buf, header *head)
2018 static object_kind *k_ptr = NULL;
2020 /* Process 'N' for "New/Number/Name" */
2029 /* Find the colon before the name */
2030 s = my_strchr(buf + 2, ':');
2032 /* Verify that colon */
2035 /* Nuke the colon, advance to the name */
2041 /* Verify information */
2042 if (i <= error_idx) return (4);
2044 /* Verify information */
2045 if (i >= head->info_num) return (2);
2047 /* Save the index */
2050 /* Point at the "info" */
2054 /* Paranoia -- require a name */
2057 /* Find the colon before the flavor */
2058 flavor = my_strchr(s, ':');
2060 /* Verify that colon */
2063 /* Nuke the colon, advance to the flavor */
2066 /* Store the flavor */
2067 if (!add_name(&k_ptr->flavor_name, head, flavor)) return (7);
2070 /* Store the name */
2071 if (!add_name(&k_ptr->name, head, s)) return (7);
2075 /* There better be a current k_ptr */
2076 else if (!k_ptr) return (3);
2081 /* 'E' から始まる行は英語名としている */
2082 else if (buf[0] == 'E')
2087 else if (buf[0] == 'E')
2091 /* Acquire the name */
2094 /* Find the colon before the flavor */
2095 flavor = my_strchr(s, ':');
2097 /* Verify that colon */
2100 /* Nuke the colon, advance to the flavor */
2103 /* Store the flavor */
2104 if (!add_name(&k_ptr->flavor_name, head, flavor)) return (7);
2107 /* Store the name */
2108 if (!add_name(&k_ptr->name, head, s)) return (7);
2112 /* Process 'D' for "Description" */
2113 else if (buf[0] == 'D')
2118 /* Acquire the text */
2123 /* Acquire the text */
2127 /* Store the text */
2128 if (!add_text(&k_ptr->text, head, s, TRUE)) return (7);
2131 /* Process 'G' for "Graphics" (one line only) */
2132 else if (buf[0] == 'G')
2136 if (buf[1] != ':') return 1;
2137 if (!buf[2]) return 1;
2138 if (buf[3] != ':') return 1;
2139 if (!buf[4]) return 1;
2141 /* Extract the char */
2144 /* Extract the attr */
2145 tmp = color_char_to_attr(buf[4]);
2146 if (tmp > 127) return 1;
2148 /* Save the values */
2149 k_ptr->d_attr = tmp;
2150 k_ptr->d_char = sym;
2153 /* Process 'I' for "Info" (one line only) */
2154 else if (buf[0] == 'I')
2156 int tval, sval, pval;
2158 /* Scan for the values */
2159 if (3 != sscanf(buf + 2, "%d:%d:%d",
2160 &tval, &sval, &pval)) return 1;
2162 /* Save the values */
2163 k_ptr->tval = (OBJECT_TYPE_VALUE)tval;
2164 k_ptr->sval = (OBJECT_SUBTYPE_VALUE)sval;
2165 k_ptr->pval = (PARAMETER_VALUE)pval;
2168 /* Process 'W' for "More Info" (one line only) */
2169 else if (buf[0] == 'W')
2171 int level, extra, wgt;
2174 /* Scan for the values */
2175 if (4 != sscanf(buf + 2, "%d:%d:%d:%ld",
2176 &level, &extra, &wgt, &cost)) return 1;
2178 /* Save the values */
2179 k_ptr->level = (DEPTH)level;
2180 k_ptr->extra = (BIT_FLAGS8)extra;
2181 k_ptr->weight = (WEIGHT)wgt;
2182 k_ptr->cost = (PRICE)cost;
2185 /* Process 'A' for "Allocation" (one line only) */
2186 else if (buf[0] == 'A')
2189 /* Simply read each number following a colon */
2190 for (i = 0, s = buf + 1; s && (s[0] == ':') && s[1]; ++i)
2192 /* Default chance */
2193 k_ptr->chance[i] = 1;
2195 /* Store the attack damage index */
2196 k_ptr->locale[i] = atoi(s + 1);
2198 /* Find the slash */
2199 t = my_strchr(s + 1, '/');
2201 /* Find the next colon */
2202 s = my_strchr(s + 1, ':');
2204 /* If the slash is "nearby", use it */
2205 if (t && (!s || t < s))
2207 int chance = atoi(t + 1);
2208 if (chance > 0) k_ptr->chance[i] = (PROB)chance;
2213 /* Hack -- Process 'P' for "power" and such */
2214 else if (buf[0] == 'P')
2216 int ac, hd1, hd2, th, td, ta;
2218 /* Scan for the values */
2219 if (6 != sscanf(buf + 2, "%d:%dd%d:%d:%d:%d",
2220 &ac, &hd1, &hd2, &th, &td, &ta)) return 1;
2222 k_ptr->ac = (ARMOUR_CLASS)ac;
2223 k_ptr->dd = (DICE_NUMBER)hd1;
2224 k_ptr->ds = (DICE_SID)hd2;
2225 k_ptr->to_h = (HIT_PROB)th;
2226 k_ptr->to_d = (HIT_POINT)td;
2227 k_ptr->to_a = (ARMOUR_CLASS)ta;
2230 /* Hack -- Process 'U' for activation index */
2231 else if (buf[0] == 'U')
2234 n = grab_one_activation_flag(buf + 2);
2245 /* Hack -- Process 'F' for flags */
2246 else if (buf[0] == 'F')
2248 /* Parse every entry textually */
2249 for (s = buf + 2; *s; )
2251 /* Find the end of this entry */
2252 for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
2254 /* Nuke and skip any dividers */
2258 while (*t == ' ' || *t == '|') t++;
2261 /* Parse this entry */
2262 if (0 != grab_one_kind_flag(k_ptr, s)) return (5);
2264 /* Start the next entry */
2275 * @brief テキストトークンを走査してフラグを一つ得る(アーティファクト用) /
2276 * Grab one activation index flag
2277 * @param a_ptr 保管先のアーティファクト構造体参照ポインタ
2278 * @param what 参照元の文字列ポインタ
2279 * @return エラーがあった場合1、エラーがない場合0を返す
2281 static errr grab_one_artifact_flag(artifact_type *a_ptr, concptr what)
2284 for (int i = 0; i < TR_FLAG_MAX; i++)
2286 if (streq(what, k_info_flags[i]))
2288 add_flag(a_ptr->flags, i);
2293 if (grab_one_flag(&a_ptr->gen_flags, k_info_gen_flags, what) == 0)
2296 msg_format(_("未知の伝説のアイテム・フラグ '%s'。", "Unknown artifact flag '%s'."), what);
2302 * @brief 固定アーティファクト情報(a_info)のパース関数 /
2303 * Initialize the "a_info" array, by parsing an ascii "template" file
2305 * @param head ヘッダ構造体
2308 errr parse_a_info(char *buf, header *head)
2311 static artifact_type *a_ptr = NULL;
2313 /* Process 'N' for "New/Number/Name" */
2318 /* Find the colon before the name */
2319 s = my_strchr(buf + 2, ':');
2321 /* Verify that colon */
2324 /* Nuke the colon, advance to the name */
2327 /* Paranoia -- require a name */
2333 /* Verify information */
2334 if (i < error_idx) return (4);
2336 /* Verify information */
2337 if (i >= head->info_num) return (2);
2339 /* Save the index */
2342 /* Point at the "info" */
2345 /* Ignore everything */
2346 add_flag(a_ptr->flags, TR_IGNORE_ACID);
2347 add_flag(a_ptr->flags, TR_IGNORE_ELEC);
2348 add_flag(a_ptr->flags, TR_IGNORE_FIRE);
2349 add_flag(a_ptr->flags, TR_IGNORE_COLD);
2351 /* Store the name */
2352 if (!add_name(&a_ptr->name, head, s)) return (7);
2356 /* There better be a current a_ptr */
2357 else if (!a_ptr) return (3);
2362 /* 'E' から始まる行は英語名としている */
2363 else if (buf[0] == 'E')
2368 else if (buf[0] == 'E')
2370 /* Acquire the Text */
2373 /* Store the name */
2374 if (!add_name(&a_ptr->name, head, s)) return (7);
2378 /* Process 'D' for "Description" */
2379 else if (buf[0] == 'D')
2384 /* Acquire the text */
2389 /* Acquire the text */
2393 /* Store the text */
2394 if (!add_text(&a_ptr->text, head, s, TRUE)) return (7);
2398 /* Process 'I' for "Info" (one line only) */
2399 else if (buf[0] == 'I')
2401 int tval, sval, pval;
2403 /* Scan for the values */
2404 if (3 != sscanf(buf + 2, "%d:%d:%d",
2405 &tval, &sval, &pval)) return 1;
2407 /* Save the values */
2408 a_ptr->tval = (OBJECT_TYPE_VALUE)tval;
2409 a_ptr->sval = (OBJECT_SUBTYPE_VALUE)sval;
2410 a_ptr->pval = (PARAMETER_VALUE)pval;
2413 /* Process 'W' for "More Info" (one line only) */
2414 else if (buf[0] == 'W')
2416 int level, rarity, wgt;
2419 /* Scan for the values */
2420 if (4 != sscanf(buf + 2, "%d:%d:%d:%ld",
2421 &level, &rarity, &wgt, &cost)) return 1;
2423 /* Save the values */
2424 a_ptr->level = (DEPTH)level;
2425 a_ptr->rarity = (RARITY)rarity;
2426 a_ptr->weight = (WEIGHT)wgt;
2427 a_ptr->cost = (PRICE)cost;
2430 /* Hack -- Process 'P' for "power" and such */
2431 else if (buf[0] == 'P')
2433 int ac, hd1, hd2, th, td, ta;
2435 /* Scan for the values */
2436 if (6 != sscanf(buf + 2, "%d:%dd%d:%d:%d:%d",
2437 &ac, &hd1, &hd2, &th, &td, &ta)) return 1;
2439 a_ptr->ac = (ARMOUR_CLASS)ac;
2440 a_ptr->dd = (DICE_NUMBER)hd1;
2441 a_ptr->ds = (DICE_SID)hd2;
2442 a_ptr->to_h = (HIT_PROB)th;
2443 a_ptr->to_d = (HIT_POINT)td;
2444 a_ptr->to_a = (ARMOUR_CLASS)ta;
2447 /* Hack -- Process 'U' for activation index */
2448 else if (buf[0] == 'U')
2451 n = grab_one_activation_flag(buf + 2);
2462 /* Hack -- Process 'F' for flags */
2463 else if (buf[0] == 'F')
2465 /* Parse every entry textually */
2466 for (s = buf + 2; *s; )
2468 /* Find the end of this entry */
2469 for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
2471 /* Nuke and skip any dividers */
2475 while ((*t == ' ') || (*t == '|')) t++;
2478 /* Parse this entry */
2479 if (0 != grab_one_artifact_flag(a_ptr, s)) return (5);
2481 /* Start the next entry */
2492 * @brief テキストトークンを走査してフラグを一つ得る(アーティファクト用) /
2493 * Grab one flag in a ego-item_type from a textual string
2494 * @param e_ptr 保管先のエゴ構造体参照ポインタ
2495 * @param what 参照元の文字列ポインタ
2496 * @return エラーがあった場合1、エラーがない場合0を返す
2498 static bool grab_one_ego_item_flag(ego_item_type *e_ptr, concptr what)
2501 for (int i = 0; i < TR_FLAG_MAX; i++)
2503 if (streq(what, k_info_flags[i]))
2505 add_flag(e_ptr->flags, i);
2510 if (grab_one_flag(&e_ptr->gen_flags, k_info_gen_flags, what) == 0)
2513 msg_format(_("未知の名のあるアイテム・フラグ '%s'。", "Unknown ego-item flag '%s'."), what);
2519 * @brief アイテムエゴ情報(e_info)のパース関数 /
2520 * Initialize the "e_info" array, by parsing an ascii "template" file
2522 * @param head ヘッダ構造体
2525 errr parse_e_info(char *buf, header *head)
2528 static ego_item_type *e_ptr = NULL;
2530 /* Just before the first record */
2533 /* Just before the first line */
2536 /* Process 'N' for "New/Number/Name" */
2541 /* Find the colon before the name */
2542 s = my_strchr(buf + 2, ':');
2544 /* Verify that colon */
2547 /* Nuke the colon, advance to the name */
2550 /* Paranoia -- require a name */
2556 /* Verify information */
2557 if (i < error_idx) return (4);
2559 /* Verify information */
2560 if (i >= head->info_num) return (2);
2562 /* Save the index */
2565 /* Point at the "info" */
2568 /* Store the name */
2569 if (!add_name(&e_ptr->name, head, s)) return (7);
2573 /* There better be a current e_ptr */
2574 else if (!e_ptr) return (3);
2579 /* 'E' から始まる行は英語名 */
2580 else if (buf[0] == 'E')
2585 else if (buf[0] == 'E')
2587 /* Acquire the Text */
2590 /* Store the name */
2591 if (!add_name(&e_ptr->name, head, s)) return (7);
2596 /* Process 'D' for "Description" */
2597 else if (buf[0] == 'D')
2599 /* Acquire the text */
2602 /* Store the text */
2603 if (!add_text(&e_ptr->text, head, s, TRUE)) return (7);
2608 /* Process 'X' for "Xtra" (one line only) */
2609 else if (buf[0] == 'X')
2613 /* Scan for the values */
2614 if (2 != sscanf(buf + 2, "%d:%d",
2615 &slot, &rating)) return 1;
2617 /* Save the values */
2618 e_ptr->slot = (INVENTORY_IDX)slot;
2619 e_ptr->rating = (PRICE)rating;
2622 /* Process 'W' for "More Info" (one line only) */
2623 else if (buf[0] == 'W')
2625 int level, rarity, pad2;
2628 /* Scan for the values */
2629 if (4 != sscanf(buf + 2, "%d:%d:%d:%ld",
2630 &level, &rarity, &pad2, &cost)) return 1;
2632 /* Save the values */
2633 e_ptr->level = level;
2634 e_ptr->rarity = (RARITY)rarity;
2635 /* e_ptr->weight = wgt; */
2639 /* Hack -- Process 'C' for "creation" */
2640 else if (buf[0] == 'C')
2642 int th, td, ta, pval;
2644 /* Scan for the values */
2645 if (4 != sscanf(buf + 2, "%d:%d:%d:%d",
2646 &th, &td, &ta, &pval)) return 1;
2648 e_ptr->max_to_h = (HIT_PROB)th;
2649 e_ptr->max_to_d = (HIT_POINT)td;
2650 e_ptr->max_to_a = (ARMOUR_CLASS)ta;
2651 e_ptr->max_pval = (PARAMETER_VALUE)pval;
2654 /* Hack -- Process 'U' for activation index */
2655 else if (buf[0] == 'U')
2658 n = grab_one_activation_flag(buf + 2);
2669 /* Hack -- Process 'F' for flags */
2670 else if (buf[0] == 'F')
2672 /* Parse every entry textually */
2673 for (s = buf + 2; *s; )
2675 /* Find the end of this entry */
2676 for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
2678 /* Nuke and skip any dividers */
2682 while ((*t == ' ') || (*t == '|')) t++;
2685 /* Parse this entry */
2686 if (0 != grab_one_ego_item_flag(e_ptr, s)) return (5);
2688 /* Start the next entry */
2699 * @brief テキストトークンを走査してフラグを一つ得る(モンスター用1) /
2700 * Grab one (basic) flag in a monster_race from a textual string
2701 * @param r_ptr 保管先のモンスター種族構造体参照ポインタ
2702 * @param what 参照元の文字列ポインタ
2705 static errr grab_one_basic_flag(monster_race *r_ptr, concptr what)
2707 if (grab_one_flag(&r_ptr->flags1, r_info_flags1, what) == 0)
2710 if (grab_one_flag(&r_ptr->flags2, r_info_flags2, what) == 0)
2713 if (grab_one_flag(&r_ptr->flags3, r_info_flags3, what) == 0)
2716 if (grab_one_flag(&r_ptr->flags7, r_info_flags7, what) == 0)
2719 if (grab_one_flag(&r_ptr->flags8, r_info_flags8, what) == 0)
2722 if (grab_one_flag(&r_ptr->flags9, r_info_flags9, what) == 0)
2725 if (grab_one_flag(&r_ptr->flagsr, r_info_flagsr, what) == 0)
2728 msg_format(_("未知のモンスター・フラグ '%s'。", "Unknown monster flag '%s'."), what);
2734 * @brief テキストトークンを走査してフラグを一つ得る(モンスター用2) /
2735 * Grab one (spell) flag in a monster_race from a textual string
2736 * @param r_ptr 保管先のモンスター種族構造体参照ポインタ
2737 * @param what 参照元の文字列ポインタ
2740 static errr grab_one_spell_flag(monster_race *r_ptr, concptr what)
2742 if (grab_one_flag(&r_ptr->flags4, r_info_flags4, what) == 0)
2745 if (grab_one_flag(&r_ptr->a_ability_flags1, r_a_ability_flags1, what) == 0)
2748 if (grab_one_flag(&r_ptr->a_ability_flags2, r_a_ability_flags2, what) == 0)
2751 msg_format(_("未知のモンスター・フラグ '%s'。", "Unknown monster flag '%s'."), what);
2757 * @brief モンスター種族情報(r_info)のパース関数 /
2758 * Initialize the "r_info" array, by parsing an ascii "template" file
2760 * @param head ヘッダ構造体
2763 errr parse_r_info(char *buf, header *head)
2766 static monster_race *r_ptr = NULL;
2768 /* Process 'N' for "New/Number/Name" */
2773 /* Find the colon before the name */
2774 s = my_strchr(buf + 2, ':');
2776 /* Verify that colon */
2779 /* Nuke the colon, advance to the name */
2782 /* Paranoia -- require a name */
2788 /* Verify information */
2789 if (i < error_idx) return (4);
2791 /* Verify information */
2792 if (i >= head->info_num) return (2);
2794 /* Save the index */
2797 /* Point at the "info" */
2800 /* Store the name */
2801 if (!add_name(&r_ptr->name, head, s)) return (7);
2805 /* There better be a current r_ptr */
2806 else if (!r_ptr) return (3);
2811 /* 'E' から始まる行は英語名 */
2812 else if (buf[0] == 'E')
2814 /* Acquire the Text */
2817 /* Store the name */
2818 if (!add_name(&r_ptr->E_name, head, s)) return (7);
2821 else if (buf[0] == 'E')
2823 /* Acquire the Text */
2826 /* Store the name */
2827 if (!add_name(&r_ptr->name, head, s)) return (7);
2830 /* Process 'D' for "Description" */
2831 else if (buf[0] == 'D')
2836 /* Acquire the text */
2841 /* Acquire the text */
2845 /* Store the text */
2846 if (!add_text(&r_ptr->text, head, s, TRUE)) return (7);
2849 /* Process 'G' for "Graphics" (one line only) */
2850 else if (buf[0] == 'G')
2854 if (buf[1] != ':') return 1;
2855 if (!buf[2]) return 1;
2856 if (buf[3] != ':') return 1;
2857 if (!buf[4]) return 1;
2859 /* Extract the char */
2862 /* Extract the attr */
2863 tmp = color_char_to_attr(buf[4]);
2864 if (tmp > 127) return 1;
2866 /* Save the values */
2867 r_ptr->d_char = sym;
2868 r_ptr->d_attr = tmp;
2871 /* Process 'I' for "Info" (one line only) */
2872 else if (buf[0] == 'I')
2874 int spd, hp1, hp2, aaf, ac, slp;
2876 /* Scan for the other values */
2877 if (6 != sscanf(buf + 2, "%d:%dd%d:%d:%d:%d",
2878 &spd, &hp1, &hp2, &aaf, &ac, &slp)) return 1;
2880 /* Save the values */
2881 r_ptr->speed = (SPEED)spd;
2882 r_ptr->hdice = (DICE_NUMBER)MAX(hp1, 1);
2883 r_ptr->hside = (DICE_SID)MAX(hp2, 1);
2884 r_ptr->aaf = (POSITION)aaf;
2885 r_ptr->ac = (ARMOUR_CLASS)ac;
2886 r_ptr->sleep = (SLEEP_DEGREE)slp;
2889 /* Process 'W' for "More Info" (one line only) */
2890 else if (buf[0] == 'W')
2897 /* Scan for the values */
2898 if (6 != sscanf(buf + 2, "%d:%d:%d:%ld:%ld:%d",
2899 &lev, &rar, &pad, &exp, &nextexp, &nextmon)) return 1;
2901 /* Save the values */
2902 r_ptr->level = (DEPTH)lev;
2903 r_ptr->rarity = (RARITY)rar;
2904 r_ptr->extra = (BIT_FLAGS16)pad;
2905 r_ptr->mexp = (EXP)exp;
2906 r_ptr->next_exp = (EXP)nextexp;
2907 r_ptr->next_r_idx = (MONRACE_IDX)nextmon;
2910 /* Process 'R' for "Reinforcement" (up to six lines) */
2911 else if (buf[0] == 'R')
2914 /* Find the next empty blow slot (if any) */
2915 for (i = 0; i < A_MAX; i++) if (r_ptr->reinforce_id[i] == 0) break;
2917 /* Oops, no more slots */
2918 if (i == 6) return 1;
2920 /* Scan for the values */
2921 if (3 != sscanf(buf + 2, "%d:%dd%d", &id, &dd, &ds)) return 1;
2922 r_ptr->reinforce_id[i] = (MONRACE_IDX)id;
2923 r_ptr->reinforce_dd[i] = (DICE_NUMBER)dd;
2924 r_ptr->reinforce_ds[i] = (DICE_SID)ds;
2927 /* Process 'B' for "Blows" (up to four lines) */
2928 else if (buf[0] == 'B')
2932 /* Find the next empty blow slot (if any) */
2933 for (i = 0; i < 4; i++) if (!r_ptr->blow[i].method) break;
2935 /* Oops, no more slots */
2936 if (i == 4) return 1;
2938 /* Analyze the first field */
2939 for (s = t = buf + 2; *t && (*t != ':'); t++) /* loop */;
2941 /* Terminate the field (if necessary) */
2942 if (*t == ':') *t++ = '\0';
2944 /* Analyze the method */
2945 for (n1 = 0; r_info_blow_method[n1]; n1++)
2947 if (streq(s, r_info_blow_method[n1])) break;
2950 /* Invalid method */
2951 if (!r_info_blow_method[n1]) return 1;
2953 /* Analyze the second field */
2954 for (s = t; *t && (*t != ':'); t++) /* loop */;
2956 /* Terminate the field (if necessary) */
2957 if (*t == ':') *t++ = '\0';
2959 /* Analyze effect */
2960 for (n2 = 0; r_info_blow_effect[n2]; n2++)
2962 if (streq(s, r_info_blow_effect[n2])) break;
2965 /* Invalid effect */
2966 if (!r_info_blow_effect[n2]) return 1;
2968 /* Analyze the third field */
2969 for (s = t; *t && (*t != 'd'); t++) /* loop */;
2971 /* Terminate the field (if necessary) */
2972 if (*t == 'd') *t++ = '\0';
2974 /* Save the method */
2975 r_ptr->blow[i].method = (BLOW_METHOD)n1;
2977 /* Save the effect */
2978 r_ptr->blow[i].effect = (BLOW_EFFECT)n2;
2980 /* Extract the damage dice and sides */
2981 r_ptr->blow[i].d_dice = atoi(s);
2982 r_ptr->blow[i].d_side = atoi(t);
2985 /* Process 'F' for "Basic Flags" (multiple lines) */
2986 else if (buf[0] == 'F')
2988 /* Parse every entry */
2989 for (s = buf + 2; *s; )
2991 /* Find the end of this entry */
2992 for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
2994 /* Nuke and skip any dividers */
2998 while (*t == ' ' || *t == '|') t++;
3001 /* Parse this entry */
3002 if (0 != grab_one_basic_flag(r_ptr, s)) return (5);
3004 /* Start the next entry */
3009 /* Process 'S' for "Spell Flags" (multiple lines) */
3010 else if (buf[0] == 'S')
3012 /* Parse every entry */
3013 for (s = buf + 2; *s; )
3015 /* Find the end of this entry */
3016 for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
3018 /* Nuke and skip any dividers */
3022 while ((*t == ' ') || (*t == '|')) t++;
3025 /* Hack -- Read spell frequency */
3026 if (1 == sscanf(s, "1_IN_%d", &i))
3028 /* Extract a "frequency" */
3029 r_ptr->freq_spell = 100 / i;
3031 /* Start at next entry */
3036 /* Parse this entry */
3037 if (0 != grab_one_spell_flag(r_ptr, s)) return (5);
3039 /* Start the next entry */
3044 /* Process 'A' for "Artifact Flags" (multiple lines) */
3045 else if (buf[0] == 'A')
3047 int id, per, rarity;
3049 /* Find the next empty blow slot (if any) */
3050 for (i = 0; i < 4; i++) if (!r_ptr->artifact_id[i]) break;
3052 /* Oops, no more slots */
3053 if (i == 4) return 1;
3055 if (3 != sscanf(buf + 2, "%d:%d:%d", &id, &rarity, &per)) return 1;
3056 r_ptr->artifact_id[i] = (ARTIFACT_IDX)id;
3057 r_ptr->artifact_rarity[i] = (RARITY)rarity;
3058 r_ptr->artifact_percent[i] = (PERCENTAGE)per;
3061 /* Process 'V' for "Arena power value ratio" */
3062 else if (buf[0] == 'V')
3065 if (3 != sscanf(buf + 2, "%d", &val)) return 1;
3066 r_ptr->arena_ratio = (PERCENTAGE)val;
3075 * @brief テキストトークンを走査してフラグを一つ得る(ダンジョン用) /
3076 * Grab one flag for a dungeon type from a textual string
3077 * @param d_ptr 保管先のダンジョン構造体参照ポインタ
3078 * @param what 参照元の文字列ポインタ
3081 static errr grab_one_dungeon_flag(dungeon_type *d_ptr, concptr what)
3083 if (grab_one_flag(&d_ptr->flags1, d_info_flags1, what) == 0)
3086 msg_format(_("未知のダンジョン・フラグ '%s'。", "Unknown dungeon type flag '%s'."), what);
3092 * @brief テキストトークンを走査してフラグを一つ得る(モンスターのダンジョン出現条件用1) /
3093 * Grab one (basic) flag in a monster_race from a textual string
3094 * @param d_ptr 保管先のダンジョン構造体参照ポインタ
3095 * @param what 参照元の文字列ポインタ
3098 static errr grab_one_basic_monster_flag(dungeon_type *d_ptr, concptr what)
3100 if (grab_one_flag(&d_ptr->mflags1, r_info_flags1, what) == 0)
3103 if (grab_one_flag(&d_ptr->mflags2, r_info_flags2, what) == 0)
3106 if (grab_one_flag(&d_ptr->mflags3, r_info_flags3, what) == 0)
3109 if (grab_one_flag(&d_ptr->mflags7, r_info_flags7, what) == 0)
3112 if (grab_one_flag(&d_ptr->mflags8, r_info_flags8, what) == 0)
3115 if (grab_one_flag(&d_ptr->mflags9, r_info_flags9, what) == 0)
3118 if (grab_one_flag(&d_ptr->mflagsr, r_info_flagsr, what) == 0)
3121 msg_format(_("未知のモンスター・フラグ '%s'。", "Unknown monster flag '%s'."), what);
3127 * @brief テキストトークンを走査してフラグを一つ得る(モンスターのダンジョン出現条件用2) /
3128 * Grab one (spell) flag in a monster_race from a textual string
3129 * @param d_ptr 保管先のダンジョン構造体参照ポインタ
3130 * @param what 参照元の文字列ポインタ
3133 static errr grab_one_spell_monster_flag(dungeon_type *d_ptr, concptr what)
3135 if (grab_one_flag(&d_ptr->mflags4, r_info_flags4, what) == 0)
3138 if (grab_one_flag(&d_ptr->m_a_ability_flags1, r_a_ability_flags1, what) == 0)
3141 if (grab_one_flag(&d_ptr->m_a_ability_flags2, r_a_ability_flags2, what) == 0)
3144 msg_format(_("未知のモンスター・フラグ '%s'。", "Unknown monster flag '%s'."), what);
3150 * @brief ダンジョン情報(d_info)のパース関数 /
3151 * Initialize the "d_info" array, by parsing an ascii "template" file
3153 * @param head ヘッダ構造体
3156 errr parse_d_info(char *buf, header *head)
3159 static dungeon_type *d_ptr = NULL;
3161 /* Process 'N' for "New/Number/Name" */
3166 /* Find the colon before the name */
3167 s = my_strchr(buf + 2, ':');
3169 /* Verify that colon */
3172 /* Nuke the colon, advance to the name */
3175 /* Paranoia -- require a name */
3181 /* Verify information */
3182 if (i < error_idx) return (4);
3184 /* Verify information */
3185 if (i >= head->info_num) return (2);
3187 /* Save the index */
3190 /* Point at the "info" */
3193 /* Store the name */
3194 if (!add_name(&d_ptr->name, head, s)) return (7);
3199 else if (buf[0] == 'E') return 0;
3201 else if (buf[0] == 'E')
3203 /* Acquire the Text */
3206 /* Store the name */
3207 if (!add_name(&d_ptr->name, head, s)) return (7);
3211 /* Process 'D' for "Description */
3212 else if (buf[0] == 'D')
3217 /* Acquire the text */
3222 /* Acquire the text */
3226 /* Store the text */
3227 if (!add_text(&d_ptr->text, head, s, TRUE)) return (7);
3230 /* Process 'W' for "More Info" (one line only) */
3231 else if (buf[0] == 'W')
3233 int min_lev, max_lev;
3235 int min_alloc, max_chance;
3236 int obj_good, obj_great;
3239 /* Scan for the values */
3240 if (10 != sscanf(buf + 2, "%d:%d:%d:%d:%d:%d:%d:%d:%x:%x",
3241 &min_lev, &max_lev, &min_plev, &mode, &min_alloc, &max_chance, &obj_good, &obj_great, (unsigned int *)&pit, (unsigned int *)&nest)) return 1;
3243 /* Save the values */
3244 d_ptr->mindepth = (DEPTH)min_lev;
3245 d_ptr->maxdepth = (DEPTH)max_lev;
3246 d_ptr->min_plev = (PLAYER_LEVEL)min_plev;
3247 d_ptr->mode = (BIT_FLAGS8)mode;
3248 d_ptr->min_m_alloc_level = min_alloc;
3249 d_ptr->max_m_alloc_chance = max_chance;
3250 d_ptr->obj_good = obj_good;
3251 d_ptr->obj_great = obj_great;
3252 d_ptr->pit = (BIT_FLAGS16)pit;
3253 d_ptr->nest = (BIT_FLAGS16)nest;
3256 /* Process 'P' for "Place Info" */
3257 else if (buf[0] == 'P')
3261 /* Scan for the values */
3262 if (2 != sscanf(buf + 2, "%d:%d", &dy, &dx)) return 1;
3264 /* Save the values */
3269 /* Process 'L' for "fLoor type" (one line only) */
3270 else if (buf[0] == 'L')
3274 /* Scan for the values */
3275 if (tokenize(buf + 2, DUNGEON_FEAT_PROB_NUM * 2 + 1, zz, 0) != (DUNGEON_FEAT_PROB_NUM * 2 + 1)) return 1;
3277 /* Save the values */
3278 for (i = 0; i < DUNGEON_FEAT_PROB_NUM; i++)
3280 d_ptr->floor[i].feat = f_tag_to_index(zz[i * 2]);
3281 if (d_ptr->floor[i].feat < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
3283 d_ptr->floor[i].percent = (PERCENTAGE)atoi(zz[i * 2 + 1]);
3285 d_ptr->tunnel_percent = atoi(zz[DUNGEON_FEAT_PROB_NUM * 2]);
3288 /* Process 'A' for "wAll type" (one line only) */
3289 else if (buf[0] == 'A')
3293 /* Scan for the values */
3294 if (tokenize(buf + 2, DUNGEON_FEAT_PROB_NUM * 2 + 4, zz, 0) != (DUNGEON_FEAT_PROB_NUM * 2 + 4)) return 1;
3296 /* Save the values */
3297 for (i = 0; i < DUNGEON_FEAT_PROB_NUM; i++)
3299 d_ptr->fill[i].feat = f_tag_to_index(zz[i * 2]);
3300 if (d_ptr->fill[i].feat < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
3302 d_ptr->fill[i].percent = (PERCENTAGE)atoi(zz[i * 2 + 1]);
3305 d_ptr->outer_wall = f_tag_to_index(zz[DUNGEON_FEAT_PROB_NUM * 2]);
3306 if (d_ptr->outer_wall < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
3308 d_ptr->inner_wall = f_tag_to_index(zz[DUNGEON_FEAT_PROB_NUM * 2 + 1]);
3309 if (d_ptr->inner_wall < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
3311 d_ptr->stream1 = f_tag_to_index(zz[DUNGEON_FEAT_PROB_NUM * 2 + 2]);
3312 if (d_ptr->stream1 < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
3314 d_ptr->stream2 = f_tag_to_index(zz[DUNGEON_FEAT_PROB_NUM * 2 + 3]);
3315 if (d_ptr->stream2 < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
3318 /* Process 'F' for "Dungeon Flags" (multiple lines) */
3319 else if (buf[0] == 'F')
3321 int artif = 0, monst = 0;
3323 /* Parse every entry */
3324 for (s = buf + 2; *s; )
3326 /* Find the end of this entry */
3327 for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
3329 /* Nuke and skip any dividers */
3333 while (*t == ' ' || *t == '|') t++;
3336 /* Hack -- Read Final Artifact */
3337 if (1 == sscanf(s, "FINAL_ARTIFACT_%d", &artif))
3339 /* Extract a "Final Artifact" */
3340 d_ptr->final_artifact = (ARTIFACT_IDX)artif;
3342 /* Start at next entry */
3347 /* Hack -- Read Final Object */
3348 if (1 == sscanf(s, "FINAL_OBJECT_%d", &artif))
3350 /* Extract a "Final Artifact" */
3351 d_ptr->final_object = (KIND_OBJECT_IDX)artif;
3353 /* Start at next entry */
3358 /* Hack -- Read Artifact Guardian */
3359 if (1 == sscanf(s, "FINAL_GUARDIAN_%d", &monst))
3361 /* Extract a "Artifact Guardian" */
3362 d_ptr->final_guardian = (MONRACE_IDX)monst;
3364 /* Start at next entry */
3369 /* Hack -- Read Special Percentage */
3370 if (1 == sscanf(s, "MONSTER_DIV_%d", &monst))
3372 /* Extract a "Special %" */
3373 d_ptr->special_div = (PROB)monst;
3375 /* Start at next entry */
3380 /* Parse this entry */
3381 if (0 != grab_one_dungeon_flag(d_ptr, s)) return (5);
3383 /* Start the next entry */
3388 /* Process 'M' for "Basic Flags" (multiple lines) */
3389 else if (buf[0] == 'M')
3391 /* Parse every entry */
3392 for (s = buf + 2; *s; )
3394 /* Find the end of this entry */
3395 for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
3397 /* Nuke and skip any dividers */
3401 while (*t == ' ' || *t == '|') t++;
3404 /* Hack -- Read monster symbols */
3405 if (!strncmp(s, "R_CHAR_", 7))
3407 /* Skip "R_CHAR_" */
3411 strncpy(d_ptr->r_char, s, sizeof(d_ptr->r_char));
3413 /* Start at next entry */
3418 /* Parse this entry */
3419 if (0 != grab_one_basic_monster_flag(d_ptr, s)) return (5);
3421 /* Start the next entry */
3426 /* Process 'S' for "Spell Flags" (multiple lines) */
3427 else if (buf[0] == 'S')
3429 /* Parse every entry */
3430 for (s = buf + 2; *s; )
3432 /* Find the end of this entry */
3433 for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
3435 /* Nuke and skip any dividers */
3439 while ((*t == ' ') || (*t == '|')) t++;
3442 /* Hack -- Read spell frequency */
3443 if (1 == sscanf(s, "1_IN_%d", &i))
3445 /* Start at next entry */
3450 /* Parse this entry */
3451 if (0 != grab_one_spell_monster_flag(d_ptr, s)) return (5);
3453 /* Start the next entry */
3463 #else /* ALLOW_TEMPLATES */
3469 #endif /* ALLOW_TEMPLATES */
3473 * @brief 地形情報の「F:」情報をパースする
3474 * Process "F:<letter>:<terrain>:<cave_info>:<monster>:<object>:<ego>:<artifact>:<trap>:<special>" -- info for dungeon grid
3475 * @param floor_ptr 現在フロアへの参照ポインタ
3479 static errr parse_line_feature(floor_type *floor_ptr, char *buf)
3481 if (init_flags & INIT_ONLY_BUILDINGS) return 0;
3483 /* Tokenize the line */
3485 int num = tokenize(buf + 2, 9, zz, 0);
3486 if (num <= 1) return 1;
3488 /* Letter to assign */
3489 int index = zz[0][0];
3491 /* Reset the info for the letter */
3492 letter[index].feature = feat_none;
3493 letter[index].monster = 0;
3494 letter[index].object = 0;
3495 letter[index].ego = 0;
3496 letter[index].artifact = 0;
3497 letter[index].trap = feat_none;
3498 letter[index].cave_info = 0;
3499 letter[index].special = 0;
3500 letter[index].random = RANDOM_NONE;
3506 letter[index].special = (s16b)atoi(zz[8]);
3510 if ((zz[7][0] == '*') && !zz[7][1])
3512 letter[index].random |= RANDOM_TRAP;
3516 letter[index].trap = f_tag_to_index(zz[7]);
3517 if (letter[index].trap < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
3522 if (zz[6][0] == '*')
3524 letter[index].random |= RANDOM_ARTIFACT;
3525 if (zz[6][1]) letter[index].artifact = (ARTIFACT_IDX)atoi(zz[6] + 1);
3527 else if (zz[6][0] == '!')
3529 if (floor_ptr->inside_quest)
3531 letter[index].artifact = quest[floor_ptr->inside_quest].k_idx;
3536 letter[index].artifact = (ARTIFACT_IDX)atoi(zz[6]);
3541 if (zz[5][0] == '*')
3543 letter[index].random |= RANDOM_EGO;
3544 if (zz[5][1]) letter[index].ego = (EGO_IDX)atoi(zz[5] + 1);
3548 letter[index].ego = (EGO_IDX)atoi(zz[5]);
3553 if (zz[4][0] == '*')
3555 letter[index].random |= RANDOM_OBJECT;
3556 if (zz[4][1]) letter[index].object = (OBJECT_IDX)atoi(zz[4] + 1);
3558 else if (zz[4][0] == '!')
3560 if (floor_ptr->inside_quest)
3562 ARTIFACT_IDX a_idx = quest[floor_ptr->inside_quest].k_idx;
3565 artifact_type *a_ptr = &a_info[a_idx];
3566 if (!(a_ptr->gen_flags & TRG_INSTA_ART))
3568 letter[index].object = lookup_kind(a_ptr->tval, a_ptr->sval);
3575 letter[index].object = (IDX)atoi(zz[4]);
3580 if (zz[3][0] == '*')
3582 letter[index].random |= RANDOM_MONSTER;
3583 if (zz[3][1]) letter[index].monster = (IDX)atoi(zz[3] + 1);
3585 else if (zz[3][0] == 'c')
3587 if (!zz[3][1]) return PARSE_ERROR_GENERIC;
3588 letter[index].monster = -atoi(zz[3] + 1);
3592 letter[index].monster = (IDX)atoi(zz[3]);
3597 letter[index].cave_info = atoi(zz[2]);
3601 if ((zz[1][0] == '*') && !zz[1][1])
3603 letter[index].random |= RANDOM_FEATURE;
3607 letter[index].feature = f_tag_to_index(zz[1]);
3608 if (letter[index].feature < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
3618 * @brief 地形情報の「B:」情報をパースする
3619 * Process "B:<Index>:<Command>:..." -- Building definition
3623 static errr parse_line_building(char *buf)
3639 /* Get the building number */
3642 /* Find the colon after the building number */
3643 s = my_strchr(s, ':');
3645 /* Verify that colon */
3648 /* Nuke the colon, advance to the sub-index */
3651 /* Paranoia -- require a sub-index */
3654 /* Building definition sub-index */
3657 /* Building name, owner, race */
3660 if (tokenize(s + 2, 3, zz, 0) == 3)
3662 /* Name of the building */
3663 strcpy(building[index].name, zz[0]);
3665 /* Name of the owner */
3666 strcpy(building[index].owner_name, zz[1]);
3668 /* Race of the owner */
3669 strcpy(building[index].owner_race, zz[2]);
3674 return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
3677 /* Building Action */
3680 if (tokenize(s + 2, 8, zz, 0) >= 7)
3682 /* Index of the action */
3683 int action_index = atoi(zz[0]);
3685 /* Name of the action */
3686 strcpy(building[index].act_names[action_index], zz[1]);
3688 /* Cost of the action for members */
3689 building[index].member_costs[action_index] = (PRICE)atoi(zz[2]);
3691 /* Cost of the action for non-members */
3692 building[index].other_costs[action_index] = (PRICE)atoi(zz[3]);
3694 /* Letter assigned to the action */
3695 building[index].letters[action_index] = zz[4][0];
3698 building[index].actions[action_index] = (BACT_IDX)atoi(zz[5]);
3700 /* Action restriction */
3701 building[index].action_restr[action_index] = (BACT_RESTRICT_IDX)atoi(zz[6]);
3706 return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
3709 /* Building Classes */
3713 n = tokenize(s + 2, MAX_CLASS, zz, 0);
3714 for (i = 0; i < MAX_CLASS; i++)
3716 building[index].member_class[i] = ((i < n) ? (CLASS_IDX)atoi(zz[i]) : 1);
3721 /* Building Races */
3725 n = tokenize(s + 2, MAX_RACES, zz, 0);
3726 for (i = 0; i < MAX_RACES; i++)
3728 building[index].member_race[i] = ((i < n) ? (RACE_IDX)atoi(zz[i]) : 1);
3733 /* Building Realms */
3737 n = tokenize(s + 2, MAX_MAGIC, zz, 0);
3738 for (i = 0; i < MAX_MAGIC; i++)
3740 building[index].member_realm[i + 1] = ((i < n) ? (REALM_IDX)atoi(zz[i]) : 1);
3747 /* Ignore scripts */
3753 return (PARSE_ERROR_UNDEFINED_DIRECTIVE);
3762 * @brief フロアの所定のマスにオブジェクトを配置する
3763 * Place the object j_ptr to a grid
3764 * @param floor_ptr 現在フロアへの参照ポインタ
3765 * @param j_ptr オブジェクト構造体の参照ポインタ
3770 static void drop_here(floor_type *floor_ptr, object_type *j_ptr, POSITION y, POSITION x)
3772 OBJECT_IDX o_idx = o_pop(floor_ptr);
3774 o_ptr = &floor_ptr->o_list[o_idx];
3775 object_copy(o_ptr, j_ptr);
3778 o_ptr->held_m_idx = 0;
3779 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
3780 o_ptr->next_o_idx = g_ptr->o_idx;
3781 g_ptr->o_idx = o_idx;
3786 * @brief クエスト用固定ダンジョンをフロアに生成する
3787 * Parse a sub-file of the "extra info"
3788 * @param player_ptr プレーヤーへの参照ポインタ
3798 static errr process_dungeon_file_aux(player_type *player_ptr, char *buf, int ymin, int xmin, int ymax, int xmax, int *y, int *x)
3803 /* Skip "empty" lines */
3804 if (!buf[0]) return 0;
3806 /* Skip "blank" lines */
3807 if (iswspace(buf[0])) return 0;
3810 if (buf[0] == '#') return 0;
3812 /* Require "?:*" format */
3813 if (buf[1] != ':') return 1;
3816 /* Process "%:<fname>" */
3819 /* Attempt to Process the given file */
3820 return (process_dungeon_file(player_ptr, buf + 2, ymin, xmin, ymax, xmax));
3823 floor_type *floor_ptr = player_ptr->current_floor_ptr;
3824 /* Process "F:<letter>:<terrain>:<cave_info>:<monster>:<object>:<ego>:<artifact>:<trap>:<special>" -- info for dungeon grid */
3827 return parse_line_feature(player_ptr->current_floor_ptr, buf);
3830 /* Process "D:<dungeon>" -- info for the floor grids */
3831 else if (buf[0] == 'D')
3833 object_type object_type_body;
3835 /* Acquire the text */
3838 /* Length of the text */
3839 int len = strlen(s);
3841 if (init_flags & INIT_ONLY_BUILDINGS) return 0;
3843 for (*x = xmin, i = 0; ((*x < xmax) && (i < len)); (*x)++, s++, i++)
3845 grid_type *g_ptr = &floor_ptr->grid_array[*y][*x];
3849 OBJECT_IDX object_index = letter[idx].object;
3850 MONSTER_IDX monster_index = letter[idx].monster;
3851 int random = letter[idx].random;
3852 ARTIFACT_IDX artifact_index = letter[idx].artifact;
3854 /* Lay down a floor */
3855 g_ptr->feat = conv_dungeon_feat(floor_ptr, letter[idx].feature);
3857 /* Only the features */
3858 if (init_flags & INIT_ONLY_FEATURES) continue;
3861 g_ptr->info = letter[idx].cave_info;
3863 /* Create a monster */
3864 if (random & RANDOM_MONSTER)
3866 floor_ptr->monster_level = floor_ptr->base_level + monster_index;
3868 place_monster(*y, *x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
3870 floor_ptr->monster_level = floor_ptr->base_level;
3872 else if (monster_index)
3874 int old_cur_num, old_max_num;
3877 if (monster_index < 0)
3879 monster_index = -monster_index;
3882 old_cur_num = r_info[monster_index].cur_num;
3883 old_max_num = r_info[monster_index].max_num;
3885 /* Make alive again */
3886 if (r_info[monster_index].flags1 & RF1_UNIQUE)
3888 r_info[monster_index].cur_num = 0;
3889 r_info[monster_index].max_num = 1;
3892 /* Make alive again */
3893 /* Hack -- Non-unique Nazguls are semi-unique */
3894 else if (r_info[monster_index].flags7 & RF7_NAZGUL)
3896 if (r_info[monster_index].cur_num == r_info[monster_index].max_num)
3898 r_info[monster_index].max_num++;
3903 place_monster_aux(0, *y, *x, monster_index, (PM_ALLOW_SLEEP | PM_NO_KAGE));
3907 floor_ptr->m_list[hack_m_idx_ii].smart |= SM_CLONED;
3909 /* Make alive again for real unique monster */
3910 r_info[monster_index].cur_num = old_cur_num;
3911 r_info[monster_index].max_num = old_max_num;
3915 /* Object (and possible trap) */
3916 if ((random & RANDOM_OBJECT) && (random & RANDOM_TRAP))
3918 floor_ptr->object_level = floor_ptr->base_level + object_index;
3921 * Random trap and random treasure defined
3922 * 25% chance for trap and 75% chance for object
3924 if (randint0(100) < 75)
3926 place_object(player_ptr, *y, *x, 0L);
3930 place_trap(floor_ptr, *y, *x);
3933 floor_ptr->object_level = floor_ptr->base_level;
3935 else if (random & RANDOM_OBJECT)
3937 floor_ptr->object_level = floor_ptr->base_level + object_index;
3939 /* Create an out of deep object */
3940 if (randint0(100) < 75)
3941 place_object(player_ptr, *y, *x, 0L);
3942 else if (randint0(100) < 80)
3943 place_object(player_ptr, *y, *x, AM_GOOD);
3945 place_object(player_ptr, *y, *x, AM_GOOD | AM_GREAT);
3947 floor_ptr->object_level = floor_ptr->base_level;
3950 else if (random & RANDOM_TRAP)
3952 place_trap(floor_ptr, *y, *x);
3954 /* Hidden trap (or door) */
3955 else if (letter[idx].trap)
3957 g_ptr->mimic = g_ptr->feat;
3958 g_ptr->feat = conv_dungeon_feat(floor_ptr, letter[idx].trap);
3960 else if (object_index)
3962 object_type *o_ptr = &object_type_body;
3963 object_prep(o_ptr, object_index);
3965 if (o_ptr->tval == TV_GOLD)
3967 coin_type = object_index - OBJ_GOLD_LIST;
3968 make_gold(floor_ptr, o_ptr);
3972 /* Apply magic (no messages, no artifacts) */
3973 apply_magic(player_ptr, o_ptr, floor_ptr->base_level, AM_NO_FIXED_ART | AM_GOOD);
3975 drop_here(floor_ptr, o_ptr, *y, *x);
3981 if (a_info[artifact_index].cur_num)
3983 KIND_OBJECT_IDX k_idx = lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
3985 object_type *q_ptr = &forge;
3987 object_prep(q_ptr, k_idx);
3988 drop_here(floor_ptr, q_ptr, *y, *x);
3992 if (create_named_art(player_ptr, artifact_index, *y, *x))
3993 a_info[artifact_index].cur_num = 1;
3997 /* Terrain special */
3998 g_ptr->special = letter[idx].special;
4006 /* Process "Q:<number>:<command>:... -- quest info */
4007 else if (buf[0] == 'Q')
4014 num = tokenize(buf + 2, 33, zz, 0);
4018 num = tokenize(buf + 3, 33, zz, 0);
4021 /* Have we enough parameters? */
4022 if (num < 3) return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
4025 q_ptr = &(quest[atoi(zz[0])]);
4027 /* Process "Q:<q_index>:Q:<type>:<num_mon>:<cur_num>:<max_num>:<level>:<r_idx>:<k_idx>:<flags>" -- quest info */
4028 if (zz[1][0] == 'Q')
4030 if (init_flags & INIT_ASSIGN)
4032 monster_race *r_ptr;
4033 artifact_type *a_ptr;
4035 if (num < 9) return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
4037 q_ptr->type = (QUEST_TYPE)atoi(zz[2]);
4038 q_ptr->num_mon = (MONSTER_NUMBER)atoi(zz[3]);
4039 q_ptr->cur_num = (MONSTER_NUMBER)atoi(zz[4]);
4040 q_ptr->max_num = (MONSTER_NUMBER)atoi(zz[5]);
4041 q_ptr->level = (DEPTH)atoi(zz[6]);
4042 q_ptr->r_idx = (IDX)atoi(zz[7]);
4043 q_ptr->k_idx = (IDX)atoi(zz[8]);
4044 q_ptr->dungeon = (DUNGEON_IDX)atoi(zz[9]);
4046 if (num > 10) q_ptr->flags = atoi(zz[10]);
4048 r_ptr = &r_info[q_ptr->r_idx];
4049 if (r_ptr->flags1 & RF1_UNIQUE)
4050 r_ptr->flags1 |= RF1_QUESTOR;
4052 a_ptr = &a_info[q_ptr->k_idx];
4053 a_ptr->gen_flags |= TRG_QUESTITEM;
4058 else if (zz[1][0] == 'R')
4060 if (init_flags & INIT_ASSIGN)
4063 IDX idx, reward_idx = 0;
4065 for (idx = 2; idx < num; idx++)
4067 IDX a_idx = (IDX)atoi(zz[idx]);
4068 if (a_idx < 1) continue;
4069 if (a_info[a_idx].cur_num > 0) continue;
4071 if (one_in_(count)) reward_idx = a_idx;
4076 /* Set quest's rewarding artifact */
4077 q_ptr->k_idx = reward_idx;
4078 a_info[reward_idx].gen_flags |= TRG_QUESTITEM;
4082 /* Change a quest type to KILL_ALL when all artifact of reward list are got */
4083 q_ptr->type = QUEST_TYPE_KILL_ALL;
4090 /* Process "Q:<q_index>:N:<name>" -- quest name */
4091 else if (zz[1][0] == 'N')
4093 if (init_flags & (INIT_ASSIGN | INIT_SHOW_TEXT | INIT_NAME_ONLY))
4095 strcpy(q_ptr->name, zz[2]);
4101 /* Process "Q:<q_index>:T:<text>" -- quest description line */
4102 else if (zz[1][0] == 'T')
4104 if (init_flags & INIT_SHOW_TEXT)
4106 strcpy(quest_text[quest_text_line], zz[2]);
4114 /* Process "W:<command>: ..." -- info for the wilderness */
4115 else if (buf[0] == 'W')
4117 return parse_line_wilderness(player_ptr, buf, ymin, xmin, ymax, xmax, y, x);
4120 /* Process "P:<y>:<x>" -- player position */
4121 else if (buf[0] == 'P')
4123 if (init_flags & INIT_CREATE_DUNGEON)
4125 if (tokenize(buf + 2, 2, zz, 0) == 2)
4127 int panels_x, panels_y;
4129 /* Hack - Set the dungeon size */
4130 panels_y = (*y / SCREEN_HGT);
4131 if (*y % SCREEN_HGT) panels_y++;
4132 floor_ptr->height = panels_y * SCREEN_HGT;
4134 panels_x = (*x / SCREEN_WID);
4135 if (*x % SCREEN_WID) panels_x++;
4136 floor_ptr->width = panels_x * SCREEN_WID;
4138 /* Assume illegal panel */
4139 panel_row_min = floor_ptr->height;
4140 panel_col_min = floor_ptr->width;
4142 /* Place player in a quest level */
4143 if (floor_ptr->inside_quest)
4147 /* Delete the monster (if any) */
4148 delete_monster(player_ptr->current_floor_ptr, player_ptr->y, player_ptr->x);
4156 /* Place player in the town */
4157 else if (!player_ptr->oldpx && !player_ptr->oldpy)
4159 player_ptr->oldpy = atoi(zz[0]);
4160 player_ptr->oldpx = atoi(zz[1]);
4168 /* Process "B:<Index>:<Command>:..." -- Building definition */
4169 else if (buf[0] == 'B')
4171 return parse_line_building(buf);
4174 /* Process "M:<type>:<maximum>" -- set maximum values */
4175 else if (buf[0] == 'M')
4177 if (tokenize(buf + 2, 2, zz, 0) == 2)
4180 if (zz[0][0] == 'T')
4182 max_towns = (TOWN_IDX)atoi(zz[1]);
4185 /* Maximum quests */
4186 else if (zz[0][0] == 'Q')
4188 max_q_idx = (QUEST_IDX)atoi(zz[1]);
4192 else if (zz[0][0] == 'R')
4194 max_r_idx = (RACE_IDX)atoi(zz[1]);
4198 else if (zz[0][0] == 'K')
4200 max_k_idx = (KIND_OBJECT_IDX)atoi(zz[1]);
4204 else if (zz[0][0] == 'V')
4206 max_v_idx = (VAULT_IDX)atoi(zz[1]);
4210 else if (zz[0][0] == 'F')
4212 max_f_idx = (FEAT_IDX)atoi(zz[1]);
4216 else if (zz[0][0] == 'A')
4218 max_a_idx = (ARTIFACT_IDX)atoi(zz[1]);
4222 else if (zz[0][0] == 'E')
4224 max_e_idx = (EGO_IDX)atoi(zz[1]);
4228 else if (zz[0][0] == 'D')
4230 current_world_ptr->max_d_idx = (DUNGEON_IDX)atoi(zz[1]);
4234 else if (zz[0][0] == 'O')
4236 current_world_ptr->max_o_idx = (OBJECT_IDX)atoi(zz[1]);
4240 else if (zz[0][0] == 'M')
4242 current_world_ptr->max_m_idx = (MONSTER_IDX)atoi(zz[1]);
4245 /* Wilderness size */
4246 else if (zz[0][0] == 'W')
4248 /* Maximum wild_x_size */
4249 if (zz[0][1] == 'X')
4250 current_world_ptr->max_wild_x = (POSITION)atoi(zz[1]);
4251 /* Maximum wild_y_size */
4252 if (zz[0][1] == 'Y')
4253 current_world_ptr->max_wild_y = (POSITION)atoi(zz[1]);
4264 * todo ここから先頭に移すとコンパイル警告が出る……
4267 static concptr variant = "ZANGBAND";
4270 * @brief クエスト用固定ダンジョン生成時の分岐処理
4271 * Helper function for "process_dungeon_file()"
4272 * @param player_ptr プレーヤーへの参照ポインタ
4277 static concptr process_dungeon_file_expr(player_type *player_ptr, char **sp, char *fp)
4288 while (iswspace(*s)) s++;
4295 concptr v = "?o?o?";
4307 t = process_dungeon_file_expr(player_ptr, &s, &f);
4315 else if (streq(t, "IOR"))
4318 while (*s && (f != b2))
4320 t = process_dungeon_file_expr(player_ptr, &s, &f);
4321 if (*t && !streq(t, "0")) v = "1";
4326 else if (streq(t, "AND"))
4329 while (*s && (f != b2))
4331 t = process_dungeon_file_expr(player_ptr, &s, &f);
4332 if (*t && streq(t, "0")) v = "0";
4337 else if (streq(t, "NOT"))
4340 while (*s && (f != b2))
4342 t = process_dungeon_file_expr(player_ptr, &s, &f);
4343 if (*t && streq(t, "1")) v = "0";
4348 else if (streq(t, "EQU"))
4351 if (*s && (f != b2))
4353 t = process_dungeon_file_expr(player_ptr, &s, &f);
4355 while (*s && (f != b2))
4357 p = process_dungeon_file_expr(player_ptr, &s, &f);
4358 if (streq(t, p)) v = "1";
4363 else if (streq(t, "LEQ"))
4366 if (*s && (f != b2))
4368 t = process_dungeon_file_expr(player_ptr, &s, &f);
4370 while (*s && (f != b2))
4373 t = process_dungeon_file_expr(player_ptr, &s, &f);
4374 if (*t && atoi(p) > atoi(t)) v = "0";
4379 else if (streq(t, "GEQ"))
4382 if (*s && (f != b2))
4384 t = process_dungeon_file_expr(player_ptr, &s, &f);
4386 while (*s && (f != b2))
4389 t = process_dungeon_file_expr(player_ptr, &s, &f);
4391 /* Compare two numbers instead of string */
4392 if (*t && atoi(p) < atoi(t)) v = "0";
4398 while (*s && (f != b2))
4400 t = process_dungeon_file_expr(player_ptr, &s, &f);
4405 if (f != b2) v = "?x?x?";
4407 /* Extract final and Terminate */
4408 if ((f = *s) != '\0') *s++ = '\0';
4415 /* Accept all printables except spaces and brackets */
4417 while (iskanji(*s) || (isprint(*s) && !my_strchr(" []", *s)))
4419 if (iskanji(*s)) s++;
4423 while (isprint(*s) && !my_strchr(" []", *s)) ++s;
4426 /* Extract final and Terminate */
4427 if ((f = *s) != '\0') *s++ = '\0';
4439 if (streq(b + 1, "SYS"))
4445 else if (streq(b + 1, "GRAF"))
4450 else if (streq(b + 1, "MONOCHROME"))
4459 else if (streq(b + 1, "RACE"))
4461 v = _(rp_ptr->E_title, rp_ptr->title);
4465 else if (streq(b + 1, "CLASS"))
4467 v = _(cp_ptr->E_title, cp_ptr->title);
4471 else if (streq(b + 1, "REALM1"))
4473 v = _(E_realm_names[player_ptr->realm1], realm_names[player_ptr->realm1]);
4477 else if (streq(b + 1, "REALM2"))
4479 v = _(E_realm_names[player_ptr->realm2], realm_names[player_ptr->realm2]);
4483 else if (streq(b + 1, "PLAYER"))
4485 static char tmp_player_name[32];
4487 for (pn = player_ptr->name, tpn = tmp_player_name; *pn; pn++, tpn++)
4497 *tpn = my_strchr(" []", *pn) ? '_' : *pn;
4500 v = tmp_player_name;
4504 else if (streq(b + 1, "TOWN"))
4506 sprintf(tmp, "%d", player_ptr->town_num);
4511 else if (streq(b + 1, "LEVEL"))
4513 sprintf(tmp, "%d", player_ptr->lev);
4517 /* Current quest number */
4518 else if (streq(b + 1, "QUEST_NUMBER"))
4520 sprintf(tmp, "%d", player_ptr->current_floor_ptr->inside_quest);
4524 /* Number of last quest */
4525 else if (streq(b + 1, "LEAVING_QUEST"))
4527 sprintf(tmp, "%d", leaving_quest);
4532 else if (prefix(b + 1, "QUEST_TYPE"))
4534 /* "QUEST_TYPE" uses a special parameter to determine the type of the quest */
4535 sprintf(tmp, "%d", quest[atoi(b + 11)].type);
4540 else if (prefix(b + 1, "QUEST"))
4542 /* "QUEST" uses a special parameter to determine the number of the quest */
4543 sprintf(tmp, "%d", quest[atoi(b + 6)].status);
4548 else if (prefix(b + 1, "RANDOM"))
4550 /* "RANDOM" uses a special parameter to determine the number of the quest */
4551 sprintf(tmp, "%d", (int)(current_world_ptr->seed_town%atoi(b + 7)));
4556 else if (streq(b + 1, "VARIANT"))
4562 else if (streq(b + 1, "WILDERNESS"))
4565 sprintf(tmp, "NONE");
4567 sprintf(tmp, "LITE");
4569 sprintf(tmp, "NORMAL");
4579 void write_r_info_txt(void)
4581 int i, j, z, fc, bc;
4584 concptr flags[32 * 10];
4589 monster_race *r_ptr;
4591 monster_blow *b_ptr;
4593 FILE *fff = fopen("output.txt", "wt");
4597 BIT_FLAGS mode = -1;
4601 fprintf(fff, "# File: r_info.txt (autogenerated)\n\n");
4603 fprintf(fff, "# Version stamp (required)\n\n");
4606 fprintf(fff, "V:%d.%d.%d\n\n\n", r_head->v_major, r_head->v_minor, r_head->v_patch);
4609 fprintf(fff, "##### The Player #####\n\n");
4611 for (z = -1; z < alloc_race_size; z++)
4613 /* Output the monsters in order */
4614 i = (z >= 0) ? alloc_race_table[z].index : 0;
4616 /* Acquire the monster */
4619 /* Ignore empty monsters */
4620 if (!strlen(r_name + r_ptr->name)) continue;
4622 /* Ignore useless monsters */
4623 if (i && !r_ptr->speed) continue;
4625 /* Write a note if necessary */
4626 if (i && (!r_ptr->level != !mode))
4631 fprintf(fff, "\n##### Town monsters #####\n\n");
4633 /* Note the dungeon */
4636 fprintf(fff, "\n##### Normal monsters #####\n\n");
4639 /* Record the change */
4640 mode = r_ptr->level;
4643 /* Acquire the flags */
4644 f_ptr[0] = r_ptr->flags1; n_ptr[0] = r_info_flags1;
4645 f_ptr[1] = r_ptr->flags2; n_ptr[1] = r_info_flags2;
4646 f_ptr[2] = r_ptr->flags3; n_ptr[2] = r_info_flags3;
4647 f_ptr[3] = r_ptr->flags4; n_ptr[3] = r_info_flags4;
4648 f_ptr[4] = r_ptr->a_ability_flags1; n_ptr[4] = r_a_ability_flags1;
4649 f_ptr[5] = r_ptr->a_ability_flags2; n_ptr[5] = r_a_ability_flags2;
4650 f_ptr[6] = r_ptr->flags7; n_ptr[6] = r_info_flags7;
4651 f_ptr[7] = r_ptr->flags8; n_ptr[7] = r_info_flags8;
4652 f_ptr[8] = r_ptr->flags9; n_ptr[8] = r_info_flags9;
4653 f_ptr[9] = r_ptr->flagsr; n_ptr[9] = r_info_flagsr;
4655 /* Write New/Number/Name */
4656 fprintf(fff, "N:%d:%s\n", z + 1, r_name + r_ptr->name);
4659 fprintf(fff, "G:%c:%c\n", r_ptr->d_char, color_char[r_ptr->d_attr]);
4661 /* Write Information */
4662 fprintf(fff, "I:%d:%dd%d:%d:%d:%d\n", r_ptr->speed, r_ptr->hdice, r_ptr->hside,
4663 r_ptr->aaf, r_ptr->ac, r_ptr->sleep);
4665 /* Write more information */
4666 fprintf(fff, "W:%d:%d:%d:%ld\n", r_ptr->level, r_ptr->rarity, r_ptr->extra, r_ptr->mexp);
4669 for (j = 0; j < 4; j++)
4671 b_ptr = &(r_ptr->blow[j]);
4673 /* Stop when done */
4674 if (!b_ptr->method) break;
4676 /* Write the blows */
4677 fprintf(fff, "B:%s:%s:%dd%d\n", r_info_blow_method[b_ptr->method],
4678 r_info_blow_effect[b_ptr->effect],
4679 b_ptr->d_dice, b_ptr->d_side);
4681 for (fc = 0, j = 0; j < 32 * 3; j++)
4683 /* Check this flag */
4684 if (f_ptr[j / 32] & (1L << (j % 32))) flags[fc++] = n_ptr[j / 32][j % 32];
4687 /* Extract the extra flags */
4688 for (j = 32 * 6; j < 32 * 10; j++)
4690 /* Check this flag */
4691 if (f_ptr[j / 32] & (1L << (j % 32))) flags[fc++] = n_ptr[j / 32][j % 32];
4694 /* Write the flags */
4695 for (j = 0; j < fc;)
4699 /* Start the line */
4702 for (bc = 0; (bc < 60) && (j < fc); j++)
4706 /* Format the flag */
4707 sprintf(t, "%s%s", flags[j], (j < fc - 1) ? " | " : "");
4709 /* Add it to the buffer */
4712 /* Note the length */
4716 /* Done with this line; write it */
4717 fprintf(fff, "%s\n", buf);
4720 /* Write Spells if applicable */
4721 if (r_ptr->freq_spell)
4723 /* Write the frequency */
4724 fprintf(fff, "S:1_IN_%d | \n", 100 / r_ptr->freq_spell);
4726 /* Extract the spell flags */
4727 for (fc = 0, j = 96; j < 192; j++)
4729 /* Check this flag */
4730 if (f_ptr[j / 32] & (1L << (j % 32))) flags[fc++] = n_ptr[j / 32][j % 32];
4733 /* Write the flags */
4734 for (j = 0; j < fc;)
4738 /* Start the line */
4741 for (bc = 0, t = buf + 2; (bc < 60) && (j < fc); j++)
4745 /* Format the flag */
4746 sprintf(t, "%s%s", flags[j], (j < fc - 1) ? " | " : "");
4750 /* Note the length */
4757 /* Done with this line; write it */
4758 fprintf(fff, "%s\n", buf);
4762 /* Acquire the description */
4763 desc = r_text + r_ptr->text;
4764 dlen = strlen(desc);
4766 /* Write Description */
4767 for (j = 0; j < dlen;)
4771 /* Start the line */
4774 for (bc = 0, t = buf + 2; ((bc < 60) || !iswspace(desc[j])) && (j < dlen); j++, bc++, t++)
4782 /* Done with this line; write it */
4783 fprintf(fff, "%s\n", buf);
4786 /* Space between entries */
4797 * @brief クエスト用固定ダンジョン生成時のメインルーチン
4798 * Helper function for "process_dungeon_file()"
4799 * @param player_ptr プレーヤーへの参照ポインタ
4807 errr process_dungeon_file(player_type *player_ptr, concptr name, int ymin, int xmin, int ymax, int xmax)
4810 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, name);
4812 fp = my_fopen(buf, "r");
4815 if (!fp) return (-1);
4817 /* Process the file */
4820 bool bypass = FALSE;
4821 int x = xmin, y = ymin;
4822 while (my_fgets(fp, buf, sizeof(buf)) == 0)
4828 /* Skip "empty" lines */
4829 if (!buf[0]) continue;
4831 /* Skip "blank" lines */
4832 if (iswspace(buf[0])) continue;
4835 if (buf[0] == '#') continue;
4838 /* Process "?:<expr>" */
4839 if ((buf[0] == '?') && (buf[1] == ':'))
4848 /* Parse the expr */
4849 v = process_dungeon_file_expr(player_ptr, &s, &f);
4852 bypass = (streq(v, "0") ? TRUE : FALSE);
4856 /* Apply conditionals */
4857 if (bypass) continue;
4859 /* Process the line */
4860 err = process_dungeon_file_aux(player_ptr, buf, ymin, xmin, ymax, xmax, &y, &x);
4867 concptr oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
4868 msg_format("Error %d (%s) at line %d of '%s'.", err, oops, num, name);
4869 msg_format(_("'%s'を解析中。", "Parsing '%s'."), buf);