1 #include "info-reader/magic-reader.h"
2 #include "main/angband-headers.h"
3 #include "player/player-class.h"
4 #include "util/string-processor.h"
7 * @brief 職業魔法情報(m_info)のパース関数 /
8 * Initialize the "m_info" array, by parsing an ascii "template" file
13 errr parse_m_info(char *buf, angband_header *head)
15 static player_magic *m_ptr = NULL;
16 static int realm, magic_idx = 0, readable = 0;
19 int i = atoi(buf + 2);
23 if (i >= head->info_num)
30 } else if (buf[0] == 'I') {
32 int xtra, type, first, weight;
34 s = angband_strchr(buf + 2, ':');
36 /* Verify that colon */
40 /* Nuke the colon, advance to the name */
45 if (streq(book, "SORCERY"))
46 m_ptr->spell_book = TV_SORCERY_BOOK;
47 else if (streq(book, "LIFE"))
48 m_ptr->spell_book = TV_LIFE_BOOK;
49 else if (streq(book, "MUSIC"))
50 m_ptr->spell_book = TV_MUSIC_BOOK;
51 else if (streq(book, "HISSATSU"))
52 m_ptr->spell_book = TV_HISSATSU_BOOK;
53 else if (streq(book, "NONE"))
54 m_ptr->spell_book = TV_NONE;
59 s = angband_strchr(s, ':');
64 if (streq(stat, "STR"))
65 m_ptr->spell_stat = A_STR;
66 else if (streq(stat, "INT"))
67 m_ptr->spell_stat = A_INT;
68 else if (streq(stat, "WIS"))
69 m_ptr->spell_stat = A_WIS;
70 else if (streq(stat, "DEX"))
71 m_ptr->spell_stat = A_DEX;
72 else if (streq(stat, "CON"))
73 m_ptr->spell_stat = A_CON;
74 else if (streq(stat, "CHR"))
75 m_ptr->spell_stat = A_CHR;
79 if (4 != sscanf(s, "%x:%d:%d:%d", (uint *)&xtra, &type, &first, &weight))
82 m_ptr->spell_xtra = xtra;
83 m_ptr->spell_type = type;
84 m_ptr->spell_first = first;
85 m_ptr->spell_weight = weight;
86 } else if (buf[0] == 'R') {
87 if (2 != sscanf(buf + 2, "%d:%d", &realm, &readable))
91 } else if (buf[0] == 'T') {
92 int level, mana, fail, exp;
96 if (4 != sscanf(buf + 2, "%d:%d:%d:%d", &level, &mana, &fail, &exp))
99 m_ptr->info[realm][magic_idx].slevel = (PLAYER_LEVEL)level;
100 m_ptr->info[realm][magic_idx].smana = (MANA_POINT)mana;
101 m_ptr->info[realm][magic_idx].sfail = (PERCENTAGE)fail;
102 m_ptr->info[realm][magic_idx].sexp = (EXP)exp;