OSDN Git Service

./bootstrap 実行時に warning が出ないよう修正。
[hengband/hengband.git] / src / files.c
index 5a21023..01b871e 100644 (file)
@@ -811,17 +811,18 @@ errr process_pref_file_command(char *buf)
  * Output:
  *   result
  */
-cptr process_pref_file_expr(cptr *sp, char *fp)
+cptr process_pref_file_expr(char **sp, char *fp)
 {
        cptr v;
 
-       cptr s;
+       char *b;
+       char *s;
 
        char b1 = '[';
        char b2 = ']';
 
        char f = ' ';
-       static char tmp[8];
+       static char tmp[10];
 
        /* Initial */
        s = (*sp);
@@ -829,6 +830,9 @@ cptr process_pref_file_expr(cptr *sp, char *fp)
        /* Skip spaces */
        while (isspace(*s)) s++;
 
+       /* Save start */
+       b = s;
+
        /* Default */
        v = "?o?o?";
 
@@ -945,24 +949,25 @@ cptr process_pref_file_expr(cptr *sp, char *fp)
                if (f != b2) v = "?x?x?";
 
                /* Extract final and Terminate */
-               if ((f = *s) != '\0') s++;
+               if ((f = *s) != '\0') *s++ = '\0';
        }
 
        /* Other */
        else
        {
-               char b[1024];
-               int i;
-
                /* Accept all printables except spaces and brackets */
-               for (i = 0; isprint(*s) && !my_strchr(" []", *s); i++)
-                       b[i] = *s++;
-
-               /* Terminate */
-               b[i] = '\0';
+#ifdef JP
+               while (iskanji(*s) || (isprint(*s) && !my_strchr(" []", *s)))
+               {
+                       if (iskanji(*s)) s++;
+                       s++;
+               }
+#else
+               while (isprint(*s) && !my_strchr(" []", *s)) ++s;
+#endif
 
                /* Extract final and Terminate */
-               if ((f = *s) != '\0') s++;
+               if ((f = *s) != '\0') *s++ = '\0';
 
                /* Variable */
                if (*b == '$')
@@ -1016,7 +1021,22 @@ cptr process_pref_file_expr(cptr *sp, char *fp)
                        /* Player */
                        else if (streq(b+1, "PLAYER"))
                        {
-                               v = player_base;
+                               static char tmp_player_name[32];
+                               char *pn, *tpn;
+                               for (pn = player_name, tpn = tmp_player_name; *pn; pn++, tpn++)
+                               {
+#ifdef JP
+                                       if (iskanji(*pn))
+                                       {
+                                               *(tpn++) = *(pn++);
+                                               *tpn = *pn;
+                                               continue;
+                                       }
+#endif
+                                       *tpn = my_strchr(" []", *pn) ? '_' : *pn;
+                               }
+                               *tpn = '\0';
+                               v = tmp_player_name;
                        }
 
                        /* First realm */
@@ -1054,6 +1074,13 @@ cptr process_pref_file_expr(cptr *sp, char *fp)
                                else
                                        v = "0";
                        }
+
+                       /* Money */
+                       else if (streq(b+1, "MONEY"))
+                       {
+                               sprintf(tmp, "%09d", p_ptr->au);
+                               v = tmp;
+                       }
                }
 
                /* Constant */
@@ -1130,7 +1157,7 @@ static errr process_pref_file_aux(cptr name, int preftype)
                {
                        char f;
                        cptr v;
-                       cptr s;
+                       char *s;
 
                        /* Start */
                        s = buf + 2;
@@ -1897,13 +1924,13 @@ static void display_player_middle(void)
                int day, hour, min;
                extract_day_hour_min(&day, &hour, &min);
 
-               sprintf(buf, 
 #ifdef JP
-                       "%dÆüÌÜ %2d:%02d", 
+               if (day < MAX_DAYS) sprintf(buf, "%dÆüÌÜ %2d:%02d", day, hour, min);
+               else sprintf(buf, "*****ÆüÌÜ %2d:%02d", hour, min);
 #else
-                       "Day %d %2d:%02d", 
+               if (day < MAX_DAYS) sprintf(buf, "Day %d %2d:%02d", day, hour, min);
+               else sprintf(buf, "Day ***** %2d:%02d", hour, min);
 #endif
-                       day, hour, min);
        }
        display_player_one_line(ENTRY_DAY, buf, TERM_L_GREEN);
 
