OSDN Git Service

'~'の自動拾いリストからも使用している autopick_line_from_entry() の仕様を
[hengbandforosx/hengbandosx.git] / src / autopick.c
index e588f3b..14b8b5e 100644 (file)
@@ -230,9 +230,10 @@ cptr autopick_line_from_entry(autopick_type *entry)
        if (IS_FLG(FLG_HUMAN)) ADD_KEY(KEY_HUMAN);
        if (IS_FLG(FLG_WORTHLESS)) ADD_KEY(KEY_WORTHLESS);
        if (IS_FLG(FLG_NAMELESS)) ADD_KEY(KEY_NAMELESS);
-       if (IS_FLG(FLG_ARTIFACT)) ADD_KEY(KEY_ARTIFACT);
        if (IS_FLG(FLG_EGO)) ADD_KEY(KEY_EGO);
 
+       if (IS_FLG(FLG_ARTIFACT)) ADD_KEY(KEY_ARTIFACT);
+
        if (IS_FLG(FLG_ITEMS)) ADD_KEY2(KEY_ITEMS);
        else if (IS_FLG(FLG_WEAPONS)) ADD_KEY2(KEY_WEAPONS);
        else if (IS_FLG(FLG_ARMORS)) ADD_KEY2(KEY_ARMORS);
@@ -251,7 +252,10 @@ cptr autopick_line_from_entry(autopick_type *entry)
        else if (IS_FLG(FLG_HELMS)) ADD_KEY2(KEY_HELMS);
        else if (IS_FLG(FLG_GLOVES)) ADD_KEY2(KEY_GLOVES);
        else if (IS_FLG(FLG_BOOTS)) ADD_KEY2(KEY_BOOTS);
-       else
+
+        /* You don't need sepalator after adjective */
+        /* 'artifact' is not true adjective */
+       else if (!IS_FLG(FLG_ARTIFACT))
                sepa_flag = FALSE;
 
        if (entry->name && entry->name[0])
@@ -294,12 +298,24 @@ cptr autopick_line_from_entry(autopick_type *entry)
                 buf[i] = '\0';
        }
 
+       return string_make(buf);
+}
+
+
+/*
+ * Reconstruct preference line from entry and kill entry
+ */
+static cptr autopick_line_from_entry_kill(autopick_type *entry)
+{
+        cptr ptr = autopick_line_from_entry(entry);
+
         /* Free memory for original entry */
         autopick_free_entry(entry);
 
-       return string_make(buf);
+        return ptr;
 }
 
+
 /*
  * A function to create new entry
  */
@@ -1314,7 +1330,7 @@ static void describe_autopick(char *buff, autopick_type *entry)
        else if (IS_FLG(FLG_HELMS))
                body_str = "¥Ø¥ë¥á¥Ã¥È¤ä´§";
        else if (IS_FLG(FLG_GLOVES))
-               body_str = "¾®¼ê";
+               body_str = "äƼê";
        else if (IS_FLG(FLG_BOOTS))
                body_str = "¥Ö¡¼¥Ä";
 
@@ -1343,7 +1359,20 @@ static void describe_autopick(char *buff, autopick_type *entry)
        }
 
        if (insc)
-               strncat(buff, format("¤Ë¡Ö%s¡×¤È¹ï¤ó¤Ç", insc), 80);
+        {
+               strncat(buff, format("¤Ë¡Ö%s¡×", insc), 80);
+
+                if (strstr(insc, "%%all"))
+                        strcat(buff, "(%%all¤ÏÁ´Ç½ÎϤòɽ¤¹±Ñ»ú¤Îµ­¹æ¤ÇÃÖ´¹)");
+                else if (strstr(insc, "%all"))
+                        strcat(buff, "(%all¤ÏÁ´Ç½ÎϤòɽ¤¹µ­¹æ¤ÇÃÖ´¹)");
+                else if (strstr(insc, "%%"))
+                        strcat(buff, "(%%¤ÏÄɲÃǽÎϤòɽ¤¹±Ñ»ú¤Îµ­¹æ¤ÇÃÖ´¹)");
+                else if (strstr(insc, "%"))
+                        strcat(buff, "(%¤ÏÄɲÃǽÎϤòɽ¤¹µ­¹æ¤ÇÃÖ´¹)");
+
+               strcat(buff, "¤È¹ï¤ó¤Ç");
+        }
        else
                strcat(buff, "¤ò");
 
@@ -1586,7 +1615,16 @@ static void describe_autopick(char *buff, autopick_type *entry)
 
        /* Auto-insctiption */
        if (insc)
-               strncat(buff, format("and inscribe \"%s\" on ", insc), 80);
+        {
+               strncat(buff, format("and inscribe \"%s\"", insc), 80);
+
+                if (strstr(insc, "%all"))
+                        strcat(buff, ", replacing %all with code string representing all abilities,");
+                else if (strstr(insc, "%"))
+                        strcat(buff, ", replacing % with code string representing extra random abilities,");
+
+               strcat(buff, " on ");
+        }
 
        /* Adjective */
        if (!before_n) 
