switch (buf[0])
{
- /* Mega-Hack -- read external player's history file */
- /* Process "H:<history>" */
- case 'H':
- add_history_from_pref_line(buf + 2);
- return 0;
-
- /* Process "R:<num>:<a>/<c>" -- attr/char for monster races */
- case 'R':
- if (tokenize(buf+2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
- {
- monster_race *r_ptr;
- i = (huge)strtol(zz[0], NULL, 0);
- n1 = strtol(zz[1], NULL, 0);
- n2 = strtol(zz[2], NULL, 0);
- if (i >= max_r_idx) return 1;
- r_ptr = &r_info[i];
- if (n1 || (!(n2 & 0x80) && n2)) r_ptr->x_attr = n1; /* Allow TERM_DARK text */
- if (n2) r_ptr->x_char = n2;
+ /* Mega-Hack -- read external player's history file */
+ /* Process "H:<history>" */
+ case 'H':
+ add_history_from_pref_line(buf + 2);
return 0;
- }
- break;
- /* Process "K:<num>:<a>/<c>" -- attr/char for object kinds */
- case 'K':
- if (tokenize(buf+2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
- {
- object_kind *k_ptr;
- i = (huge)strtol(zz[0], NULL, 0);
- n1 = strtol(zz[1], NULL, 0);
- n2 = strtol(zz[2], NULL, 0);
- if (i >= max_k_idx) return 1;
- k_ptr = &k_info[i];
- if (n1 || (!(n2 & 0x80) && n2)) k_ptr->x_attr = n1; /* Allow TERM_DARK text */
- if (n2) k_ptr->x_char = n2;
- return 0;
- }
- break;
+ /* Process "R:<num>:<a>/<c>" -- attr/char for monster races */
+ case 'R':
+ if (tokenize(buf+2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
+ {
+ monster_race *r_ptr;
+ i = (huge)strtol(zz[0], NULL, 0);
+ n1 = strtol(zz[1], NULL, 0);
+ n2 = strtol(zz[2], NULL, 0);
+ if (i >= max_r_idx) return 1;
+ r_ptr = &r_info[i];
+ if (n1 || (!(n2 & 0x80) && n2)) r_ptr->x_attr = n1; /* Allow TERM_DARK text */
+ if (n2) r_ptr->x_char = n2;
+ return 0;
+ }
+ break;
- /* Process "F:<num>:<a>/<c>" -- attr/char for terrain features */
- /* "F:<num>:<a>/<c>" */
- /* "F:<num>:<a>/<c>:LIT" */
- /* "F:<num>:<a>/<c>:<la>/<lc>:<da>/<dc>" */
- case 'F':
- {
- feature_type *f_ptr;
- int num = tokenize(buf + 2, F_LIT_MAX * 2 + 1, zz, TOKENIZE_CHECKQUOTE);
+ /* Process "K:<num>:<a>/<c>" -- attr/char for object kinds */
+ case 'K':
+ if (tokenize(buf+2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
+ {
+ object_kind *k_ptr;
+ i = (huge)strtol(zz[0], NULL, 0);
+ n1 = strtol(zz[1], NULL, 0);
+ n2 = strtol(zz[2], NULL, 0);
+ if (i >= max_k_idx) return 1;
+ k_ptr = &k_info[i];
+ if (n1 || (!(n2 & 0x80) && n2)) k_ptr->x_attr = n1; /* Allow TERM_DARK text */
+ if (n2) k_ptr->x_char = n2;
+ return 0;
+ }
+ break;
+
+ /* Process "F:<num>:<a>/<c>" -- attr/char for terrain features */
+ /* "F:<num>:<a>/<c>" */
+ /* "F:<num>:<a>/<c>:LIT" */
+ /* "F:<num>:<a>/<c>:<la>/<lc>:<da>/<dc>" */
+ case 'F':
+ {
+ feature_type *f_ptr;
+ int num = tokenize(buf + 2, F_LIT_MAX * 2 + 1, zz, TOKENIZE_CHECKQUOTE);
- if ((num != 3) && (num != 4) && (num != F_LIT_MAX * 2 + 1)) return 1;
- else if ((num == 4) && !streq(zz[3], "LIT")) return 1;
+ if ((num != 3) && (num != 4) && (num != F_LIT_MAX * 2 + 1)) return 1;
+ else if ((num == 4) && !streq(zz[3], "LIT")) return 1;
- i = (huge)strtol(zz[0], NULL, 0);
- if (i >= max_f_idx) return 1;
- f_ptr = &f_info[i];
+ i = (huge)strtol(zz[0], NULL, 0);
+ if (i >= max_f_idx) return 1;
+ f_ptr = &f_info[i];
- n1 = strtol(zz[1], NULL, 0);
- n2 = strtol(zz[2], NULL, 0);
- if (n1 || (!(n2 & 0x80) && n2)) f_ptr->x_attr[F_LIT_STANDARD] = n1; /* Allow TERM_DARK text */
- if (n2) f_ptr->x_char[F_LIT_STANDARD] = n2;
+ n1 = strtol(zz[1], NULL, 0);
+ n2 = strtol(zz[2], NULL, 0);
+ if (n1 || (!(n2 & 0x80) && n2)) f_ptr->x_attr[F_LIT_STANDARD] = n1; /* Allow TERM_DARK text */
+ if (n2) f_ptr->x_char[F_LIT_STANDARD] = n2;
- /* Mega-hack -- feat supports lighting */
- switch (num)
- {
- /* No lighting support */
- case 3:
- n1 = f_ptr->x_attr[F_LIT_STANDARD];
- n2 = f_ptr->x_char[F_LIT_STANDARD];
- for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
+ /* Mega-hack -- feat supports lighting */
+ switch (num)
{
- f_ptr->x_attr[j] = n1;
- f_ptr->x_char[j] = n2;
- }
- break;
+ /* No lighting support */
+ case 3:
+ n1 = f_ptr->x_attr[F_LIT_STANDARD];
+ n2 = f_ptr->x_char[F_LIT_STANDARD];
+ for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
+ {
+ f_ptr->x_attr[j] = n1;
+ f_ptr->x_char[j] = n2;
+ }
+ break;
- /* Use default lighting */
- case 4:
- apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
- break;
+ /* Use default lighting */
+ case 4:
+ apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
+ break;
- /* Use desired lighting */
- case F_LIT_MAX * 2 + 1:
- for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
- {
- n1 = strtol(zz[j * 2 + 1], NULL, 0);
- n2 = strtol(zz[j * 2 + 2], NULL, 0);
- if (n1 || (!(n2 & 0x80) && n2)) f_ptr->x_attr[j] = n1; /* Allow TERM_DARK text */
- if (n2) f_ptr->x_char[j] = n2;
+ /* Use desired lighting */
+ case F_LIT_MAX * 2 + 1:
+ for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
+ {
+ n1 = strtol(zz[j * 2 + 1], NULL, 0);
+ n2 = strtol(zz[j * 2 + 2], NULL, 0);
+ if (n1 || (!(n2 & 0x80) && n2)) f_ptr->x_attr[j] = n1; /* Allow TERM_DARK text */
+ if (n2) f_ptr->x_char[j] = n2;
+ }
+ break;
}
- break;
}
- }
- return 0;
-
- /* Process "S:<num>:<a>/<c>" -- attr/char for special things */
- case 'S':
- if (tokenize(buf+2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
- {
- j = (byte)strtol(zz[0], NULL, 0);
- n1 = strtol(zz[1], NULL, 0);
- n2 = strtol(zz[2], NULL, 0);
- misc_to_attr[j] = n1;
- misc_to_char[j] = n2;
return 0;
- }
- break;
- /* Process "U:<tv>:<a>/<c>" -- attr/char for unaware items */
- case 'U':
- if (tokenize(buf+2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
- {
- j = (huge)strtol(zz[0], NULL, 0);
- n1 = strtol(zz[1], NULL, 0);
- n2 = strtol(zz[2], NULL, 0);
- for (i = 1; i < max_k_idx; i++)
+ /* Process "S:<num>:<a>/<c>" -- attr/char for special things */
+ case 'S':
+ if (tokenize(buf+2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
+ {
+ j = (byte)strtol(zz[0], NULL, 0);
+ n1 = strtol(zz[1], NULL, 0);
+ n2 = strtol(zz[2], NULL, 0);
+ misc_to_attr[j] = n1;
+ misc_to_char[j] = n2;
+ return 0;
+ }
+ break;
+
+ /* Process "U:<tv>:<a>/<c>" -- attr/char for unaware items */
+ case 'U':
+ if (tokenize(buf+2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
{
- object_kind *k_ptr = &k_info[i];
- if (k_ptr->tval == j)
+ j = (huge)strtol(zz[0], NULL, 0);
+ n1 = strtol(zz[1], NULL, 0);
+ n2 = strtol(zz[2], NULL, 0);
+ for (i = 1; i < max_k_idx; i++)
{
- if (n1) k_ptr->d_attr = n1;
- if (n2) k_ptr->d_char = n2;
+ object_kind *k_ptr = &k_info[i];
+ if (k_ptr->tval == j)
+ {
+ if (n1) k_ptr->d_attr = n1;
+ if (n2) k_ptr->d_char = n2;
+ }
}
+ return 0;
}
+ break;
+
+ /* Process "E:<tv>:<a>" -- attribute for inventory objects */
+ case 'E':
+ if (tokenize(buf+2, 2, zz, TOKENIZE_CHECKQUOTE) == 2)
+ {
+ j = (byte)strtol(zz[0], NULL, 0) % 128;
+ n1 = strtol(zz[1], NULL, 0);
+ if (n1) tval_to_attr[j] = n1;
+ return 0;
+ }
+ break;
+
+ /* Process "A:<str>" -- save an "action" for later */
+ case 'A':
+ text_to_ascii(macro__buf, buf+2);
return 0;
- }
- break;
- /* Process "E:<tv>:<a>" -- attribute for inventory objects */
- case 'E':
- if (tokenize(buf+2, 2, zz, TOKENIZE_CHECKQUOTE) == 2)
+ /* Process "P:<str>" -- normal macro */
+ case 'P':
{
- j = (byte)strtol(zz[0], NULL, 0) % 128;
- n1 = strtol(zz[1], NULL, 0);
- if (n1) tval_to_attr[j] = n1;
+ char tmp[1024];
+
+ text_to_ascii(tmp, buf+2);
+ macro_add(tmp, macro__buf);
return 0;
}
- break;
-
- /* Process "A:<str>" -- save an "action" for later */
- case 'A':
- text_to_ascii(macro__buf, buf+2);
- return 0;
- /* Process "P:<str>" -- normal macro */
- case 'P':
- {
- char tmp[1024];
-
- text_to_ascii(tmp, buf+2);
- macro_add(tmp, macro__buf);
- return 0;
- }
-
- /* Process "C:<str>" -- create keymap */
- case 'C':
- {
- int mode;
- char tmp[1024];
-
- if (tokenize(buf+2, 2, zz, TOKENIZE_CHECKQUOTE) != 2) return 1;
+ /* Process "C:<str>" -- create keymap */
+ case 'C':
+ {
+ int mode;
+ char tmp[1024];
- mode = strtol(zz[0], NULL, 0);
- if ((mode < 0) || (mode >= KEYMAP_MODES)) return 1;
+ if (tokenize(buf+2, 2, zz, TOKENIZE_CHECKQUOTE) != 2) return 1;
- text_to_ascii(tmp, zz[1]);
- if (!tmp[0] || tmp[1]) return 1;
- i = (byte)(tmp[0]);
+ mode = strtol(zz[0], NULL, 0);
+ if ((mode < 0) || (mode >= KEYMAP_MODES)) return 1;
- string_free(keymap_act[mode][i]);
+ text_to_ascii(tmp, zz[1]);
+ if (!tmp[0] || tmp[1]) return 1;
+ i = (byte)(tmp[0]);
- keymap_act[mode][i] = string_make(macro__buf);
+ string_free(keymap_act[mode][i]);
- return 0;
- }
+ keymap_act[mode][i] = string_make(macro__buf);
- /* Process "V:<num>:<kv>:<rv>:<gv>:<bv>" -- visual info */
- case 'V':
- if (tokenize(buf+2, 5, zz, TOKENIZE_CHECKQUOTE) == 5)
- {
- i = (byte)strtol(zz[0], NULL, 0);
- angband_color_table[i][0] = (byte)strtol(zz[1], NULL, 0);
- angband_color_table[i][1] = (byte)strtol(zz[2], NULL, 0);
- angband_color_table[i][2] = (byte)strtol(zz[3], NULL, 0);
- angband_color_table[i][3] = (byte)strtol(zz[4], NULL, 0);
return 0;
}
- break;
- /* Process "X:<str>" -- turn option off */
- /* Process "Y:<str>" -- turn option on */
- case 'X':
- case 'Y':
- for (i = 0; option_info[i].o_desc; i++)
- {
- if (option_info[i].o_var &&
- option_info[i].o_text &&
- streq(option_info[i].o_text, buf + 2))
+ /* Process "V:<num>:<kv>:<rv>:<gv>:<bv>" -- visual info */
+ case 'V':
+ if (tokenize(buf+2, 5, zz, TOKENIZE_CHECKQUOTE) == 5)
{
- int os = option_info[i].o_set;
- int ob = option_info[i].o_bit;
+ i = (byte)strtol(zz[0], NULL, 0);
+ angband_color_table[i][0] = (byte)strtol(zz[1], NULL, 0);
+ angband_color_table[i][1] = (byte)strtol(zz[2], NULL, 0);
+ angband_color_table[i][2] = (byte)strtol(zz[3], NULL, 0);
+ angband_color_table[i][3] = (byte)strtol(zz[4], NULL, 0);
+ return 0;
+ }
+ break;
- if ((p_ptr->playing || character_xtra) &&
- (OPT_PAGE_BIRTH == option_info[i].o_page) && !p_ptr->wizard)
+ /* Process "X:<str>" -- turn option off */
+ /* Process "Y:<str>" -- turn option on */
+ case 'X':
+ case 'Y':
+ for (i = 0; option_info[i].o_desc; i++)
+ {
+ if (option_info[i].o_var &&
+ option_info[i].o_text &&
+ streq(option_info[i].o_text, buf + 2))
{
- msg_format(_("初期オプションは変更できません! '%s'", "Birth options can not changed! '%s'"), buf);
- msg_print(NULL);
- return 0;
- }
+ int os = option_info[i].o_set;
+ int ob = option_info[i].o_bit;
- if (buf[0] == 'X')
- {
- /* Clear */
- option_flag[os] &= ~(1L << ob);
- (*option_info[i].o_var) = FALSE;
- }
- else
- {
- /* Set */
- option_flag[os] |= (1L << ob);
- (*option_info[i].o_var) = TRUE;
+ if ((p_ptr->playing || character_xtra) &&
+ (OPT_PAGE_BIRTH == option_info[i].o_page) && !p_ptr->wizard)
+ {
+ msg_format(_("初期オプションは変更できません! '%s'", "Birth options can not changed! '%s'"), buf);
+ msg_print(NULL);
+ return 0;
+ }
+
+ if (buf[0] == 'X')
+ {
+ /* Clear */
+ option_flag[os] &= ~(1L << ob);
+ (*option_info[i].o_var) = FALSE;
+ }
+ else
+ {
+ /* Set */
+ option_flag[os] |= (1L << ob);
+ (*option_info[i].o_var) = TRUE;
+ }
+ return 0;
}
- return 0;
}
- }
- /* don't know that option. ignore it.*/
- msg_format(_("オプションの名前が正しくありません: %s", "Ignored invalid option: %s"), buf);
- msg_print(NULL);
- return 0;
+ /* don't know that option. ignore it.*/
+ msg_format(_("オプションの名前が正しくありません: %s", "Ignored invalid option: %s"), buf);
+ msg_print(NULL);
+ return 0;
- /* Process "Z:<type>:<str>" -- set spell color */
- case 'Z':
- {
- /* Find the colon */
- char *t = my_strchr(buf + 2, ':');
+ /* Process "Z:<type>:<str>" -- set spell color */
+ case 'Z':
+ {
+ /* Find the colon */
+ char *t = my_strchr(buf + 2, ':');
- /* Oops */
- if (!t) return 1;
+ /* Oops */
+ if (!t) return 1;
- /* Nuke the colon */
- *(t++) = '\0';
+ /* Nuke the colon */
+ *(t++) = '\0';
- for (i = 0; gf_desc[i].name; i++)
- {
- /* Match this type */
- if (streq(gf_desc[i].name, buf + 2))
+ for (i = 0; gf_desc[i].name; i++)
{
- /* Remember this color set */
- gf_color[gf_desc[i].num] = quark_add(t);
+ /* Match this type */
+ if (streq(gf_desc[i].name, buf + 2))
+ {
+ /* Remember this color set */
+ gf_color[gf_desc[i].num] = quark_add(t);
- /* Success */
- return 0;
+ /* Success */
+ return 0;
+ }
}
- }
- break;
- }
-
- /* Initialize macro trigger names and a template */
- /* Process "T:<trigger>:<keycode>:<shift-keycode>" */
- /* Process "T:<template>:<modifier chr>:<modifier name>:..." */
- case 'T':
- {
- int tok = tokenize(buf+2, 2+MAX_MACRO_MOD, zz, 0);
+ break;
+ }
+ /* Initialize macro trigger names and a template */
+ /* Process "T:<trigger>:<keycode>:<shift-keycode>" */
/* Process "T:<template>:<modifier chr>:<modifier name>:..." */
- if (tok >= 4)
+ case 'T':
{
- int i;
- int num;
+ int tok = tokenize(buf+2, 2+MAX_MACRO_MOD, zz, 0);
- if (macro_template != NULL)
+ /* Process "T:<template>:<modifier chr>:<modifier name>:..." */
+ if (tok >= 4)
{
- num = strlen(macro_modifier_chr);
+ int num;
- /* Kill the template string */
- string_free(macro_template);
- macro_template = NULL;
+ if (macro_template != NULL)
+ {
+ num = strlen(macro_modifier_chr);
- /* Kill flag characters of modifier keys */
- string_free(macro_modifier_chr);
+ /* Kill the template string */
+ string_free(macro_template);
+ macro_template = NULL;
- /* Kill corresponding modifier names */
- for (i = 0; i < num; i++)
- {
- string_free(macro_modifier_name[i]);
- }
+ /* Kill flag characters of modifier keys */
+ string_free(macro_modifier_chr);
- /* Kill trigger name strings */
- for (i = 0; i < max_macrotrigger; i++)
- {
- string_free(macro_trigger_name[i]);
- string_free(macro_trigger_keycode[0][i]);
- string_free(macro_trigger_keycode[1][i]);
- }
+ /* Kill corresponding modifier names */
+ for (i = 0; i < num; i++)
+ {
+ string_free(macro_modifier_name[i]);
+ }
- max_macrotrigger = 0;
- }
+ /* Kill trigger name strings */
+ for (i = 0; i < max_macrotrigger; i++)
+ {
+ string_free(macro_trigger_name[i]);
+ string_free(macro_trigger_keycode[0][i]);
+ string_free(macro_trigger_keycode[1][i]);
+ }
- if (*zz[0] == '\0') return 0; /* clear template */
+ max_macrotrigger = 0;
+ }
- /* Number of modifier flags */
- num = strlen(zz[1]);
+ if (*zz[0] == '\0') return 0; /* clear template */
- /* Limit the number */
- num = MIN(MAX_MACRO_MOD, num);
+ /* Number of modifier flags */
+ num = strlen(zz[1]);
- /* Stop if number of modifier is not correct */
- if (2 + num != tok) return 1;
+ /* Limit the number */
+ num = MIN(MAX_MACRO_MOD, num);
- /* Get a template string */
- macro_template = string_make(zz[0]);
+ /* Stop if number of modifier is not correct */
+ if (2 + num != tok) return 1;
- /* Get flag characters of modifier keys */
- macro_modifier_chr = string_make(zz[1]);
+ /* Get a template string */
+ macro_template = string_make(zz[0]);
- /* Get corresponding modifier names */
- for (i = 0; i < num; i++)
- {
- macro_modifier_name[i] = string_make(zz[2+i]);
- }
- }
+ /* Get flag characters of modifier keys */
+ macro_modifier_chr = string_make(zz[1]);
- /* Process "T:<trigger>:<keycode>:<shift-keycode>" */
- else if (tok >= 2)
- {
- char buf[1024];
- int m;
- char *t, *s;
- if (max_macrotrigger >= MAX_MACRO_TRIG)
- {
- msg_print(_("マクロトリガーの設定が多すぎます!", "Too many macro triggers!"));
- return 1;
+ /* Get corresponding modifier names */
+ for (i = 0; i < num; i++)
+ {
+ macro_modifier_name[i] = string_make(zz[2+i]);
+ }
}
- m = max_macrotrigger;
- max_macrotrigger++;
- /* Take into account the escape character */
- t = buf;
- s = zz[0];
- while (*s)
+ /* Process "T:<trigger>:<keycode>:<shift-keycode>" */
+ else if (tok >= 2)
{
- if ('\\' == *s) s++;
- *t++ = *s++;
- }
- *t = '\0';
+ char buf_aux[1024];
+ int m;
+ char *t, *s;
+ if (max_macrotrigger >= MAX_MACRO_TRIG)
+ {
+ msg_print(_("マクロトリガーの設定が多すぎます!", "Too many macro triggers!"));
+ return 1;
+ }
+ m = max_macrotrigger;
+ max_macrotrigger++;
- /* Get a trigger name */
- macro_trigger_name[m] = string_make(buf);
+ /* Take into account the escape character */
+ t = buf_aux;
+ s = zz[0];
+ while (*s)
+ {
+ if ('\\' == *s) s++;
+ *t++ = *s++;
+ }
+ *t = '\0';
- /* Get the corresponding key code */
- macro_trigger_keycode[0][m] = string_make(zz[1]);
+ /* Get a trigger name */
+ macro_trigger_name[m] = string_make(buf_aux);
- if (tok == 3)
- {
- /* Key code of a combination of it with the shift key */
- macro_trigger_keycode[1][m] = string_make(zz[2]);
- }
- else
- {
- macro_trigger_keycode[1][m] = string_make(zz[1]);
+ /* Get the corresponding key code */
+ macro_trigger_keycode[0][m] = string_make(zz[1]);
+
+ if (tok == 3)
+ {
+ /* Key code of a combination of it with the shift key */
+ macro_trigger_keycode[1][m] = string_make(zz[2]);
+ }
+ else
+ {
+ macro_trigger_keycode[1][m] = string_make(zz[1]);
+ }
}
- }
- /* No error */
- return 0;
- }
+ /* No error */
+ return 0;
+ }
}
/* Failure */