@@ -2367,7 +2394,7 @@ static void player_flags(u32b flgs[TR_FLAG_SIZE])
                if (p_ptr->lev > 14)
                {
                        add_flag(flgs, TR_REGEN);
-                       if (p_ptr->pclass == CLASS_WARRIOR)
+                       if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
                        {
                                add_flag(flgs, TR_SLOW_DIGEST);
                                /*
@@ -2527,7 +2554,7 @@ static void player_flags(u32b flgs[TR_FLAG_SIZE])
        case RACE_S_FAIRY:
                add_flag(flgs, TR_LEVITATION);
                break;
-       case RACE_KUTA:
+       case RACE_KUTAR:
                add_flag(flgs, TR_RES_CONF);
                break;
        case RACE_ANDROID:
@@ -2759,6 +2786,18 @@ static void tim_player_flags(u32b flgs[TR_FLAG_SIZE])
                add_flag(flgs, TR_SUST_CON);
                add_flag(flgs, TR_SUST_CHR);
        }
+
+       /* Hex bonuses */
+       if (p_ptr->realm1 == REALM_HEX)
+       {
+               if (hex_spelling(HEX_DEMON_AURA))
+               {
+                       add_flag(flgs, TR_SH_FIRE);
+                       add_flag(flgs, TR_REGEN);
+               }
+               if (hex_spelling(HEX_ICE_ARMOR)) add_flag(flgs, TR_SH_COLD);
+               if (hex_spelling(HEX_SHOCK_CLOAK)) add_flag(flgs, TR_SH_ELEC);
+       }
 }
 
 
@@ -4103,6 +4142,7 @@ static void dump_aux_pet(FILE *fff)
 {
        int i;
        bool pet = FALSE;
+       bool pet_settings = FALSE;
        char pet_name[80];
 
        for (i = m_max - 1; i >= 1; i--)
@@ -4111,13 +4151,14 @@ static void dump_aux_pet(FILE *fff)
 
                if (!m_ptr->r_idx) continue;
                if (!is_pet(m_ptr)) continue;
+               pet_settings = TRUE;
                if (!m_ptr->nickname && (p_ptr->riding != i)) continue;
                if (!pet)
                {
 #ifdef JP
-                       fprintf(fff, "\n  [¼ç¤Ê¥Ú¥Ã¥È]\n\n");
+                       fprintf(fff, "\n\n  [¼ç¤Ê¥Ú¥Ã¥È]\n\n");
 #else
-                       fprintf(fff, "\n  [leading pets]\n\n");
+                       fprintf(fff, "\n\n  [Leading Pets]\n\n");
 #endif
                        pet = TRUE;
                }
@@ -4125,7 +4166,52 @@ static void dump_aux_pet(FILE *fff)
                fprintf(fff, "%s\n", pet_name);
        }
 
-       if (pet) fprintf(fff, "\n");
+       if (pet_settings)
+       {
+#ifdef JP
+               fprintf(fff, "\n\n  [¥Ú¥Ã¥È¤Ø¤ÎÌ¿Îá]\n");
+#else
+               fprintf(fff, "\n\n  [Command for Pets]\n");
+#endif
+
+#ifdef JP
+               fprintf(fff, "\n ¥É¥¢¤ò³«¤±¤ë:                       %s", (p_ptr->pet_extra_flags & PF_OPEN_DOORS) ? "ON" : "OFF");
+#else
+               fprintf(fff, "\n Pets open doors:                    %s", (p_ptr->pet_extra_flags & PF_OPEN_DOORS) ? "ON" : "OFF");
+#endif
+
+#ifdef JP
+               fprintf(fff, "\n ¥¢¥¤¥Æ¥à¤ò½¦¤¦:                     %s", (p_ptr->pet_extra_flags & PF_PICKUP_ITEMS) ? "ON" : "OFF");
+#else
+               fprintf(fff, "\n Pets pick up items:                 %s", (p_ptr->pet_extra_flags & PF_PICKUP_ITEMS) ? "ON" : "OFF");
+#endif
+
+#ifdef JP
+               fprintf(fff, "\n ¥Æ¥ì¥Ý¡¼¥È·ÏËâË¡¤ò»È¤¦:             %s", (p_ptr->pet_extra_flags & PF_TELEPORT) ? "ON" : "OFF");
+#else
+               fprintf(fff, "\n Allow teleport:                     %s", (p_ptr->pet_extra_flags & PF_TELEPORT) ? "ON" : "OFF");
+#endif
+
+#ifdef JP
+               fprintf(fff, "\n ¹¶·âËâË¡¤ò»È¤¦:                     %s", (p_ptr->pet_extra_flags & PF_ATTACK_SPELL) ? "ON" : "OFF");
+#else
+               fprintf(fff, "\n Allow cast attack spell:            %s", (p_ptr->pet_extra_flags & PF_ATTACK_SPELL) ? "ON" : "OFF");
+#endif
+
+#ifdef JP
+               fprintf(fff, "\n ¾¤´­ËâË¡¤ò»È¤¦:                     %s", (p_ptr->pet_extra_flags & PF_SUMMON_SPELL) ? "ON" : "OFF");
+#else
+               fprintf(fff, "\n Allow cast summon spell:            %s", (p_ptr->pet_extra_flags & PF_SUMMON_SPELL) ? "ON" : "OFF");
+#endif
+
+#ifdef JP
+               fprintf(fff, "\n ¥×¥ì¥¤¥ä¡¼¤ò´¬¤­¹þ¤àÈÏ°ÏËâË¡¤ò»È¤¦: %s", (p_ptr->pet_extra_flags & PF_BALL_SPELL) ? "ON" : "OFF");
+#else
+               fprintf(fff, "\n Allow involve player in area spell: %s", (p_ptr->pet_extra_flags & PF_BALL_SPELL) ? "ON" : "OFF");
+#endif
+
+               fputc('\n', fff);
+       }
 }
 
 