@@ -1652,11 +1690,11 @@ static void describe_autopick(char *buff, autopick_type *entry)
        if (act & DO_DISPLAY)
        {
                if (act & DONT_AUTOPICK)
-                       strcat(buff, "  Display these items when you press 'N' in the full map('M').");
+                       strcat(buff, "  Display these items when you press the N key in the full 'M'ap.");
                else if (act & DO_AUTODESTROY)
-                       strcat(buff, "  Display these items when you press 'K' in the full map('M').");
+                       strcat(buff, "  Display these items when you press the K key in the full 'M'ap.");
                else
-                       strcat(buff, "  Display these items when you press 'M' in the full map('M').");
+                       strcat(buff, "  Display these items when you press the M key in the full 'M'ap.");
        }
        else
                strcat(buff, " Not displayed in the full map.");
@@ -1820,7 +1858,7 @@ static void toggle_string(cptr *lines_list, int flg, int y)
        else
                ADD_FLG(flg);
 
-       lines_list[y] = autopick_line_from_entry(entry);
+       lines_list[y] = autopick_line_from_entry_kill(entry);
 }
 
 /*
@@ -2449,7 +2487,7 @@ void do_cmd_edit_autopick(void)
 
         object_type *search_o_ptr = NULL;
         cptr search_str = NULL;
-        cptr last_destroyed;
+        cptr last_destroyed = NULL;
        char last_destroyed_command[WID_DESC+3];
        char yank_buf[MAX_YANK];
        char classrace[80];
@@ -2475,14 +2513,16 @@ void do_cmd_edit_autopick(void)
        init_autopicker();
 
        /* Name of the Last Destroyed Item */
-       autopick_entry_from_object(entry, &autopick_last_destroyed_object);
-       last_destroyed = autopick_line_from_entry(entry);
+        if (autopick_last_destroyed_object.k_idx)
+        {
+                autopick_entry_from_object(entry, &autopick_last_destroyed_object);
+                last_destroyed = autopick_line_from_entry_kill(entry);
+        }
 
        /* Command Description of the Last Destroyed Item */
        if (last_destroyed)
        {
-               strcpy(last_destroyed_command, "^L \"");
-               strncpy(last_destroyed_command + 4, last_destroyed, WID_DESC-4);
+               strncpy(last_destroyed_command, format("^L \"%s\"", last_destroyed), WID_DESC+2);
                last_destroyed_command[WID_DESC+2] = '\0';
        }
        else
@@ -2863,7 +2903,7 @@ void do_cmd_edit_autopick(void)
                                        entry->action |= DO_AUTOPICK;
                                }
 
-                               lines_list[cy] = autopick_line_from_entry(entry);
+                               lines_list[cy] = autopick_line_from_entry_kill(entry);
 
                                /* Now dirty */
                                dirty_line = cy;
@@ -2904,7 +2944,7 @@ void do_cmd_edit_autopick(void)
                                        entry->action |= DO_AUTOPICK;
                                }
 
-                               lines_list[cy] = autopick_line_from_entry(entry);
+                               lines_list[cy] = autopick_line_from_entry_kill(entry);
 
                                /* Now dirty */
                                dirty_line = cy;
@@ -2939,7 +2979,7 @@ void do_cmd_edit_autopick(void)
                                 else
                                         entry->action &= ~DO_DISPLAY;
 
-                                lines_list[cy] = autopick_line_from_entry(entry);
+                                lines_list[cy] = autopick_line_from_entry_kill(entry);
 
                                 /* Now dirty */
                                 dirty_line = cy;
@@ -3132,7 +3172,7 @@ void do_cmd_edit_autopick(void)
                                if (cx > 0) cx--;
                        }
 
-                       lines_list[cy] = autopick_line_from_entry(entry);
+                       lines_list[cy] = autopick_line_from_entry_kill(entry);
 
                        /* Now dirty */
                        dirty_line = cy;
@@ -3145,7 +3185,7 @@ void do_cmd_edit_autopick(void)
                                dirty_flags |= DIRTY_SCREEN;
                                break;
                        }
-                       tmp = autopick_line_from_entry(entry);
+                       tmp = autopick_line_from_entry_kill(entry);
 
                        if (tmp)
                        {
@@ -3190,7 +3230,7 @@ void do_cmd_edit_autopick(void)
 
                        if (!entry->insc) entry->insc = string_make("");
 
-                       lines_list[cy] = autopick_line_from_entry(entry);
+                       lines_list[cy] = autopick_line_from_entry_kill(entry);
 
                        /* Move to collumn for auto inscription */
                        for (cx = 0; lines_list[cy][cx]; cx++)
@@ -3250,7 +3290,7 @@ void do_cmd_edit_autopick(void)
                                entry->action |= DO_AUTOPICK;
                        }
 
-                       lines_list[cy] = autopick_line_from_entry(entry);
+                       lines_list[cy] = autopick_line_from_entry_kill(entry);
 
                        /* Now dirty */
                        dirty_line = cy;
@@ -3301,7 +3341,7 @@ void do_cmd_edit_autopick(void)
                                REM_FLG(FLG_STAR_IDENTIFIED);
                        }
 
-                       lines_list[cy] = autopick_line_from_entry(entry);
+                       lines_list[cy] = autopick_line_from_entry_kill(entry);
 
                        /* Now dirty */
                        dirty_line = cy;
@@ -3349,7 +3389,7 @@ void do_cmd_edit_autopick(void)
                                REM_FLG(FLG_ARTIFACT);
                        }
 
-                       lines_list[cy] = autopick_line_from_entry(entry);
+                       lines_list[cy] = autopick_line_from_entry_kill(entry);
 
                        /* Now dirty */
                        dirty_line = cy;