OSDN Git Service

[Refactor] 無駄な空白、改行の削除、includeのソート
[hengband/hengband.git] / src / autopick / autopick-pref-processor.c
1 #include "autopick/autopick-pref-processor.h"
2 #include "autopick/autopick-entry.h"
3 #include "autopick/autopick-util.h"
4 #include "system/angband.h"
5
6 /*
7  *  Process line for auto picker/destroyer.
8  */
9 void process_autopick_file_command(char *buf)
10 {
11         autopick_type an_entry, *entry = &an_entry;
12         int i;
13         for (i = 0; buf[i]; i++)
14         {
15 #ifdef JP
16                 if (iskanji(buf[i]))
17                 {
18                         i++;
19                         continue;
20                 }
21 #endif
22                 if (iswspace(buf[i]) && buf[i] != ' ')
23                         break;
24         }
25
26         buf[i] = 0;
27         if (!autopick_new_entry(entry, buf, FALSE)) return;
28
29         for (i = 0; i < max_autopick; i++)
30         {
31                 if (!strcmp(entry->name, autopick_list[i].name)
32                         && entry->flag[0] == autopick_list[i].flag[0]
33                         && entry->flag[1] == autopick_list[i].flag[1]
34                         && entry->dice == autopick_list[i].dice
35                         && entry->bonus == autopick_list[i].bonus)
36                 {
37                         autopick_free_entry(entry);
38                         return;
39                 }
40         }
41
42         add_autopick_list(entry);
43 }