OSDN Git Service

Changed Japanese translation for "New" to match what was suggested in hengbandforosx...
[hengbandforosx/hengbandosx.git] / src / autopick.c
index 6b21e8b..c58dfad 100644 (file)
@@ -14,6 +14,7 @@
 #include "angband.h"
 #include "store.h"
 #include "player-status.h"
+#include "player-move.h"
 #include "object-hook.h"
 
 #define MAX_LINELEN 1024
@@ -136,7 +137,7 @@ static GAME_TEXT KEY_COLLECTING[] = "collecting";
 static GAME_TEXT KEY_ARTIFACT[] = "artifact";
 static GAME_TEXT KEY_EGO[] = "ego";
 static GAME_TEXT KEY_GOOD[] = "good";
-static GAME_TEXT KEY_nameLESS[] = "nameless";
+static GAME_TEXT KEY_NAMELESS[] = "nameless";
 static GAME_TEXT KEY_AVERAGE[] = "average";
 static GAME_TEXT KEY_WORTHLESS[] = "worthless";
 static GAME_TEXT KEY_RARE[] = "rare";
@@ -1709,9 +1710,7 @@ void autopick_pickup_items(grid_type *g_ptr)
        {
                int idx;
                        object_type *o_ptr = &current_floor_ptr->o_list[this_o_idx];
-               
-               /* Acquire next object */
-               next_o_idx = o_ptr->next_o_idx;
+                               next_o_idx = o_ptr->next_o_idx;
 
                idx = is_autopick(o_ptr);
 
@@ -1902,6 +1901,7 @@ bool autopick_autoregister(object_type *o_ptr)
        char pref_file[1024];
        FILE *pref_fff;
        autopick_type an_entry, *entry = &an_entry;
+       concptr tmp;
 
        int match_autopick = is_autopick(o_ptr);
 
@@ -1954,28 +1954,38 @@ bool autopick_autoregister(object_type *o_ptr)
        }
 
        /* Check the header */
-       while (TRUE)
-       {
-               /* Read a line */
-               if (my_fgets(pref_fff, buf, sizeof(buf)))
+       if (pref_fff) {
+               while (TRUE)
                {
-                       /* No header found */
-                       p_ptr->autopick_autoregister = FALSE;
+                       /* Read a line */
+                       if (my_fgets(pref_fff, buf, sizeof(buf)))
+                       {
+                               /* No header found */
+                               p_ptr->autopick_autoregister = FALSE;
 
-                       break;
-               }
+                               break;
+                       }
 
-               if (streq(buf, autoregister_header))
-               {
-                       /* Found the header */
-                       p_ptr->autopick_autoregister = TRUE;
+                       if (streq(buf, autoregister_header))
+                       {
+                               /* Found the header */
+                               p_ptr->autopick_autoregister = TRUE;
 
-                       break;
+                               break;
+                       }
                }
-       }
 
-       /* Close read only FILE* */
-       fclose(pref_fff);
+               /* Close read only FILE* */
+               fclose(pref_fff);
+       }
+       else
+       {
+               /*
+                * File could not be opened for reading.  Assume header not
+                * present.
+                */
+               p_ptr->autopick_autoregister = FALSE;
+       }
 
        /* Open for append */
        pref_fff = my_fopen(pref_file, "a");
@@ -1995,7 +2005,7 @@ bool autopick_autoregister(object_type *o_ptr)
                fprintf(pref_fff, "%s\n", autoregister_header);
 
                fprintf(pref_fff, "%s\n", _("# *警告!!* 以降の行は自動登録されたものです。",
-                                                           "# *Waring!* The lines below will be deleated later."));
+                                                           "# *Warning!* The lines below will be deleted later."));
                fprintf(pref_fff, "%s\n", _("# 後で自動的に削除されますので、必要な行は上の方へ移動しておいてください。", 
                                                            "# Keep it by cut & paste if you need these lines for future characters."));
 
@@ -2014,7 +2024,9 @@ bool autopick_autoregister(object_type *o_ptr)
 
        /* Add a line to the file */
        /* Don't kill "entry" */
-       fprintf(pref_fff, "%s\n", autopick_line_from_entry(entry));
+       tmp = autopick_line_from_entry(entry);
+       fprintf(pref_fff, "%s\n", tmp);
+       string_free(tmp);
        fclose(pref_fff);
 
        return TRUE;
@@ -2422,7 +2434,7 @@ static void describe_autopick(char *buff, autopick_type *entry)
        {
                before_str[before_n++] = "very rare";
                body_str = "equipments";
-               after_str[after_n++] = "such like Dragon armors, Blades of Chaos, etc.";
+               after_str[after_n++] = "such as Dragon armor, Blades of Chaos, etc.";
        }
 
        /*** Common equipments ***/
@@ -2430,7 +2442,7 @@ static void describe_autopick(char *buff, autopick_type *entry)
        {
                before_str[before_n++] = "relatively common";
                body_str = "equipments";
-               after_str[after_n++] = "compared to very rare Dragon armors, Blades of Chaos, etc.";
+               after_str[after_n++] = "compared to very rare Dragon armor, Blades of Chaos, etc.";
        }
 
        /*** Worthless items ***/
@@ -2586,7 +2598,7 @@ static void describe_autopick(char *buff, autopick_type *entry)
        else if (IS_FLG(FLG_MISSILES))
                body_str = "shots, arrows or crossbow bolts";
        else if (IS_FLG(FLG_DEVICES))
-               body_str = "scrolls, wands, staves or rods";
+               body_str = "scrolls, wands, staffs or rods";
        else if (IS_FLG(FLG_LIGHTS))
                body_str = "light sources";
        else if (IS_FLG(FLG_JUNKS))
@@ -2623,7 +2635,7 @@ static void describe_autopick(char *buff, autopick_type *entry)
                {
                        str++;
                        top = TRUE;
-                       whose_str[whose_n++] = "name is beginning with \"";
+                       whose_str[whose_n++] = "name begins with \"";
                }
                else
                        which_str[which_n++] = "have \"";
@@ -3962,8 +3974,8 @@ static GAME_TEXT MN_CL_QUERY[] = "';' (Query to pick up)";
 static GAME_TEXT MN_CL_NO_DISP[] = "'(' (No display on the large map)";
 
 static GAME_TEXT MN_ADJECTIVE_GEN[] = "Adjective (general)";
-static GAME_TEXT MN_RARE[] = "rare (equipments)";
-static GAME_TEXT MN_COMMON[] = "common (equipments)";
+static GAME_TEXT MN_RARE[] = "rare (equipment)";
+static GAME_TEXT MN_COMMON[] = "common (equipment)";
 
 static GAME_TEXT MN_ADJECTIVE_SPECIAL[] = "Adjective (special)";
 static GAME_TEXT MN_BOOSTED[] = "dice boosted (weapons)";
@@ -6006,7 +6018,7 @@ void do_cmd_edit_autopick(void)
                old_autosave_turn = current_world_ptr->game_turn;
        }
 
-       /* HACK -- Reset start_time to stop counting playtime while edit */
+       /* HACK -- Reset start_time to stop counting current_world_ptr->play_time while edit */
        update_playtime();
 
        /* Free old entries */
@@ -6132,7 +6144,7 @@ void do_cmd_edit_autopick(void)
        /* Reload autopick pref */
        process_autopick_file(buf);
 
-       /* HACK -- reset start_time so that playtime is not increase while edit */
+       /* HACK -- reset start_time so that current_world_ptr->play_time is not increase while edit */
        start_time = (u32b)time(NULL);
 
        /* Save cursor location */