@@ -4150,9 +4236,9 @@ static void dump_aux_class_special(FILE *fff)
                for (i=0;i<60;i++) { p[i][0] = '\0'; }
 
 #ifdef JP
-               strcat(p[col], "\n  [³Ø½¬ºÑ¤ß¤ÎÀÄËâË¡]\n");
+               strcat(p[col], "\n\n  [³Ø½¬ºÑ¤ß¤ÎÀÄËâË¡]\n");
 #else
-               strcat(p[col], "\n  [Learned blue magic]\n");
+               strcat(p[col], "\n\n  [Learned Blue Magic]\n");
 #endif
 
 
@@ -4166,7 +4252,7 @@ static void dump_aux_class_special(FILE *fff)
 #ifdef JP
                                        strcat(p[col], "\n     [¥Ü¥ë¥È·¿]\n");
 #else
-                                       strcat(p[col], "\n     [Bolt  type]\n");
+                                       strcat(p[col], "\n     [Bolt  Type]\n");
 #endif
                                        break;
 
@@ -4174,7 +4260,7 @@ static void dump_aux_class_special(FILE *fff)
 #ifdef JP
                                        strcat(p[col], "\n     [¥Ü¡¼¥ë·¿]\n");
 #else
-                                       strcat(p[col], "\n     [Ball  type]\n");
+                                       strcat(p[col], "\n     [Ball  Type]\n");
 #endif
                                        break;
 
