OSDN Git Service

「ダイス目nn以上の」の修正。nnが異なる複数の行を同じものと勘違いして最初の
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 14 Aug 2002 09:43:40 +0000 (09:43 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 14 Aug 2002 09:43:40 +0000 (09:43 +0000)
一行目以外の登録をキャンセルしてしまっていた。

src/autopick.c
src/files.c

index 9e641eb..c7d15f6 100644 (file)
@@ -412,7 +412,7 @@ bool autopick_new_entry(autopick_type *entry, cptr str)
                         while (' ' == *ptr) ptr++;
 
                         /* Read number */
-                        while (isdigit(*ptr))
+                        while ('0' <= *ptr && *ptr <= '9')
                         {
                                 entry->dice = 10 * entry->dice + (*ptr - '0');
                                 ptr++;
@@ -438,7 +438,7 @@ bool autopick_new_entry(autopick_type *entry, cptr str)
                         while (' ' == *ptr) ptr++;
 
                         /* Read number */
-                        while (isdigit(*ptr))
+                        while ('0' <= *ptr && *ptr <= '9')
                         {
                                 entry->bonus = 10 * entry->bonus + (*ptr - '0');
                                 ptr++;
@@ -575,7 +575,7 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
                 }
         }
 
-        /*** Weapons whic dd*ds is more than nn ***/
+        /*** Weapons which dd*ds is more than nn ***/
         if (IS_FLG(FLG_MORE_THAN))
         {
                 if (o_ptr->dd * o_ptr->ds < entry->dice)
@@ -2305,6 +2305,48 @@ void init_autopicker(void)
 }
 
 
+
+/*
+ *  Process line for auto picker/destroyer.
+ */
+errr process_pickpref_file_line(char *buf)
+{
+       autopick_type entry;
+       int i;
+
+       if (max_autopick == MAX_AUTOPICK)
+               return 1;
+       
+       /* Nuke illegal char */
+       for(i = 0; buf[i]; i++)
+       {
+#ifdef JP
+               if (iskanji(buf[i]))
+               {
+                       i++;
+                       continue;
+               }
+#endif
+               if (isspace(buf[i]) && buf[i] != ' ')
+                       break;
+       }
+       buf[i] = 0;
+       
+       if (!autopick_new_entry(&entry, buf)) return 0;
+
+       /* Already has the same entry? */ 
+       for(i = 0; i < max_autopick; i++)
+               if(!strcmp(entry.name, autopick_list[i].name)
+                  && entry.flag[0] == autopick_list[i].flag[0]
+                  && entry.flag[1] == autopick_list[i].flag[1]
+                   && entry.dice == autopick_list[i].dice
+                   && entry.bonus == autopick_list[i].bonus) return 0;
+
+       autopick_list[max_autopick++] = entry;
+       return 0;
+}
+
+
 /*
  * Get a trigger key and insert ASCII string for the trigger
  */
index 987a382..37ff10b 100644 (file)
@@ -1040,46 +1040,6 @@ static cptr process_pref_file_expr(char **sp, char *fp)
 
 
 /*
- *  Process line for auto picker/destroyer.
- */
-static errr process_pickpref_file_line(char *buf)
-{
-       autopick_type entry;
-       int i;
-
-       if (max_autopick == MAX_AUTOPICK)
-               return 1;
-       
-       /* Nuke illegal char */
-       for(i = 0; buf[i]; i++)
-       {
-#ifdef JP
-               if (iskanji(buf[i]))
-               {
-                       i++;
-                       continue;
-               }
-#endif
-               if (isspace(buf[i]) && buf[i] != ' ')
-                       break;
-       }
-       buf[i] = 0;
-       
-       if (!autopick_new_entry(&entry, buf)) return 0;
-
-       /* Already has the same entry? */ 
-       for(i = 0; i < max_autopick; i++)
-               if(!strcmp(entry.name, autopick_list[i].name)
-                  && entry.flag[0] == autopick_list[i].flag[0]
-                  && entry.flag[1] == autopick_list[i].flag[1]) return 0;
-
-       autopick_list[max_autopick++] = entry;
-       return 0;
-}
-
-
-
-/*
  * Open the "user pref file" and parse it.
  */
 static errr process_pref_file_aux(cptr name, bool read_pickpref)