@@ -4198,7 +4284,7 @@ static void dump_aux_class_special(FILE *fff)
 #ifdef JP
                                        strcat(p[col], "\n     [ ¤½¤Î¾ ]\n");
 #else
-                                       strcat(p[col], "\n     [Other type]\n");
+                                       strcat(p[col], "\n     [Other Type]\n");
 #endif
                                        break;
                        }
@@ -4267,6 +4353,87 @@ static void dump_aux_class_special(FILE *fff)
                        fprintf(fff, p[i]);
                }
        }
+       else if (p_ptr->pclass == CLASS_MAGIC_EATER)
+       {
+               char s[EATER_EXT][MAX_NLEN];
+               int tval, ext, k_idx;
+               int i, magic_num;
+
+#ifdef JP
+               fprintf(fff, "\n\n  [¼è¤ê¹þ¤ó¤ÀËâË¡Æ»¶ñ]\n");
+#else
+               fprintf(fff, "\n\n  [Magic devices eaten]\n");
+#endif
+
+               for (ext = 0; ext < 3; ext++)
+               {
+                       int eat_num = 0;
+
+                       /* Dump an extent name */
+                       switch (ext)
+                       {
+                       case 0:
+                               tval = TV_STAFF;
+#ifdef JP
+                               fprintf(fff, "\n[¾ó]\n");
+#else
+                               fprintf(fff, "\n[Staffs]\n");
+#endif
+                               break;
+                       case 1:
+                               tval = TV_WAND;
+#ifdef JP
+                               fprintf(fff, "\n[ËâË¡ËÀ]\n");
+#else
+                               fprintf(fff, "\n[Wands]\n");
+#endif
+                               break;
+                       case 2:
+                               tval = TV_ROD;
+#ifdef JP
+                               fprintf(fff, "\n[¥í¥Ã¥É]\n");
+#else
+                               fprintf(fff, "\n[Rods]\n");
+#endif
+                               break;
+                       }
+
+                       /* Get magic device names that were eaten */
+                       for (i = 0; i < EATER_EXT; i++)
+                       {
+                               int idx = EATER_EXT * ext + i;
+
+                               magic_num = p_ptr->magic_num2[idx];
+                               if (!magic_num) continue;
+
+                               k_idx = lookup_kind(tval, i);
+                               if (!k_idx) continue;
+                               sprintf(s[eat_num], "%23s (%2d)", (k_name + k_info[k_idx].name), magic_num);
+                               eat_num++;
+                       }
+
+                       /* Dump magic devices in this extent */
+                       if (eat_num > 0)
+                       {
+                               for (i = 0; i < eat_num; i++)
+                               {
+                                       fputs(s[i], fff);
+                                       if (i % 3 < 2) fputs("    ", fff);
+                                       else fputs("\n", fff);
+                               }
+
+                               if (i % 3 > 0) fputs("\n", fff);
+                       }
+                       else /* Not found */
+                       {
+#ifdef JP
+                               fputs("  (¤Ê¤·)\n", fff);
+#else
+                               fputs("  (none)\n", fff);
+#endif
+                       }
+               }
+       }
 }
 
 
@@ -4283,7 +4450,7 @@ static void dump_aux_quest(FILE *fff)
 #ifdef JP
        fprintf(fff, "\n\n  [¥¯¥¨¥¹¥È¾ðÊó]\n");
 #else
-       fprintf(fff, "\n\n  [Quest information]\n");
+       fprintf(fff, "\n\n  [Quest Information]\n");
 #endif
 
        /* Allocate Memory */
@@ -4300,6 +4467,7 @@ static void dump_aux_quest(FILE *fff)
        do_cmd_knowledge_quests_completed(fff, quest_num);
        fputc('\n', fff);
        do_cmd_knowledge_quests_failed(fff, quest_num);
+       fputc('\n', fff);
 
        /* Free Memory */
        C_KILL(quest_num, max_quests, int);
@@ -4320,13 +4488,13 @@ static void dump_aux_last_message(FILE *fff)
 #ifdef JP
                        fprintf(fff, "\n  [»à¤ÌľÁ°¤Î¥á¥Ã¥»¡¼¥¸]\n\n");
 #else
-                       fprintf(fff, "\n  [Last messages]\n\n");
+                       fprintf(fff, "\n  [Last Messages]\n\n");
 #endif
                        for (i = MIN(message_num(), 30); i >= 0; i--)
                        {
                                fprintf(fff,"> %s\n",message_str((s16b)i));
                        }
-                       fprintf(fff, "\n");
+                       fputc('\n', fff);
                }
 
                /* Hack -- *Winning* message */
@@ -4335,9 +4503,10 @@ static void dump_aux_last_message(FILE *fff)
 #ifdef JP
                        fprintf(fff, "\n  [*¾¡Íø*¥á¥Ã¥»¡¼¥¸]\n\n");
 #else
-                       fprintf(fff, "\n  [*Winning* message]\n\n");
+                       fprintf(fff, "\n  [*Winning* Message]\n\n");
 #endif
                        fprintf(fff,"  %s\n", p_ptr->last_message);
+                       fputc('\n', fff);
                }
        }
 }
@@ -4351,9 +4520,9 @@ static void dump_aux_recall(FILE *fff)
        int y;
 
 #ifdef JP
-       fprintf(fff, "\n\n  [µ¢´Ô¾ì½ê]\n\n");
+       fprintf(fff, "\n  [µ¢´Ô¾ì½ê]\n\n");
 #else
-       fprintf(fff, "\n\n  [Recall Depth]\n\n");
+       fprintf(fff, "\n  [Recall Depth]\n\n");
 #endif
 
        for (y = 1; y < max_d_idx; y++)
@@ -4385,7 +4554,7 @@ static void dump_aux_options(FILE *fff)
 #ifdef JP
        fprintf(fff, "\n  [¥ª¥×¥·¥ç¥óÀßÄê]\n");
 #else
-       fprintf(fff, "\n  [Option settings]\n");
+       fprintf(fff, "\n  [Option Settings]\n");
 #endif
 
 
@@ -4502,16 +4671,16 @@ static void dump_aux_options(FILE *fff)
 #endif
 
 
-       fprintf(fff,"\n");
+       fputc('\n', fff);
 
        if (p_ptr->noscore)
 #ifdef JP
-               fprintf(fff, "\n ²¿¤«ÉÔÀµ¤Ê¤³¤È¤ò¤·¤Æ¤·¤Þ¤Ã¤Æ¤¤¤Þ¤¹¡£");
+               fprintf(fff, "\n ²¿¤«ÉÔÀµ¤Ê¤³¤È¤ò¤·¤Æ¤·¤Þ¤Ã¤Æ¤¤¤Þ¤¹¡£\n");
 #else
-               fprintf(fff, "\n You have done something illegal.");
+               fprintf(fff, "\n You have done something illegal.\n");
 #endif
 
-       fprintf(fff,"\n");
+       fputc('\n', fff);
 }
 
 
@@ -4591,7 +4760,7 @@ static void dump_aux_monsters(FILE *fff)
 #ifdef JP
        fprintf(fff, "\n  [Åݤ·¤¿¥â¥ó¥¹¥¿¡¼]\n\n");
 #else
-       fprintf(fff, "\n  [Defeated monsters]\n\n");
+       fprintf(fff, "\n  [Defeated Monsters]\n\n");
 #endif
 
        /* Allocate the "who" array */
@@ -4722,6 +4891,8 @@ static void dump_aux_race_history(FILE *fff)
                        fprintf(fff, "\n You were a %s before.", race_info[i].title);
 #endif
                }
+
+               fputc('\n', fff);
        }
 }
 
@@ -4735,6 +4906,7 @@ static void dump_aux_realm_history(FILE *fff)
        {
                int i;
 
+               fputc('\n', fff);
                for (i = 0; i < MAX_MAGIC; i++)
                {
                        if (!(p_ptr->old_realm & 1L << i)) continue;
@@ -4744,6 +4916,7 @@ static void dump_aux_realm_history(FILE *fff)
                        fprintf(fff, "\n You were able to use %s magic before.", realm_names[i+1]);
 #endif
                }
+               fputc('\n', fff);
        }
 }
 
@@ -4785,9 +4958,6 @@ static void dump_aux_mutations(FILE *fff)
 
                dump_mutations(fff);
        }
-
-       /* Skip some lines */
-       fprintf(fff, "\n\n");
 }
 
 
@@ -4954,6 +5124,7 @@ errr make_character_dump(FILE *fff)
        dump_aux_class_special(fff);
        dump_aux_mutations(fff);
        dump_aux_pet(fff);
+       fputs("\n\n", fff);
        dump_aux_equipment_inventory(fff);
        dump_aux_home_museum(fff);
 
@@ -5086,7 +5257,7 @@ static void show_file_aux_line(cptr str, int cy, cptr shower)
                /* Search for a shower string in the line */
                if (shower)
                {
-                       ptr = my_strstr(&lcstr[i], shower);
+                       ptr = my_strstr(&lcstr[i], shower);
                        if (ptr) showercol = ptr - &lcstr[i];
                }
 
@@ -5205,6 +5376,7 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
        /* Hold strings to find/show */
        char finder_str[81];
        char shower_str[81];
+       char back_str[81];
 
        /* String to show */
        cptr shower = NULL;
@@ -5555,9 +5727,10 @@ prt("[
                /* Get a special key code */
                skey = inkey_special(TRUE);
 
-               /* Show the help for the help */
-               if (skey == '?')
+               switch (skey)
                {
+               /* Show the help for the help */
+               case '?':
                        /* Hack - prevent silly recursion */
 #ifdef JP
                        if (strcmp(name, "jhelpinfo.txt") != 0)
@@ -5566,11 +5739,10 @@ prt("[
                        if (strcmp(name, "helpinfo.txt") != 0)
                                show_file(TRUE, "helpinfo.txt", NULL, 0, mode);
 #endif
-               }
+                       break;
 
                /* Hack -- try showing */
-               if (skey == '=')
-               {
+               case '=':
                        /* Get "shower" */
 #ifdef JP
                        prt("¶¯Ä´: ", hgt - 1, 0);
@@ -5578,18 +5750,25 @@ prt("[
                        prt("Show: ", hgt - 1, 0);
 #endif
 
-                       (void)askfor(shower_str, 80);
-
-                       /* Make it lowercase */
-                       str_tolower(shower_str);
+                       strcpy(back_str, shower_str);
+                       if (askfor(shower_str, 80))
+                       {
+                               if (shower_str[0])
+                               {
+                                       /* Make it lowercase */
+                                       str_tolower(shower_str);
 
-                       /* Show it */
-                       shower = shower_str;
-               }
+                                       /* Show it */
+                                       shower = shower_str;
+                               }
+                               else shower = NULL; /* Stop showing */
+                       }
+                       else strcpy(shower_str, back_str);
+                       break;
 
                /* Hack -- try finding */
-               if (skey == '/' || skey == KTRL('s'))
-               {
+               case '/':
+               case KTRL('s'):
                        /* Get "finder" */
 #ifdef JP
                        prt("¸¡º÷: ", hgt - 1, 0);
@@ -5597,113 +5776,113 @@ prt("[
                        prt("Find: ", hgt - 1, 0);
 #endif
 
-
+                       strcpy(back_str, finder_str);
                        if (askfor(finder_str, 80))
                        {
-                               /* Find it */
-                               find = finder_str;
-                               back = line;
-                               line = line + 1;
+                               if (finder_str[0])
+                               {
+                                       /* Find it */
+                                       find = finder_str;
+                                       back = line;
+                                       line = line + 1;
 
-                               /* Make finder lowercase */
-                               str_tolower(finder_str);
+                                       /* Make finder lowercase */
+                                       str_tolower(finder_str);
 
-                               /* Show it */
-                               shower = finder_str;
+                                       /* Show it */
+                                       shower = finder_str;
+                               }
+                               else shower = NULL; /* Stop showing */
                        }
-               }
+                       else strcpy(finder_str, back_str);
+                       break;
 
                /* Hack -- go to a specific line */
-               if (skey == '#')
-               {
-                       char tmp[81];
+               case '#':
+                       {
+                               char tmp[81];
 #ifdef JP
-prt("¹Ô: ", hgt - 1, 0);
+                               prt("¹Ô: ", hgt - 1, 0);
 #else
-                       prt("Goto Line: ", hgt - 1, 0);
+                               prt("Goto Line: ", hgt - 1, 0);
 #endif
 
-                       strcpy(tmp, "0");
+                               strcpy(tmp, "0");
 
-                       if (askfor(tmp, 80))
-                       {
-                               line = atoi(tmp);
+                               if (askfor(tmp, 80)) line = atoi(tmp);
                        }
-               }
+                       break;
 
                /* Hack -- go to the top line */
-               if (skey == SKEY_TOP)
-               {
+               case SKEY_TOP:
                        line = 0;
-               }
+                       break;
 
                /* Hack -- go to the bottom line */
-               if (skey == SKEY_BOTTOM)
-               {
-                       line = ((size-1)/rows)*rows;
-               }
+               case SKEY_BOTTOM:
+                       line = ((size - 1) / rows) * rows;
+                       break;
 
                /* Hack -- go to a specific file */
-               if (skey == '%')
-               {
-                       char tmp[81];
+               case '%':
+                       {
+                               char tmp[81];
 #ifdef JP
-prt("¥Õ¥¡¥¤¥ë¡¦¥Í¡¼¥à: ", hgt - 1, 0);
-strcpy(tmp, "jhelp.hlp");
+                               prt("¥Õ¥¡¥¤¥ë¡¦¥Í¡¼¥à: ", hgt - 1, 0);
+                               strcpy(tmp, "jhelp.hlp");
 #else
-                       prt("Goto File: ", hgt - 1, 0);
-                       strcpy(tmp, "help.hlp");
+                               prt("Goto File: ", hgt - 1, 0);
+                               strcpy(tmp, "help.hlp");
 #endif
 
-
-                       if (askfor(tmp, 80))
-                       {
-                               if (!show_file(TRUE, tmp, NULL, 0, mode)) skey = 'q';
+                               if (askfor(tmp, 80))
+                               {
+                                       if (!show_file(TRUE, tmp, NULL, 0, mode)) skey = 'q';
+                               }
                        }
-               }
+                       break;
 
                /* Allow backing up */
-               if (skey == '-')
-               {
+               case '-':
                        line = line + (reverse ? rows : -rows);
                        if (line < 0) line = 0;
-               }
+                       break;
 
                /* One page up */
-               if (skey == SKEY_PGUP)
-               {
+               case SKEY_PGUP:
                        line = line - rows;
                        if (line < 0) line = 0;
-               }
+                       break;
 
                /* Advance a single line */
-               if ((skey == '\n') || (skey == '\r'))
-               {
+               case '\n':
+               case '\r':
                        line = line + (reverse ? -1 : 1);
                        if (line < 0) line = 0;
-               }
-
+                       break;
 
                /* Move up / down */
-               if (skey == '8' || skey == SKEY_UP)
-               {
+               case '8':
+               case SKEY_UP:
                        line--;
                        if (line < 0) line = 0;
-               }
+                       break;
 
-               if (skey == '2' || skey == SKEY_DOWN) line++;
+               case '2':
+               case SKEY_DOWN:
+                       line++;
+                       break;
 
                /* Advance one page */
-               if (skey == ' ')
-               {
+               case ' ':
                        line = line + (reverse ? -rows : rows);
                        if (line < 0) line = 0;
-               }
+                       break;
 
                /* One page down */
-               if (skey == SKEY_PGDOWN)
-               {
+               case SKEY_PGDOWN:
                        line = line + rows;
+                       break;
                }
 
                /* Recurse on numbers */
@@ -5732,14 +5911,11 @@ strcpy(tmp, "jhelp.hlp");
                        strcpy (xtmp, "");
 
 #ifdef JP
-                       if (!get_string("¥Õ¥¡¥¤¥ë̾: ", xtmp, 80))
+                       if (!get_string("¥Õ¥¡¥¤¥ë̾: ", xtmp, 80)) continue;
 #else
-                       if (!get_string("File name: ", xtmp, 80))
+                       if (!get_string("File name: ", xtmp, 80)) continue;
 #endif
-                       {
-                               continue;
-                       }
+
                        /* Close it */
                        my_fclose(fff);
 
@@ -5755,11 +5931,10 @@ strcpy(tmp, "jhelp.hlp");
                        if (!(fff && ffp))
                        {
 #ifdef JP
-msg_print("¥Õ¥¡¥¤¥ë¤¬³«¤±¤Þ¤»¤ó¡£");
+                               msg_print("¥Õ¥¡¥¤¥ë¤ò³«¤±¤Þ¤»¤ó¡£");
 #else
                                msg_print("Failed to open file.");
 #endif
-
                                skey = ESCAPE;
                                break;
                        }
@@ -5780,8 +5955,7 @@ msg_print("
                }
 
                /* Return to last screen */
-               if (skey == ESCAPE) break;
-               if (skey == '<') break;
+               if ((skey == ESCAPE) || (skey == '<')) break;
 
                /* Exit on the ^q */
                if (skey == KTRL('q')) skey = 'q';
@@ -5923,9 +6097,11 @@ quit_fmt("'%s' 
                        player_base[k++] = '_';
                        i += strlen(PATH_SEP);
                }
+               /* Convert some characters to underscore */
 #ifdef MSDOS
-               /* Convert space, dot, and underscore to underscore */
-               else if (my_strchr(". _", c)) player_base[k++] = '_';
+               else if (my_strchr(" \"*+,./:;<=>?[\\]|", c)) player_base[k++] = '_';
+#elif defined(WINDOWS)
+               else if (my_strchr("\"*,/:;<>?\\|", c)) player_base[k++] = '_';
 #endif
                else if (isprint(c)) player_base[k++] = c;
        }
@@ -6030,7 +6206,8 @@ void get_name(void)
                /* Use the name */
                strcpy(player_name, tmp);
        }
-       else if (0 == strlen(player_name))
+
+       if (0 == strlen(player_name))
        {
                /* Use default name */
                strcpy(player_name, "PLAYER");
@@ -6113,10 +6290,18 @@ prt("
        {
                char buf[1024] = "";
 
+               do
+               {
+#ifdef JP
+                       while (!get_string("*¾¡Íø*¥á¥Ã¥»¡¼¥¸: ", buf, sizeof buf)) ;
+#else
+                       while (!get_string("*Winning* message: ", buf, sizeof buf)) ;
+#endif
+               }
 #ifdef JP
-               while (!get_string("*¾¡Íø*¥á¥Ã¥»¡¼¥¸: ", buf, sizeof buf)) ;
+               while (!get_check_strict("¤è¤í¤·¤¤¤Ç¤¹¤«¡©", CHECK_NO_HISTORY));
 #else
-               while (!get_string("*Winning* message: ", buf, sizeof buf)) ;
+               while (!get_check_strict("Are you sure? ", CHECK_NO_HISTORY));
 #endif
 
                if (buf[0])