OSDN Git Service

[Refactor] #39962 files.c からtemporary-resistances.c/h を分離 / Separated temporary-resis...
[hengband/hengband.git] / src / files.c
index de863f7..39f0d2e 100644 (file)
 #include "view/display-util.h"
 #include "view/status-first-page.h"
 #include "uid-checker.h"
-#include "util.h"
+#include "player/permanent-resistances.h"
+#include "player/temporary-resistances.h"
 #include "files.h"
 #include "core.h"
 
 #include "birth.h"
-#include "files.h"
-
-#include "bldg.h"
-
-#include "cmd-magiceat.h"
+#include "character-dump.h"
 #include "cmd-dump.h"
 #include "world.h"
 #include "player-inventory.h"
 #include "player-personality.h"
 #include "player-sex.h"
 #include "player-effects.h"
-#include "sort.h"
 #include "mutation.h"
 #include "quest.h"
-#include "store.h"
-#include "avatar.h"
 #include "shoot.h"
 #include "patron.h"
 #include "monster-status.h"
-#include "object-flavor.h"
 #include "object-hook.h"
 #include "realm-hex.h"
-#include "cmd-pet.h"
 #include "view-mainwindow.h"
-#include "floor-town.h"
 #include "dungeon-file.h"
-#include "init.h"
-#include "monster-spell.h"
-#include "dungeon.h"
 #include "objectkind.h"
 #include "autopick.h"
 #include "save.h"
@@ -946,8 +934,6 @@ static errr process_pref_file_aux(player_type *creature_ptr, concptr name, int p
                        if (depth_count > 20) continue;
 
                        depth_count++;
-
-                       /* Process that file if allowed */
                        switch (preftype)
                        {
                        case PREF_TYPE_AUTOPICK:
@@ -1227,579 +1213,6 @@ static void display_player_middle(player_type *creature_ptr)
 
 
 /*!
- * @brief プレイヤーの職業、種族に応じた耐性フラグを返す
- * Prints ratings on certain abilities
- * @param creature_ptr 参照元クリーチャーポインタ
- * @param flgs フラグを保管する配列
- * @return なし
- * @details
- * Obtain the "flags" for the player as if he was an item
- * @todo
- * xtra1.c周りと多重実装になっているのを何とかする
- */
-static void player_flags(player_type *creature_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
-{
-       for (int i = 0; i < TR_FLAG_SIZE; i++)
-               flgs[i] = 0L;
-
-       switch (creature_ptr->pclass)
-       {
-       case CLASS_WARRIOR:
-               if (creature_ptr->lev > 44)
-                       add_flag(flgs, TR_REGEN);
-       case CLASS_SAMURAI:
-               if (creature_ptr->lev > 29)
-                       add_flag(flgs, TR_RES_FEAR);
-               break;
-       case CLASS_PALADIN:
-               if (creature_ptr->lev > 39)
-                       add_flag(flgs, TR_RES_FEAR);
-               break;
-       case CLASS_CHAOS_WARRIOR:
-               if (creature_ptr->lev > 29)
-                       add_flag(flgs, TR_RES_CHAOS);
-               if (creature_ptr->lev > 39)
-                       add_flag(flgs, TR_RES_FEAR);
-               break;
-       case CLASS_MONK:
-       case CLASS_FORCETRAINER:
-               if ((creature_ptr->lev > 9) && !heavy_armor(creature_ptr))
-                       add_flag(flgs, TR_SPEED);
-               if ((creature_ptr->lev > 24) && !heavy_armor(creature_ptr))
-                       add_flag(flgs, TR_FREE_ACT);
-               break;
-       case CLASS_NINJA:
-               if (heavy_armor(creature_ptr))
-                       add_flag(flgs, TR_SPEED);
-               else
-               {
-                       if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || creature_ptr->migite) &&
-                               (!creature_ptr->inventory_list[INVEN_LARM].k_idx || creature_ptr->hidarite))
-                               add_flag(flgs, TR_SPEED);
-                       if (creature_ptr->lev > 24)
-                               add_flag(flgs, TR_FREE_ACT);
-               }
-
-               add_flag(flgs, TR_SLOW_DIGEST);
-               add_flag(flgs, TR_RES_FEAR);
-               if (creature_ptr->lev > 19) add_flag(flgs, TR_RES_POIS);
-               if (creature_ptr->lev > 24) add_flag(flgs, TR_SUST_DEX);
-               if (creature_ptr->lev > 29) add_flag(flgs, TR_SEE_INVIS);
-               break;
-       case CLASS_MINDCRAFTER:
-               if (creature_ptr->lev > 9)
-                       add_flag(flgs, TR_RES_FEAR);
-               if (creature_ptr->lev > 19)
-                       add_flag(flgs, TR_SUST_WIS);
-               if (creature_ptr->lev > 29)
-                       add_flag(flgs, TR_RES_CONF);
-               if (creature_ptr->lev > 39)
-                       add_flag(flgs, TR_TELEPATHY);
-               break;
-       case CLASS_BARD:
-               add_flag(flgs, TR_RES_SOUND);
-               break;
-       case CLASS_BERSERKER:
-               add_flag(flgs, TR_SUST_STR);
-               add_flag(flgs, TR_SUST_DEX);
-               add_flag(flgs, TR_SUST_CON);
-               add_flag(flgs, TR_REGEN);
-               add_flag(flgs, TR_FREE_ACT);
-               add_flag(flgs, TR_SPEED);
-               if (creature_ptr->lev > 39) add_flag(flgs, TR_REFLECT);
-               break;
-       case CLASS_MIRROR_MASTER:
-               if (creature_ptr->lev > 39)add_flag(flgs, TR_REFLECT);
-               break;
-       default:
-               break; /* Do nothing */
-       }
-
-       /* Races */
-       if (creature_ptr->mimic_form)
-       {
-               switch (creature_ptr->mimic_form)
-               {
-               case MIMIC_DEMON:
-                       add_flag(flgs, TR_HOLD_EXP);
-                       add_flag(flgs, TR_RES_CHAOS);
-                       add_flag(flgs, TR_RES_NETHER);
-                       add_flag(flgs, TR_RES_FIRE);
-                       add_flag(flgs, TR_SEE_INVIS);
-                       add_flag(flgs, TR_SPEED);
-                       break;
-               case MIMIC_DEMON_LORD:
-                       add_flag(flgs, TR_HOLD_EXP);
-                       add_flag(flgs, TR_RES_CHAOS);
-                       add_flag(flgs, TR_RES_NETHER);
-                       add_flag(flgs, TR_RES_FIRE);
-                       add_flag(flgs, TR_RES_COLD);
-                       add_flag(flgs, TR_RES_ELEC);
-                       add_flag(flgs, TR_RES_ACID);
-                       add_flag(flgs, TR_RES_POIS);
-                       add_flag(flgs, TR_RES_CONF);
-                       add_flag(flgs, TR_RES_DISEN);
-                       add_flag(flgs, TR_RES_NEXUS);
-                       add_flag(flgs, TR_RES_FEAR);
-                       add_flag(flgs, TR_IM_FIRE);
-                       add_flag(flgs, TR_SH_FIRE);
-                       add_flag(flgs, TR_SEE_INVIS);
-                       add_flag(flgs, TR_TELEPATHY);
-                       add_flag(flgs, TR_LEVITATION);
-                       add_flag(flgs, TR_SPEED);
-                       break;
-               case MIMIC_VAMPIRE:
-                       add_flag(flgs, TR_HOLD_EXP);
-                       add_flag(flgs, TR_RES_DARK);
-                       add_flag(flgs, TR_RES_NETHER);
-                       if (creature_ptr->pclass != CLASS_NINJA) add_flag(flgs, TR_LITE_1);
-                       add_flag(flgs, TR_RES_POIS);
-                       add_flag(flgs, TR_RES_COLD);
-                       add_flag(flgs, TR_SEE_INVIS);
-                       add_flag(flgs, TR_SPEED);
-                       break;
-               }
-       }
-       else
-       {
-               switch (creature_ptr->prace)
-               {
-               case RACE_ELF:
-                       add_flag(flgs, TR_RES_LITE);
-                       break;
-               case RACE_HOBBIT:
-                       add_flag(flgs, TR_HOLD_EXP);
-                       break;
-               case RACE_GNOME:
-                       add_flag(flgs, TR_FREE_ACT);
-                       break;
-               case RACE_DWARF:
-                       add_flag(flgs, TR_RES_BLIND);
-                       break;
-               case RACE_HALF_ORC:
-                       add_flag(flgs, TR_RES_DARK);
-                       break;
-               case RACE_HALF_TROLL:
-                       add_flag(flgs, TR_SUST_STR);
-                       if (creature_ptr->lev <= 14) break;
-
-                       add_flag(flgs, TR_REGEN);
-                       if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_BERSERKER))
-                       {
-                               add_flag(flgs, TR_SLOW_DIGEST);
-                               /*
-                                * Let's not make Regeneration a disadvantage
-                                * for the poor warriors who can never learn
-                                * a spell that satisfies hunger (actually
-                                * neither can rogues, but half-trolls are not
-                                * supposed to play rogues)
-                                */
-                       }
-
-                       break;
-               case RACE_AMBERITE:
-                       add_flag(flgs, TR_SUST_CON);
-                       add_flag(flgs, TR_REGEN);
-                       break;
-               case RACE_HIGH_ELF:
-                       add_flag(flgs, TR_RES_LITE);
-                       add_flag(flgs, TR_SEE_INVIS);
-                       break;
-               case RACE_BARBARIAN:
-                       add_flag(flgs, TR_RES_FEAR);
-                       break;
-               case RACE_HALF_OGRE:
-                       add_flag(flgs, TR_SUST_STR);
-                       add_flag(flgs, TR_RES_DARK);
-                       break;
-               case RACE_HALF_GIANT:
-                       add_flag(flgs, TR_RES_SHARDS);
-                       add_flag(flgs, TR_SUST_STR);
-                       break;
-               case RACE_HALF_TITAN:
-                       add_flag(flgs, TR_RES_CHAOS);
-                       break;
-               case RACE_CYCLOPS:
-                       add_flag(flgs, TR_RES_SOUND);
-                       break;
-               case RACE_YEEK:
-                       add_flag(flgs, TR_RES_ACID);
-                       if (creature_ptr->lev > 19)
-                               add_flag(flgs, TR_IM_ACID);
-                       break;
-               case RACE_KLACKON:
-                       add_flag(flgs, TR_RES_CONF);
-                       add_flag(flgs, TR_RES_ACID);
-                       if (creature_ptr->lev > 9)
-                               add_flag(flgs, TR_SPEED);
-                       break;
-               case RACE_KOBOLD:
-                       add_flag(flgs, TR_RES_POIS);
-                       break;
-               case RACE_NIBELUNG:
-                       add_flag(flgs, TR_RES_DISEN);
-                       add_flag(flgs, TR_RES_DARK);
-                       break;
-               case RACE_DARK_ELF:
-                       add_flag(flgs, TR_RES_DARK);
-                       if (creature_ptr->lev > 19)
-                               add_flag(flgs, TR_SEE_INVIS);
-                       break;
-               case RACE_DRACONIAN:
-                       add_flag(flgs, TR_LEVITATION);
-                       if (creature_ptr->lev > 4)
-                               add_flag(flgs, TR_RES_FIRE);
-                       if (creature_ptr->lev > 9)
-                               add_flag(flgs, TR_RES_COLD);
-                       if (creature_ptr->lev > 14)
-                               add_flag(flgs, TR_RES_ACID);
-                       if (creature_ptr->lev > 19)
-                               add_flag(flgs, TR_RES_ELEC);
-                       if (creature_ptr->lev > 34)
-                               add_flag(flgs, TR_RES_POIS);
-                       break;
-               case RACE_MIND_FLAYER:
-                       add_flag(flgs, TR_SUST_INT);
-                       add_flag(flgs, TR_SUST_WIS);
-                       if (creature_ptr->lev > 14)
-                               add_flag(flgs, TR_SEE_INVIS);
-                       if (creature_ptr->lev > 29)
-                               add_flag(flgs, TR_TELEPATHY);
-                       break;
-               case RACE_IMP:
-                       add_flag(flgs, TR_RES_FIRE);
-                       if (creature_ptr->lev > 9)
-                               add_flag(flgs, TR_SEE_INVIS);
-                       break;
-               case RACE_GOLEM:
-                       add_flag(flgs, TR_SEE_INVIS);
-                       add_flag(flgs, TR_FREE_ACT);
-                       add_flag(flgs, TR_RES_POIS);
-                       add_flag(flgs, TR_SLOW_DIGEST);
-                       if (creature_ptr->lev > 34)
-                               add_flag(flgs, TR_HOLD_EXP);
-                       break;
-               case RACE_SKELETON:
-                       add_flag(flgs, TR_SEE_INVIS);
-                       add_flag(flgs, TR_RES_SHARDS);
-                       add_flag(flgs, TR_HOLD_EXP);
-                       add_flag(flgs, TR_RES_POIS);
-                       if (creature_ptr->lev > 9)
-                               add_flag(flgs, TR_RES_COLD);
-                       break;
-               case RACE_ZOMBIE:
-                       add_flag(flgs, TR_SEE_INVIS);
-                       add_flag(flgs, TR_HOLD_EXP);
-                       add_flag(flgs, TR_RES_NETHER);
-                       add_flag(flgs, TR_RES_POIS);
-                       add_flag(flgs, TR_SLOW_DIGEST);
-                       if (creature_ptr->lev > 4)
-                               add_flag(flgs, TR_RES_COLD);
-                       break;
-               case RACE_VAMPIRE:
-                       add_flag(flgs, TR_HOLD_EXP);
-                       add_flag(flgs, TR_RES_DARK);
-                       add_flag(flgs, TR_RES_NETHER);
-                       if (creature_ptr->pclass != CLASS_NINJA) add_flag(flgs, TR_LITE_1);
-                       add_flag(flgs, TR_RES_POIS);
-                       add_flag(flgs, TR_RES_COLD);
-                       break;
-               case RACE_SPECTRE:
-                       add_flag(flgs, TR_LEVITATION);
-                       add_flag(flgs, TR_FREE_ACT);
-                       add_flag(flgs, TR_RES_COLD);
-                       add_flag(flgs, TR_SEE_INVIS);
-                       add_flag(flgs, TR_HOLD_EXP);
-                       add_flag(flgs, TR_RES_NETHER);
-                       add_flag(flgs, TR_RES_POIS);
-                       add_flag(flgs, TR_SLOW_DIGEST);
-                       /* XXX pass_wall */
-                       if (creature_ptr->lev > 34)
-                               add_flag(flgs, TR_TELEPATHY);
-                       break;
-               case RACE_SPRITE:
-                       add_flag(flgs, TR_RES_LITE);
-                       add_flag(flgs, TR_LEVITATION);
-                       if (creature_ptr->lev > 9)
-                               add_flag(flgs, TR_SPEED);
-                       break;
-               case RACE_BEASTMAN:
-                       add_flag(flgs, TR_RES_SOUND);
-                       add_flag(flgs, TR_RES_CONF);
-                       break;
-               case RACE_ANGEL:
-                       add_flag(flgs, TR_LEVITATION);
-                       add_flag(flgs, TR_SEE_INVIS);
-                       break;
-               case RACE_DEMON:
-                       add_flag(flgs, TR_RES_FIRE);
-                       add_flag(flgs, TR_RES_NETHER);
-                       add_flag(flgs, TR_HOLD_EXP);
-                       if (creature_ptr->lev > 9)
-                               add_flag(flgs, TR_SEE_INVIS);
-                       break;
-               case RACE_DUNADAN:
-                       add_flag(flgs, TR_SUST_CON);
-                       break;
-               case RACE_S_FAIRY:
-                       add_flag(flgs, TR_LEVITATION);
-                       break;
-               case RACE_KUTAR:
-                       add_flag(flgs, TR_RES_CONF);
-                       break;
-               case RACE_ANDROID:
-                       add_flag(flgs, TR_FREE_ACT);
-                       add_flag(flgs, TR_RES_POIS);
-                       add_flag(flgs, TR_SLOW_DIGEST);
-                       add_flag(flgs, TR_HOLD_EXP);
-                       break;
-               default:
-                       ; /* Do nothing */
-               }
-       }
-
-       /* Mutations */
-       if (creature_ptr->muta3)
-       {
-               if (creature_ptr->muta3 & MUT3_FLESH_ROT)
-               {
-                       remove_flag(flgs, TR_REGEN);
-               }
-
-               if ((creature_ptr->muta3 & MUT3_XTRA_FAT) ||
-                       (creature_ptr->muta3 & MUT3_XTRA_LEGS) ||
-                       (creature_ptr->muta3 & MUT3_SHORT_LEG))
-               {
-                       add_flag(flgs, TR_SPEED);
-               }
-
-               if (creature_ptr->muta3  & MUT3_ELEC_TOUC)
-               {
-                       add_flag(flgs, TR_SH_ELEC);
-               }
-
-               if (creature_ptr->muta3 & MUT3_FIRE_BODY)
-               {
-                       add_flag(flgs, TR_SH_FIRE);
-                       add_flag(flgs, TR_LITE_1);
-               }
-
-               if (creature_ptr->muta3 & MUT3_WINGS)
-               {
-                       add_flag(flgs, TR_LEVITATION);
-               }
-
-               if (creature_ptr->muta3 & MUT3_FEARLESS)
-               {
-                       add_flag(flgs, TR_RES_FEAR);
-               }
-
-               if (creature_ptr->muta3 & MUT3_REGEN)
-               {
-                       add_flag(flgs, TR_REGEN);
-               }
-
-               if (creature_ptr->muta3 & MUT3_ESP)
-               {
-                       add_flag(flgs, TR_TELEPATHY);
-               }
-
-               if (creature_ptr->muta3 & MUT3_MOTION)
-               {
-                       add_flag(flgs, TR_FREE_ACT);
-               }
-       }
-
-       if (creature_ptr->pseikaku == SEIKAKU_SEXY)
-               add_flag(flgs, TR_AGGRAVATE);
-       if (creature_ptr->pseikaku == SEIKAKU_CHARGEMAN)
-               add_flag(flgs, TR_RES_CONF);
-       if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
-       {
-               add_flag(flgs, TR_RES_BLIND);
-               add_flag(flgs, TR_RES_CONF);
-               add_flag(flgs, TR_HOLD_EXP);
-               if (creature_ptr->pclass != CLASS_NINJA) add_flag(flgs, TR_LITE_1);
-               if (creature_ptr->lev > 9)
-                       add_flag(flgs, TR_SPEED);
-       }
-
-       if (creature_ptr->special_defense & KATA_FUUJIN)
-               add_flag(flgs, TR_REFLECT);
-
-       if (creature_ptr->special_defense & KAMAE_GENBU)
-               add_flag(flgs, TR_REFLECT);
-
-       if (creature_ptr->special_defense & KAMAE_SUZAKU)
-               add_flag(flgs, TR_LEVITATION);
-
-       if (creature_ptr->special_defense & KAMAE_SEIRYU)
-       {
-               add_flag(flgs, TR_RES_FIRE);
-               add_flag(flgs, TR_RES_COLD);
-               add_flag(flgs, TR_RES_ACID);
-               add_flag(flgs, TR_RES_ELEC);
-               add_flag(flgs, TR_RES_POIS);
-               add_flag(flgs, TR_LEVITATION);
-               add_flag(flgs, TR_SH_FIRE);
-               add_flag(flgs, TR_SH_ELEC);
-               add_flag(flgs, TR_SH_COLD);
-       }
-
-       if (creature_ptr->special_defense & KATA_MUSOU)
-       {
-               add_flag(flgs, TR_RES_FEAR);
-               add_flag(flgs, TR_RES_LITE);
-               add_flag(flgs, TR_RES_DARK);
-               add_flag(flgs, TR_RES_BLIND);
-               add_flag(flgs, TR_RES_CONF);
-               add_flag(flgs, TR_RES_SOUND);
-               add_flag(flgs, TR_RES_SHARDS);
-               add_flag(flgs, TR_RES_NETHER);
-               add_flag(flgs, TR_RES_NEXUS);
-               add_flag(flgs, TR_RES_CHAOS);
-               add_flag(flgs, TR_RES_DISEN);
-               add_flag(flgs, TR_REFLECT);
-               add_flag(flgs, TR_HOLD_EXP);
-               add_flag(flgs, TR_FREE_ACT);
-               add_flag(flgs, TR_SH_FIRE);
-               add_flag(flgs, TR_SH_ELEC);
-               add_flag(flgs, TR_SH_COLD);
-               add_flag(flgs, TR_LEVITATION);
-               add_flag(flgs, TR_LITE_1);
-               add_flag(flgs, TR_SEE_INVIS);
-               add_flag(flgs, TR_TELEPATHY);
-               add_flag(flgs, TR_SLOW_DIGEST);
-               add_flag(flgs, TR_REGEN);
-               add_flag(flgs, TR_SUST_STR);
-               add_flag(flgs, TR_SUST_INT);
-               add_flag(flgs, TR_SUST_WIS);
-               add_flag(flgs, TR_SUST_DEX);
-               add_flag(flgs, TR_SUST_CON);
-               add_flag(flgs, TR_SUST_CHR);
-       }
-}
-
-
-/*!
- * @brief プレイヤーの一時的魔法効果による耐性を返す
- * Prints ratings on certain abilities
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param flgs フラグを保管する配列
- * @return なし
- * @todo
- * xtra1.c周りと多重実装になっているのを何とかする
- */
-static void tim_player_flags(player_type *creature_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
-{
-       for (int i = 0; i < TR_FLAG_SIZE; i++)
-               flgs[i] = 0L;
-
-       if (IS_HERO(creature_ptr) || creature_ptr->shero)
-               add_flag(flgs, TR_RES_FEAR);
-       if (creature_ptr->tim_invis)
-               add_flag(flgs, TR_SEE_INVIS);
-       if (creature_ptr->tim_regen)
-               add_flag(flgs, TR_REGEN);
-       if (is_time_limit_esp(creature_ptr))
-               add_flag(flgs, TR_TELEPATHY);
-       if (IS_FAST(creature_ptr) || creature_ptr->slow)
-               add_flag(flgs, TR_SPEED);
-
-       if (is_oppose_acid(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_ACID) && !(PRACE_IS_(creature_ptr, RACE_YEEK) && (creature_ptr->lev > 19)))
-               add_flag(flgs, TR_RES_ACID);
-       if (is_oppose_elec(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_ELEC))
-               add_flag(flgs, TR_RES_ELEC);
-       if (is_oppose_fire(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_FIRE))
-               add_flag(flgs, TR_RES_FIRE);
-       if (is_oppose_cold(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_COLD))
-               add_flag(flgs, TR_RES_COLD);
-       if (is_oppose_pois(creature_ptr))
-               add_flag(flgs, TR_RES_POIS);
-
-       if (creature_ptr->special_attack & ATTACK_ACID)
-               add_flag(flgs, TR_BRAND_ACID);
-       if (creature_ptr->special_attack & ATTACK_ELEC)
-               add_flag(flgs, TR_BRAND_ELEC);
-       if (creature_ptr->special_attack & ATTACK_FIRE)
-               add_flag(flgs, TR_BRAND_FIRE);
-       if (creature_ptr->special_attack & ATTACK_COLD)
-               add_flag(flgs, TR_BRAND_COLD);
-       if (creature_ptr->special_attack & ATTACK_POIS)
-               add_flag(flgs, TR_BRAND_POIS);
-       if (creature_ptr->special_defense & DEFENSE_ACID)
-               add_flag(flgs, TR_IM_ACID);
-       if (creature_ptr->special_defense & DEFENSE_ELEC)
-               add_flag(flgs, TR_IM_ELEC);
-       if (creature_ptr->special_defense & DEFENSE_FIRE)
-               add_flag(flgs, TR_IM_FIRE);
-       if (creature_ptr->special_defense & DEFENSE_COLD)
-               add_flag(flgs, TR_IM_COLD);
-       if (creature_ptr->wraith_form)
-               add_flag(flgs, TR_REFLECT);
-       if (creature_ptr->tim_reflect)
-               add_flag(flgs, TR_REFLECT);
-
-       if (creature_ptr->magicdef)
-       {
-               add_flag(flgs, TR_RES_BLIND);
-               add_flag(flgs, TR_RES_CONF);
-               add_flag(flgs, TR_REFLECT);
-               add_flag(flgs, TR_FREE_ACT);
-               add_flag(flgs, TR_LEVITATION);
-       }
-
-       if (creature_ptr->tim_res_nether) add_flag(flgs, TR_RES_NETHER);
-
-       if (creature_ptr->tim_sh_fire) add_flag(flgs, TR_SH_FIRE);
-
-       if (creature_ptr->ult_res)
-       {
-               add_flag(flgs, TR_RES_FEAR);
-               add_flag(flgs, TR_RES_LITE);
-               add_flag(flgs, TR_RES_DARK);
-               add_flag(flgs, TR_RES_BLIND);
-               add_flag(flgs, TR_RES_CONF);
-               add_flag(flgs, TR_RES_SOUND);
-               add_flag(flgs, TR_RES_SHARDS);
-               add_flag(flgs, TR_RES_NETHER);
-               add_flag(flgs, TR_RES_NEXUS);
-               add_flag(flgs, TR_RES_CHAOS);
-               add_flag(flgs, TR_RES_DISEN);
-               add_flag(flgs, TR_REFLECT);
-               add_flag(flgs, TR_HOLD_EXP);
-               add_flag(flgs, TR_FREE_ACT);
-               add_flag(flgs, TR_SH_FIRE);
-               add_flag(flgs, TR_SH_ELEC);
-               add_flag(flgs, TR_SH_COLD);
-               add_flag(flgs, TR_LEVITATION);
-               add_flag(flgs, TR_LITE_1);
-               add_flag(flgs, TR_SEE_INVIS);
-               add_flag(flgs, TR_TELEPATHY);
-               add_flag(flgs, TR_SLOW_DIGEST);
-               add_flag(flgs, TR_REGEN);
-               add_flag(flgs, TR_SUST_STR);
-               add_flag(flgs, TR_SUST_INT);
-               add_flag(flgs, TR_SUST_WIS);
-               add_flag(flgs, TR_SUST_DEX);
-               add_flag(flgs, TR_SUST_CON);
-               add_flag(flgs, TR_SUST_CHR);
-       }
-
-       if (creature_ptr->realm1 != REALM_HEX) return;
-
-       if (hex_spelling(creature_ptr, HEX_DEMON_AURA))
-       {
-               add_flag(flgs, TR_SH_FIRE);
-               add_flag(flgs, TR_REGEN);
-       }
-
-       if (hex_spelling(creature_ptr, HEX_ICE_ARMOR)) add_flag(flgs, TR_SH_COLD);
-       if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK)) add_flag(flgs, TR_SH_ELEC);
-}
-
-
-/*!
  * @brief プレイヤーの装備一覧をシンボルで並べる
  * Equippy chars
  * @param creature_ptr プレーヤーへの参照ポインタ
@@ -1942,7 +1355,6 @@ static void player_vuln_flags(player_type *creature_ptr, BIT_FLAGS flgs[TR_FLAG_
                add_flag(flgs, TR_RES_LITE);
 }
 
-
 /*
  * A struct for storing misc. flags
  */
@@ -2453,7 +1865,6 @@ static void display_player_misc_info(player_type *creature_ptr)
  */
 static void display_player_stat_info(player_type *creature_ptr)
 {
-       /* Print out the labels for the columns */
        int stat_col = 22;
        int row = 3;
        c_put_str(TERM_WHITE, _("能力", "Stat"), row, stat_col + 1);
@@ -2462,7 +1873,6 @@ static void display_player_stat_info(player_type *creature_ptr)
        c_put_str(TERM_L_GREEN, _("合計", "Actual"), row, stat_col + 28);
        c_put_str(TERM_YELLOW, _("現在", "Current"), row, stat_col + 35);
 
-       /* Display the stats */
        char buf[80];
        for (int i = 0; i < A_MAX; i++)
        {
@@ -2513,13 +1923,10 @@ static void display_player_stat_info(player_type *creature_ptr)
                /* This is useful to see if you are maxed out */
                cnv_stat(creature_ptr->stat_max[i], buf);
                if (creature_ptr->stat_max[i] == creature_ptr->stat_max_max[i])
-               {
                        c_put_str(TERM_WHITE, "!", row + i + 1, _(stat_col + 6, stat_col + 4));
-               }
 
                c_put_str(TERM_BLUE, buf, row + i + 1, stat_col + 13 - strlen(buf));
 
-               /* Race, class, and equipment modifiers */
                (void)sprintf(buf, "%3d", r_adj);
                c_put_str(TERM_L_BLUE, buf, row + i + 1, stat_col + 13);
                (void)sprintf(buf, "%3d", (int)cp_ptr->c_adj[i]);
@@ -2529,11 +1936,9 @@ static void display_player_stat_info(player_type *creature_ptr)
                (void)sprintf(buf, "%3d", (int)e_adj);
                c_put_str(TERM_L_BLUE, buf, row + i + 1, stat_col + 22);
 
-               /* Actual maximal modified value */
                cnv_stat(creature_ptr->stat_top[i], buf);
                c_put_str(TERM_L_GREEN, buf, row + i + 1, stat_col + 26);
 
-               /* Only display stat_use if not maximal */
                if (creature_ptr->stat_use[i] < creature_ptr->stat_top[i])
                {
                        cnv_stat(creature_ptr->stat_use[i], buf);
@@ -2551,50 +1956,33 @@ static void display_player_stat_info(player_type *creature_ptr)
                object_type *o_ptr;
                o_ptr = &creature_ptr->inventory_list[i];
                object_flags_known(o_ptr, flgs);
-
-               /* Initialize color based of sign of pval. */
                for (int stat = 0; stat < A_MAX; stat++)
                {
                        byte a = TERM_SLATE;
                        char c = '.';
-
-                       /* Boost */
                        if (have_flag(flgs, stat))
                        {
-                               /* Default */
                                c = '*';
 
-                               /* Good */
                                if (o_ptr->pval > 0)
                                {
-                                       /* Good */
                                        a = TERM_L_GREEN;
-
-                                       /* Label boost */
                                        if (o_ptr->pval < 10) c = '0' + o_ptr->pval;
                                }
 
                                if (have_flag(flgs, stat + TR_SUST_STR))
                                {
-                                       /* Dark green for sustained stats */
                                        a = TERM_GREEN;
                                }
 
-                               /* Bad */
                                if (o_ptr->pval < 0)
                                {
-                                       /* Bad */
                                        a = TERM_RED;
-
-                                       /* Label boost */
                                        if (o_ptr->pval > -10) c = '0' - o_ptr->pval;
                                }
                        }
-
-                       /* Sustain */
                        else if (have_flag(flgs, stat + TR_SUST_STR))
                        {
-                               /* Dark green "s" */
                                a = TERM_GREEN;
                                c = 's';
                        }
@@ -2606,7 +1994,6 @@ static void display_player_stat_info(player_type *creature_ptr)
        }
 
        player_flags(creature_ptr, flgs);
-
        for (int stat = 0; stat < A_MAX; stat++)
        {
                byte a = TERM_SLATE;
@@ -2651,12 +2038,9 @@ static void display_player_stat_info(player_type *creature_ptr)
                                if (creature_ptr->muta3 & MUT3_ILL_NORM) dummy = 0;
                        }
 
-                       /* Boost */
-                       if (dummy)
+                       if (dummy != 0)
                        {
                                c = '*';
-
-                               /* Good */
                                if (dummy > 0)
                                {
                                        /* Good */
@@ -2666,13 +2050,9 @@ static void display_player_stat_info(player_type *creature_ptr)
                                        if (dummy < 10) c = '0' + dummy;
                                }
 
-                               /* Bad */
                                if (dummy < 0)
                                {
-                                       /* Bad */
                                        a = TERM_RED;
-
-                                       /* Label boost */
                                        if (dummy > -10) c = '0' - dummy;
                                }
                        }
@@ -2680,7 +2060,6 @@ static void display_player_stat_info(player_type *creature_ptr)
 
                if (have_flag(flgs, stat + TR_SUST_STR))
                {
-                       /* Dark green "s" */
                        a = TERM_GREEN;
                        c = 's';
                }
@@ -2780,43 +2159,20 @@ void display_player(player_type *creature_ptr, int mode)
        char buf[80];
        for (int i = 0; i < A_MAX; i++)
        {
-               /* Special treatment of "injured" stats */
                if (creature_ptr->stat_cur[i] < creature_ptr->stat_max[i])
                {
-                       int value;
-
-                       /* Use lowercase stat name */
                        put_str(stat_names_reduced[i], 3 + i, 53);
-
-                       /* Get the current stat */
-                       value = creature_ptr->stat_use[i];
-
-                       /* Obtain the current stat (modified) */
+                       int value = creature_ptr->stat_use[i];
                        cnv_stat(value, buf);
-
-                       /* Display the current stat (modified) */
                        c_put_str(TERM_YELLOW, buf, 3 + i, 60);
-
-                       /* Acquire the max stat */
                        value = creature_ptr->stat_top[i];
-
-                       /* Obtain the maximum stat (modified) */
                        cnv_stat(value, buf);
-
-                       /* Display the maximum stat (modified) */
                        c_put_str(TERM_L_GREEN, buf, 3 + i, 67);
                }
-
-               /* Normal treatment of "normal" stats */
                else
                {
-                       /* Assume uppercase stat name */
                        put_str(stat_names[i], 3 + i, 53);
-
-                       /* Obtain the current stat (modified) */
                        cnv_stat(creature_ptr->stat_use[i], buf);
-
-                       /* Display the current stat (modified) */
                        c_put_str(TERM_L_GREEN, buf, 3 + i, 60);
                }
 
@@ -2826,7 +2182,6 @@ void display_player(player_type *creature_ptr, int mode)
                }
        }
 
-       /* Display "history" info */
        floor_type *floor_ptr = creature_ptr->current_floor_ptr;
        if (mode == 0)
        {
@@ -2902,8 +2257,6 @@ void display_player(player_type *creature_ptr, int mode)
                        }
 
                        quest_text_line = 0;
-
-                       /* Get the quest text */
                        init_flags = INIT_NAME_ONLY;
                        process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0);
                        sprintf(statmsg, _("…あなたは現在、 クエスト「%s」を遂行中だ。", "...Now, you are in the quest '%s'."), quest[floor_ptr->inside_quest].name);
@@ -2935,937 +2288,73 @@ void display_player(player_type *creature_ptr, int mode)
 
 
 /*!
- * @brief プレイヤーのステータス表示をファイルにダンプする
+ * @brief プレイヤーステータスをファイルダンプ出力する
+ * Hack -- Dump a character description file
  * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
- * @return なし
+ * @param name 出力ファイル名
+ * @return エラーコード
+ * @details
+ * Allow the "full" flag to dump additional info,
+ * and trigger its usage from various places in the code.
  */
-static void dump_aux_display_player(player_type *creature_ptr, FILE *fff)
+errr file_character(player_type *creature_ptr, concptr name)
 {
-       TERM_COLOR a;
-       char c;
        char buf[1024];
-       display_player(creature_ptr, 0);
-
-       for (TERM_LEN y = 1; y < 22; y++)
-       {
-               TERM_LEN x;
-               for (x = 0; x < 79; x++)
-               {
-                       (void)(Term_what(x, y, &a, &c));
-                       buf[x] = c;
-               }
-
-               buf[x] = '\0';
-               while ((x > 0) && (buf[x - 1] == ' '))
-                       buf[--x] = '\0';
+       path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
 
-               fprintf(fff, _("%s\n", "%s\n"), buf);
-       }
+       FILE_TYPE(FILE_TYPE_TEXT);
 
-       display_player(creature_ptr, 1);
-       for (TERM_LEN y = 10; y < 19; y++)
+       int     fd = fd_open(buf, O_RDONLY);
+       if (fd >= 0)
        {
-               TERM_LEN x;
-               for (x = 0; x < 79; x++)
-               {
-                       (void)(Term_what(x, y, &a, &c));
-                       buf[x] = c;
-               }
-
-               buf[x] = '\0';
-               while ((x > 0) && (buf[x - 1] == ' '))
-                       buf[--x] = '\0';
-
-               fprintf(fff, "%s\n", buf);
+               char out_val[160];
+               (void)fd_close(fd);
+               (void)sprintf(out_val, _("現存するファイル %s に上書きしますか? ", "Replace existing file %s? "), buf);
+               if (get_check_strict(out_val, CHECK_NO_HISTORY)) fd = -1;
        }
 
-       fprintf(fff, "\n");
-       display_player(creature_ptr, 2);
-       for (TERM_LEN y = 2; y < 22; y++)
-       {
-               TERM_LEN x;
-               for (x = 0; x < 79; x++)
-               {
-                       (void)(Term_what(x, y, &a, &c));
-                       if (a < 128)
-                               buf[x] = c;
-                       else
-                               buf[x] = ' ';
-               }
-
-               buf[x] = '\0';
-               while ((x > 0) && (buf[x - 1] == ' '))
-                       buf[--x] = '\0';
-
-               fprintf(fff, "%s\n", buf);
-       }
+       FILE *fff = NULL;
+       if (fd < 0) fff = my_fopen(buf, "w");
 
-       fprintf(fff, "\n");
-       display_player(creature_ptr, 3);
-       for (TERM_LEN y = 1; y < 22; y++)
+       if (!fff)
        {
-               TERM_LEN x;
-               for (x = 0; x < 79; x++)
-               {
-                       (void)(Term_what(x, y, &a, &c));
-                       if (a < 128)
-                               buf[x] = c;
-                       else
-                               buf[x] = ' ';
-               }
-
-               buf[x] = '\0';
-               while ((x > 0) && (buf[x - 1] == ' '))
-                       buf[--x] = '\0';
-
-               fprintf(fff, "%s\n", buf);
+               prt(_("キャラクタ情報のファイルへの書き出しに失敗しました!", "Character dump failed!"), 0, 0);
+               (void)inkey();
+               return -1;
        }
 
-       fprintf(fff, "\n");
+       /*
+       * todo view-mainwindow への依存があるが、file_character() 自体関数ポインタなのでよそから呼び出されるので何とかするのは辛い
+       * ついでに他の関数でもview(略) は参照されているので、簡単に除去することはできない…
+       */
+       make_character_dump(creature_ptr, fff, update_playtime, display_player);
+       my_fclose(fff);
+       msg_print(_("キャラクタ情報のファイルへの書き出しに成功しました。", "Character dump successful."));
+       msg_print(NULL);
+       return 0;
 }
 
 
 /*!
- * @brief プレイヤーのペット情報をファイルにダンプする
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
+ * @brief ファイル内容の一行をコンソールに出力する
+ * Display single line of on-line help file
+ * @param str 出力する文字列
+ * @param cy コンソールの行
+ * @param shower 確認中
  * @return なし
+ * @details
+ * <pre>
+ * You can insert some special color tag to change text color.
+ * Such as...
+ * WHITETEXT [[[[y|SOME TEXT WHICH IS DISPLAYED IN YELLOW| WHITETEXT
+ * A colored segment is between "[[[[y|" and the last "|".
+ * You can use any single character in place of the "|".
+ * </pre>
  */
-static void dump_aux_pet(player_type *master_ptr, FILE *fff)
+static void show_file_aux_line(concptr str, int cy, concptr shower)
 {
-       bool pet = FALSE;
-       bool pet_settings = FALSE;
-       for (int i = master_ptr->current_floor_ptr->m_max - 1; i >= 1; i--)
-       {
-               monster_type *m_ptr = &master_ptr->current_floor_ptr->m_list[i];
-
-               if (!monster_is_valid(m_ptr)) continue;
-               if (!is_pet(m_ptr)) continue;
-               pet_settings = TRUE;
-               if (!m_ptr->nickname && (master_ptr->riding != i)) continue;
-               if (!pet)
-               {
-                       fprintf(fff, _("\n\n  [主なペット]\n\n", "\n\n  [Leading Pets]\n\n"));
-                       pet = TRUE;
-               }
-
-               GAME_TEXT pet_name[MAX_NLEN];
-               monster_desc(master_ptr, pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-               fprintf(fff, "%s\n", pet_name);
-       }
-
-       if (!pet_settings) return;
-
-       fprintf(fff, _("\n\n  [ペットへの命令]\n", "\n\n  [Command for Pets]\n"));
-
-       fprintf(fff, _("\n ドアを開ける:                       %s", "\n Pets open doors:                    %s"),
-               (master_ptr->pet_extra_flags & PF_OPEN_DOORS) ? "ON" : "OFF");
-
-       fprintf(fff, _("\n アイテムを拾う:                     %s", "\n Pets pick up items:                 %s"),
-               (master_ptr->pet_extra_flags & PF_PICKUP_ITEMS) ? "ON" : "OFF");
-
-       fprintf(fff, _("\n テレポート系魔法を使う:             %s", "\n Allow teleport:                     %s"),
-               (master_ptr->pet_extra_flags & PF_TELEPORT) ? "ON" : "OFF");
-
-       fprintf(fff, _("\n 攻撃魔法を使う:                     %s", "\n Allow cast attack spell:            %s"),
-               (master_ptr->pet_extra_flags & PF_ATTACK_SPELL) ? "ON" : "OFF");
-
-       fprintf(fff, _("\n 召喚魔法を使う:                     %s", "\n Allow cast summon spell:            %s"),
-               (master_ptr->pet_extra_flags & PF_SUMMON_SPELL) ? "ON" : "OFF");
-
-       fprintf(fff, _("\n プレイヤーを巻き込む範囲魔法を使う: %s", "\n Allow involve player in area spell: %s"),
-               (master_ptr->pet_extra_flags & PF_BALL_SPELL) ? "ON" : "OFF");
-
-       fputc('\n', fff);
-}
-
-
-/*!
- * todo ここはenum/switchで扱いたい
- * @brief プレイヤーの職業能力情報をファイルにダンプする
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_class_special(player_type *creature_ptr, FILE *fff)
-{
-       bool is_special_class = creature_ptr->pclass == CLASS_MAGIC_EATER;
-       is_special_class |= creature_ptr->pclass == CLASS_SMITH;
-       is_special_class |= creature_ptr->pclass != CLASS_BLUE_MAGE;
-       if (!is_special_class) return;
-
-       if (creature_ptr->pclass == CLASS_MAGIC_EATER)
-       {
-               char s[EATER_EXT][MAX_NLEN];
-               OBJECT_TYPE_VALUE tval = 0;
-               fprintf(fff, _("\n\n  [取り込んだ魔法道具]\n", "\n\n  [Magic devices eaten]\n"));
-
-               for (int ext = 0; ext < 3; ext++)
-               {
-                       int eat_num = 0;
-
-                       /* Dump an extent name */
-                       switch (ext)
-                       {
-                       case 0:
-                               tval = TV_STAFF;
-                               fprintf(fff, _("\n[杖]\n", "\n[Staffs]\n"));
-                               break;
-                       case 1:
-                               tval = TV_WAND;
-                               fprintf(fff, _("\n[魔法棒]\n", "\n[Wands]\n"));
-                               break;
-                       case 2:
-                               tval = TV_ROD;
-                               fprintf(fff, _("\n[ロッド]\n", "\n[Rods]\n"));
-                               break;
-                       }
-
-                       /* Get magic device names that were eaten */
-                       for (OBJECT_SUBTYPE_VALUE i = 0; i < EATER_EXT; i++)
-                       {
-                               int idx = EATER_EXT * ext + i;
-                               int magic_num = creature_ptr->magic_num2[idx];
-                               if (!magic_num) continue;
-
-                               KIND_OBJECT_IDX 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)
-                       {
-                               fputs(_("  (なし)\n", "  (none)\n"), fff);
-                               continue;
-                       }
-
-                       OBJECT_SUBTYPE_VALUE i;
-                       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);
-               }
-
-               return;
-       }
-
-       if (creature_ptr->pclass == CLASS_SMITH)
-       {
-               int i, id[250], n = 0, row;
-
-               fprintf(fff, _("\n\n  [手に入れたエッセンス]\n\n", "\n\n  [Get Essence]\n\n"));
-               fprintf(fff, _("エッセンス   個数     エッセンス   個数     エッセンス   個数",
-                       "Essence      Num      Essence      Num      Essence      Num "));
-               for (i = 0; essence_name[i]; i++)
-               {
-                       if (!essence_name[i][0]) continue;
-                       id[n] = i;
-                       n++;
-               }
-
-               row = n / 3 + 1;
-
-               for (i = 0; i < row; i++)
-               {
-                       fprintf(fff, "\n");
-                       fprintf(fff, "%-11s %5d     ", essence_name[id[i]], (int)creature_ptr->magic_num1[id[i]]);
-                       if (i + row < n) fprintf(fff, "%-11s %5d     ", essence_name[id[i + row]], (int)creature_ptr->magic_num1[id[i + row]]);
-                       if (i + row * 2 < n) fprintf(fff, "%-11s %5d", essence_name[id[i + row * 2]], (int)creature_ptr->magic_num1[id[i + row * 2]]);
-               }
-
-               fputs("\n", fff);
-               return;
-       }
-
-       // Blue mage
-       int l1 = 0;
-       int l2 = 0;
-       int spellnum[MAX_MONSPELLS];
-       BIT_FLAGS f4 = 0, f5 = 0, f6 = 0;
-       char p[60][80];
-       int col = 0;
-       bool pcol = FALSE;
-
-       for (int i = 0; i < 60; i++)
-       {
-               p[i][0] = '\0';
-       }
-
-       strcat(p[col], _("\n\n  [学習済みの青魔法]\n", "\n\n  [Learned Blue Magic]\n"));
-
-       for (int j = 1; j < 6; j++)
-       {
-               col++;
-               set_rf_masks(&f4, &f5, &f6, j);
-               switch (j)
-               {
-               case MONSPELL_TYPE_BOLT:
-                       strcat(p[col], _("\n     [ボルト型]\n", "\n     [Bolt  Type]\n"));
-                       break;
-
-               case MONSPELL_TYPE_BALL:
-                       strcat(p[col], _("\n     [ボール型]\n", "\n     [Ball  Type]\n"));
-                       break;
-
-               case MONSPELL_TYPE_BREATH:
-                       strcat(p[col], _("\n     [ブレス型]\n", "\n     [  Breath  ]\n"));
-                       break;
-
-               case MONSPELL_TYPE_SUMMON:
-                       strcat(p[col], _("\n     [召喚魔法]\n", "\n     [Summonning]\n"));
-                       break;
-
-               case MONSPELL_TYPE_OTHER:
-                       strcat(p[col], _("\n     [ その他 ]\n", "\n     [Other Type]\n"));
-                       break;
-               }
-
-               int num = 0;
-               for (int i = 0; i < 32; i++)
-               {
-                       if ((0x00000001 << i) & f4) spellnum[num++] = i;
-               }
-
-               for (int i = 32; i < 64; i++)
-               {
-                       if ((0x00000001 << (i - 32)) & f5) spellnum[num++] = i;
-               }
-
-               for (int i = 64; i < 96; i++)
-               {
-                       if ((0x00000001 << (i - 64)) & f6) spellnum[num++] = i;
-               }
-
-               col++;
-               pcol = FALSE;
-               strcat(p[col], "       ");
-
-               for (int i = 0; i < num; i++)
-               {
-                       if (creature_ptr->magic_num2[spellnum[i]] == 0) continue;
-
-                       pcol = TRUE;
-                       /* Dump blue magic */
-                       l1 = strlen(p[col]);
-                       l2 = strlen(monster_powers_short[spellnum[i]]);
-                       if ((l1 + l2) >= 75)
-                       {
-                               strcat(p[col], "\n");
-                               col++;
-                               strcat(p[col], "       ");
-                       }
-
-                       strcat(p[col], monster_powers_short[spellnum[i]]);
-                       strcat(p[col], ", ");
-               }
-
-               if (!pcol)
-               {
-                       strcat(p[col], _("なし", "None"));
-                       strcat(p[col], "\n");
-                       continue;
-               }
-
-               if (p[col][strlen(p[col]) - 2] == ',')
-               {
-                       p[col][strlen(p[col]) - 2] = '\0';
-               }
-               else
-               {
-                       p[col][strlen(p[col]) - 10] = '\0';
-               }
-
-               strcat(p[col], "\n");
-       }
-
-       for (int i = 0; i <= col; i++)
-       {
-               fputs(p[i], fff);
-       }
-}
-
-
-/*!
- * @brief クエスト情報をファイルにダンプする
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_quest(player_type *creature_ptr, FILE *fff)
-{
-       fprintf(fff, _("\n\n  [クエスト情報]\n", "\n\n  [Quest Information]\n"));
-       QUEST_IDX *quest_num;
-       C_MAKE(quest_num, max_q_idx, QUEST_IDX);
-
-       for (QUEST_IDX i = 1; i < max_q_idx; i++)
-               quest_num[i] = i;
-       int dummy;
-       ang_sort(quest_num, &dummy, max_q_idx, ang_sort_comp_quest_num, ang_sort_swap_quest_num);
-
-       fputc('\n', fff);
-       do_cmd_knowledge_quests_completed(creature_ptr, fff, quest_num);
-       fputc('\n', fff);
-       do_cmd_knowledge_quests_failed(creature_ptr, fff, quest_num);
-       fputc('\n', fff);
-
-       C_KILL(quest_num, max_q_idx, QUEST_IDX);
-}
-
-
-/*!
- * @brief 死の直前メッセージ並びに遺言をファイルにダンプする
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_last_message(player_type *creature_ptr, FILE *fff)
-{
-       if (!creature_ptr->is_dead) return;
-
-       if (!current_world_ptr->total_winner)
-       {
-               fprintf(fff, _("\n  [死ぬ直前のメッセージ]\n\n", "\n  [Last Messages]\n\n"));
-               for (int i = MIN(message_num(), 30); i >= 0; i--)
-               {
-                       fprintf(fff, "> %s\n", message_str((s16b)i));
-               }
-
-               fputc('\n', fff);
-               return;
-       }
-
-       if (creature_ptr->last_message)
-       {
-               fprintf(fff, _("\n  [*勝利*メッセージ]\n\n", "\n  [*Winning* Message]\n\n"));
-               fprintf(fff, "  %s\n", creature_ptr->last_message);
-               fputc('\n', fff);
-       }
-}
-
-
-/*!
- * @brief 帰還場所情報をファイルにダンプする
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_recall(FILE *fff)
-{
-       fprintf(fff, _("\n  [帰還場所]\n\n", "\n  [Recall Depth]\n\n"));
-       for (int y = 1; y < current_world_ptr->max_d_idx; y++)
-       {
-               bool seiha = FALSE;
-
-               if (!d_info[y].maxdepth) continue;
-               if (!max_dlv[y]) continue;
-               if (d_info[y].final_guardian)
-               {
-                       if (!r_info[d_info[y].final_guardian].max_num) seiha = TRUE;
-               }
-               else if (max_dlv[y] == d_info[y].maxdepth) seiha = TRUE;
-
-               fprintf(fff, _("   %c%-12s: %3d 階\n", "   %c%-16s: level %3d\n"),
-                       seiha ? '!' : ' ', d_name + d_info[y].name, (int)max_dlv[y]);
-       }
-}
-
-
-/*!
- * @brief オプション情報をファイルにダンプする
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_options(FILE *fff)
-{
-       fprintf(fff, _("\n  [オプション設定]\n", "\n  [Option Settings]\n"));
-       if (preserve_mode)
-               fprintf(fff, _("\n 保存モード:         ON", "\n Preserve Mode:      ON"));
-
-       else
-               fprintf(fff, _("\n 保存モード:         OFF", "\n Preserve Mode:      OFF"));
-
-       if (ironman_small_levels)
-               fprintf(fff, _("\n 小さいダンジョン:   ALWAYS", "\n Small Levels:       ALWAYS"));
-       else if (always_small_levels)
-               fprintf(fff, _("\n 小さいダンジョン:   ON", "\n Small Levels:       ON"));
-       else if (small_levels)
-               fprintf(fff, _("\n 小さいダンジョン:   ENABLED", "\n Small Levels:       ENABLED"));
-       else
-               fprintf(fff, _("\n 小さいダンジョン:   OFF", "\n Small Levels:       OFF"));
-
-       if (vanilla_town)
-               fprintf(fff, _("\n 元祖の町のみ:       ON", "\n Vanilla Town:       ON"));
-       else if (lite_town)
-               fprintf(fff, _("\n 小規模な町:         ON", "\n Lite Town:          ON"));
-
-       if (ironman_shops)
-               fprintf(fff, _("\n 店なし:             ON", "\n No Shops:           ON"));
-
-       if (ironman_downward)
-               fprintf(fff, _("\n 階段を上がれない:   ON", "\n Diving Only:        ON"));
-
-       if (ironman_rooms)
-               fprintf(fff, _("\n 普通でない部屋:     ON", "\n Unusual Rooms:      ON"));
-
-       if (ironman_nightmare)
-               fprintf(fff, _("\n 悪夢モード:         ON", "\n Nightmare Mode:     ON"));
-
-       if (ironman_empty_levels)
-               fprintf(fff, _("\n アリーナ:           ALWAYS", "\n Arena Levels:       ALWAYS"));
-       else if (empty_levels)
-               fprintf(fff, _("\n アリーナ:           ENABLED", "\n Arena Levels:       ENABLED"));
-       else
-               fprintf(fff, _("\n アリーナ:           OFF", "\n Arena Levels:       OFF"));
-
-       fputc('\n', fff);
-
-       if (current_world_ptr->noscore)
-               fprintf(fff, _("\n 何か不正なことをしてしまっています。\n", "\n You have done something illegal.\n"));
-
-       fputc('\n', fff);
-}
-
-
-/*!
- * @brief 闘技場の情報をファイルにダンプする
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_arena(player_type *creature_ptr, FILE *fff)
-{
-       if (lite_town || vanilla_town) return;
-
-       if (creature_ptr->arena_number < 0)
-       {
-               if (creature_ptr->arena_number <= ARENA_DEFEATED_OLD_VER)
-               {
-                       fprintf(fff, _("\n 闘技場: 敗北\n", "\n Arena: Defeated\n"));
-               }
-               else
-               {
-#ifdef JP
-                       fprintf(fff, "\n 闘技場: %d回戦で%sの前に敗北\n", -creature_ptr->arena_number,
-                               r_name + r_info[arena_info[-1 - creature_ptr->arena_number].r_idx].name);
-#else
-                       fprintf(fff, "\n Arena: Defeated by %s in the %d%s fight\n",
-                               r_name + r_info[arena_info[-1 - creature_ptr->arena_number].r_idx].name,
-                               -creature_ptr->arena_number, get_ordinal_number_suffix(-creature_ptr->arena_number));
-#endif
-               }
-
-               fprintf(fff, "\n");
-               return;
-       }
-
-       if (creature_ptr->arena_number > MAX_ARENA_MONS + 2)
-       {
-               fprintf(fff, _("\n 闘技場: 真のチャンピオン\n", "\n Arena: True Champion\n"));
-               fprintf(fff, "\n");
-               return;
-       }
-
-       if (creature_ptr->arena_number > MAX_ARENA_MONS - 1)
-       {
-               fprintf(fff, _("\n 闘技場: チャンピオン\n", "\n Arena: Champion\n"));
-               fprintf(fff, "\n");
-               return;
-       }
-
-#ifdef JP
-       fprintf(fff, "\n 闘技場: %2d勝\n", (creature_ptr->arena_number > MAX_ARENA_MONS ? MAX_ARENA_MONS : creature_ptr->arena_number));
-#else
-       fprintf(fff, "\n Arena: %2d Victor%s\n", (creature_ptr->arena_number > MAX_ARENA_MONS ? MAX_ARENA_MONS : creature_ptr->arena_number), (creature_ptr->arena_number > 1) ? "ies" : "y");
-#endif
-       fprintf(fff, "\n");
-}
-
-
-/*!
- * @brief 撃破モンスターの情報をファイルにダンプする
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_monsters(FILE *fff)
-{
-       fprintf(fff, _("\n  [倒したモンスター]\n\n", "\n  [Defeated Monsters]\n\n"));
-
-       /* Allocate the "who" array */
-       MONRACE_IDX *who;
-       u16b why = 2;
-       C_MAKE(who, max_r_idx, MONRACE_IDX);
-
-       /* Count monster kills */
-       long uniq_total = 0;
-       long norm_total = 0;
-       for (IDX k = 1; k < max_r_idx; k++)
-       {
-               /* Ignore unused index */
-               monster_race *r_ptr = &r_info[k];
-               if (!r_ptr->name) continue;
-
-               if (r_ptr->flags1 & RF1_UNIQUE)
-               {
-                       bool dead = (r_ptr->max_num == 0);
-                       if (dead)
-                       {
-                               norm_total++;
-
-                               /* Add a unique monster to the list */
-                               who[uniq_total++] = k;
-                       }
-
-                       continue;
-               }
-
-               if (r_ptr->r_pkills > 0)
-               {
-                       norm_total += r_ptr->r_pkills;
-               }
-       }
-
-       /* No monsters is defeated */
-       if (norm_total < 1)
-       {
-               fprintf(fff, _("まだ敵を倒していません。\n", "You have defeated no enemies yet.\n"));
-               C_KILL(who, max_r_idx, s16b);
-               return;
-       }
-
-       /* Defeated more than one normal monsters */
-       if (uniq_total == 0)
-       {
-#ifdef JP
-               fprintf(fff, "%ld体の敵を倒しています。\n", norm_total);
-#else
-               fprintf(fff, "You have defeated %ld %s.\n", norm_total, norm_total == 1 ? "enemy" : "enemies");
-#endif
-               C_KILL(who, max_r_idx, s16b);
-               return;
-       }
-
-       /* Defeated more than one unique monsters */
-#ifdef JP
-       fprintf(fff, "%ld体のユニーク・モンスターを含む、合計%ld体の敵を倒しています。\n", uniq_total, norm_total);
-#else
-       fprintf(fff, "You have defeated %ld %s including %ld unique monster%s in total.\n", norm_total, norm_total == 1 ? "enemy" : "enemies", uniq_total, (uniq_total == 1 ? "" : "s"));
-#endif
-
-       /* Sort the array by dungeon depth of monsters */
-       ang_sort(who, &why, uniq_total, ang_sort_comp_hook, ang_sort_swap_hook);
-       fprintf(fff, _("\n《上位%ld体のユニーク・モンスター》\n", "\n< Unique monsters top %ld >\n"), MIN(uniq_total, 10));
-
-       for (IDX k = uniq_total - 1; k >= 0 && k >= uniq_total - 10; k--)
-       {
-               monster_race *r_ptr = &r_info[who[k]];
-               fprintf(fff, _("  %-40s (レベル%3d)\n", "  %-40s (level %3d)\n"), (r_name + r_ptr->name), (int)r_ptr->level);
-       }
-
-       C_KILL(who, max_r_idx, s16b);
-}
-
-
-/*!
- * @brief 元種族情報をファイルにダンプする
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_race_history(player_type *creature_ptr, FILE *fff)
-{
-       if (!creature_ptr->old_race1 && !creature_ptr->old_race2) return;
-
-       fprintf(fff, _("\n\n あなたは%sとして生まれた。", "\n\n You were born as %s."), race_info[creature_ptr->start_race].title);
-       for (int i = 0; i < MAX_RACES; i++)
-       {
-               if (creature_ptr->start_race == i) continue;
-               if (i < 32)
-               {
-                       if (!(creature_ptr->old_race1 & 1L << i)) continue;
-               }
-               else
-               {
-                       if (!(creature_ptr->old_race2 & 1L << (i - 32))) continue;
-               }
-
-               fprintf(fff, _("\n あなたはかつて%sだった。", "\n You were a %s before."), race_info[i].title);
-       }
-
-       fputc('\n', fff);
-}
-
-
-/*!
- * @brief 元魔法領域情報をファイルにダンプする
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_realm_history(player_type *creature_ptr, FILE *fff)
-{
-       if (creature_ptr->old_realm) return;
-
-       fputc('\n', fff);
-       for (int i = 0; i < MAX_MAGIC; i++)
-       {
-               if (!(creature_ptr->old_realm & 1L << i)) continue;
-               fprintf(fff, _("\n あなたはかつて%s魔法を使えた。", "\n You were able to use %s magic before."), realm_names[i + 1]);
-       }
-
-       fputc('\n', fff);
-}
-
-
-/*!
- * @brief 徳の情報をファイルにダンプする
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_virtues(player_type *creature_ptr, FILE *fff)
-{
-       fprintf(fff, _("\n\n  [自分に関する情報]\n\n", "\n\n  [HP-rate & Max stat & Virtues]\n\n"));
-
-       int percent = (int)(((long)creature_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
-               (2 * creature_ptr->hitdie +
-               ((PY_MAX_LEVEL - 1 + 3) * (creature_ptr->hitdie + 1))));
-
-#ifdef JP
-       if (creature_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "現在の体力ランク : %d/100\n\n", percent);
-       else fprintf(fff, "現在の体力ランク : ???\n\n");
-       fprintf(fff, "能力の最大値\n");
-#else
-       if (creature_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
-       else fprintf(fff, "Your current Life Rating is ???.\n\n");
-       fprintf(fff, "Limits of maximum stats\n");
-#endif
-       for (int v_nr = 0; v_nr < A_MAX; v_nr++)
-       {
-               if ((creature_ptr->knowledge & KNOW_STAT) || creature_ptr->stat_max[v_nr] == creature_ptr->stat_max_max[v_nr]) fprintf(fff, "%s 18/%d\n", stat_names[v_nr], creature_ptr->stat_max_max[v_nr] - 18);
-               else fprintf(fff, "%s ???\n", stat_names[v_nr]);
-       }
-
-       fprintf(fff, _("\n属性 : %s\n", "\nYour alignment : %s\n"), your_alignment(creature_ptr));
-       fprintf(fff, "\n");
-       dump_virtues(creature_ptr, fff);
-}
-
-
-/*!
- * @brief 突然変異の情報をファイルにダンプする
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_mutations(player_type *creature_ptr, FILE *fff)
-{
-       if (creature_ptr->muta1 || creature_ptr->muta2 || creature_ptr->muta3)
-       {
-               fprintf(fff, _("\n\n  [突然変異]\n\n", "\n\n  [Mutations]\n\n"));
-               dump_mutations(creature_ptr, fff);
-       }
-}
-
-
-/*!
- * @brief 所持品の情報をファイルにダンプする
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_equipment_inventory(player_type *creature_ptr, FILE *fff)
-{
-       GAME_TEXT o_name[MAX_NLEN];
-       if (creature_ptr->equip_cnt)
-       {
-               fprintf(fff, _("  [キャラクタの装備]\n\n", "  [Character Equipment]\n\n"));
-               for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
-               {
-                       object_desc(creature_ptr, o_name, &creature_ptr->inventory_list[i], 0);
-                       if ((((i == INVEN_RARM) && creature_ptr->hidarite) || ((i == INVEN_LARM) && creature_ptr->migite)) && creature_ptr->ryoute)
-                               strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
-
-                       fprintf(fff, "%c) %s\n",
-                               index_to_label(i), o_name);
-               }
-
-               fprintf(fff, "\n\n");
-       }
-
-       fprintf(fff, _("  [キャラクタの持ち物]\n\n", "  [Character Inventory]\n\n"));
-
-       for (int i = 0; i < INVEN_PACK; i++)
-       {
-               if (!creature_ptr->inventory_list[i].k_idx) break;
-               object_desc(creature_ptr, o_name, &creature_ptr->inventory_list[i], 0);
-               fprintf(fff, "%c) %s\n", index_to_label(i), o_name);
-       }
-
-       fprintf(fff, "\n\n");
-}
-
-
-/*!
- * @brief 我が家と博物館のオブジェクト情報をファイルにダンプする
- * @param fff ファイルポインタ
- * @return なし
- */
-static void dump_aux_home_museum(player_type *creature_ptr, FILE *fff)
-{
-       store_type  *st_ptr;
-       st_ptr = &town_info[1].store[STORE_HOME];
-
-       GAME_TEXT o_name[MAX_NLEN];
-       if (st_ptr->stock_num)
-       {
-               fprintf(fff, _("  [我が家のアイテム]\n", "  [Home Inventory]\n"));
-
-               TERM_LEN x = 1;
-               for (int i = 0; i < st_ptr->stock_num; i++)
-               {
-                       if ((i % 12) == 0)
-                               fprintf(fff, _("\n ( %d ページ )\n", "\n ( page %d )\n"), x++);
-                       object_desc(creature_ptr, o_name, &st_ptr->stock[i], 0);
-                       fprintf(fff, "%c) %s\n", I2A(i % 12), o_name);
-               }
-
-               fprintf(fff, "\n\n");
-       }
-
-       st_ptr = &town_info[1].store[STORE_MUSEUM];
-
-       if (st_ptr->stock_num == 0) return;
-
-       fprintf(fff, _("  [博物館のアイテム]\n", "  [Museum]\n"));
-
-       TERM_LEN x = 1;
-       for (int i = 0; i < st_ptr->stock_num; i++)
-       {
-#ifdef JP
-               if ((i % 12) == 0) fprintf(fff, "\n ( %d ページ )\n", x++);
-               object_desc(creature_ptr, o_name, &st_ptr->stock[i], 0);
-               fprintf(fff, "%c) %s\n", I2A(i % 12), o_name);
-#else
-               if ((i % 12) == 0) fprintf(fff, "\n ( page %d )\n", x++);
-               object_desc(creature_ptr, o_name, &st_ptr->stock[i], 0);
-               fprintf(fff, "%c) %s\n", I2A(i % 12), o_name);
-#endif
-       }
-
-       fprintf(fff, "\n\n");
-}
-
-
-/*!
- * @brief ダンプ出力のメインルーチン
- * Output the character dump to a file
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param fff ファイルポインタ
- * @return エラーコード
- */
-errr make_character_dump(player_type *creature_ptr, FILE *fff)
-{
-#ifdef JP
-       fprintf(fff, "  [変愚蛮怒 %d.%d.%d キャラクタ情報]\n\n",
-               FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
-#else
-       fprintf(fff, "  [Hengband %d.%d.%d Character Dump]\n\n",
-               FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
-#endif
-       update_playtime();
-
-       dump_aux_display_player(creature_ptr, fff);
-       dump_aux_last_message(creature_ptr, fff);
-       dump_aux_options(fff);
-       dump_aux_recall(fff);
-       dump_aux_quest(creature_ptr, fff);
-       dump_aux_arena(creature_ptr, fff);
-       dump_aux_monsters(fff);
-       dump_aux_virtues(creature_ptr, fff);
-       dump_aux_race_history(creature_ptr, fff);
-       dump_aux_realm_history(creature_ptr, fff);
-       dump_aux_class_special(creature_ptr, fff);
-       dump_aux_mutations(creature_ptr, fff);
-       dump_aux_pet(creature_ptr, fff);
-       fputs("\n\n", fff);
-       dump_aux_equipment_inventory(creature_ptr, fff);
-       dump_aux_home_museum(creature_ptr, fff);
-
-       fprintf(fff, _("  [チェックサム: \"%s\"]\n\n", "  [Check Sum: \"%s\"]\n\n"), get_check_sum());
-       return 0;
-}
-
-
-/*!
- * @brief プレイヤーステータスをファイルダンプ出力する
- * Hack -- Dump a character description file
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param name 出力ファイル名
- * @return エラーコード
- * @details
- * Allow the "full" flag to dump additional info,
- * and trigger its usage from various places in the code.
- */
-errr file_character(player_type *creature_ptr, concptr name)
-{
-       char buf[1024];
-       path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
-
-       FILE_TYPE(FILE_TYPE_TEXT);
-
-       int     fd = fd_open(buf, O_RDONLY);
-       if (fd >= 0)
-       {
-               char out_val[160];
-               (void)fd_close(fd);
-               (void)sprintf(out_val, _("現存するファイル %s に上書きしますか? ", "Replace existing file %s? "), buf);
-               if (get_check_strict(out_val, CHECK_NO_HISTORY)) fd = -1;
-       }
-
-       FILE *fff = NULL;
-       if (fd < 0) fff = my_fopen(buf, "w");
-
-       if (!fff)
-       {
-               prt(_("キャラクタ情報のファイルへの書き出しに失敗しました!", "Character dump failed!"), 0, 0);
-               (void)inkey();
-               return -1;
-       }
-
-       (void)make_character_dump(creature_ptr, fff);
-       my_fclose(fff);
-       msg_print(_("キャラクタ情報のファイルへの書き出しに成功しました。", "Character dump successful."));
-       msg_print(NULL);
-       return 0;
-}
-
-
-/*!
- * @brief ファイル内容の一行をコンソールに出力する
- * Display single line of on-line help file
- * @param str 出力する文字列
- * @param cy コンソールの行
- * @param shower 確認中
- * @return なし
- * @details
- * <pre>
- * You can insert some special color tag to change text color.
- * Such as...
- * WHITETEXT [[[[y|SOME TEXT WHICH IS DISPLAYED IN YELLOW| WHITETEXT
- * A colored segment is between "[[[[y|" and the last "|".
- * You can use any single character in place of the "|".
- * </pre>
- */
-static void show_file_aux_line(concptr str, int cy, concptr shower)
-{
-       char lcstr[1024];
-       if (shower)
+       char lcstr[1024];
+       if (shower)
        {
                strcpy(lcstr, str);
                str_tolower(lcstr);
@@ -3884,25 +2373,17 @@ static void show_file_aux_line(concptr str, int cy, concptr shower)
                int bracketcol = len + 1;
                int endcol = len;
                concptr ptr;
-
-               /* Search for a shower string in the line */
                if (shower)
                {
                        ptr = my_strstr(&lcstr[i], shower);
                        if (ptr) showercol = ptr - &lcstr[i];
                }
 
-               /* Search for a color segment tag */
                ptr = in_tag ? my_strchr(&str[i], in_tag) : my_strstr(&str[i], tag_str);
                if (ptr) bracketcol = ptr - &str[i];
-
-               /* A color tag is found */
                if (bracketcol < endcol) endcol = bracketcol;
-
-               /* The shower string is found before the color tag */
                if (showercol < endcol) endcol = showercol;
 
-               /* Print a segment of the line */
                Term_addstr(endcol, color, &str[i]);
                cx += endcol;
                i += endcol;
@@ -3910,8 +2391,6 @@ static void show_file_aux_line(concptr str, int cy, concptr shower)
                if (endcol == showercol)
                {
                        int showerlen = strlen(shower);
-
-                       /* Print the shower string in yellow */
                        Term_addstr(showerlen, TERM_YELLOW, &str[i]);
                        cx += showerlen;
                        i += showerlen;
@@ -3922,30 +2401,17 @@ static void show_file_aux_line(concptr str, int cy, concptr shower)
 
                if (in_tag)
                {
-                       /* Found the end of colored segment */
                        i++;
-
-                       /* Now looking for an another tag_str */
                        in_tag = '\0';
-
-                       /* Set back to the default color */
                        color = TERM_WHITE;
                        continue;
                }
 
-               /* Found a tag_str, and get a tag color */
                i += sizeof(tag_str) - 1;
-
-               /* Get tag color */
                color = color_char_to_attr(str[i]);
-
-               /* Illegal color tag */
                if (color == 255 || str[i + 1] == '\0')
                {
-                       /* Illegal color tag */
                        color = TERM_WHITE;
-
-                       /* Print the broken tag as a string */
                        Term_addstr(-1, TERM_WHITE, tag_str);
                        cx += sizeof(tag_str) - 1;
                        continue;
@@ -3979,7 +2445,7 @@ static void show_file_aux_line(concptr str, int cy, concptr shower)
  */
 bool show_file(player_type *creature_ptr, bool show_version, concptr name, concptr what, int line, BIT_FLAGS mode)
 {
-       int i, n, skey;
+       int i, skey;
        int next = 0;
        int size = 0;
        int back = 0;
@@ -3997,9 +2463,9 @@ bool show_file(player_type *creature_ptr, bool show_version, concptr name, concp
        char buf[1024];
        char hook[68][32];
        bool reverse = (line < 0);
-       int wid, hgt, rows;
+       int wid, hgt;
        Term_get_size(&wid, &hgt);
-       rows = hgt - 4;
+       int rows = hgt - 4;
 
        strcpy(finder_str, "");
        strcpy(shower_str, "");
@@ -4010,7 +2476,7 @@ bool show_file(player_type *creature_ptr, bool show_version, concptr name, concp
        }
 
        strcpy(filename, name);
-       n = strlen(filename);
+       int n = strlen(filename);
 
        for (i = 0; i < n; i++)
        {
@@ -4353,9 +2819,7 @@ bool show_file(player_type *creature_ptr, bool show_version, concptr name, concp
        }
 
        my_fclose(fff);
-       if (skey == 'q') return FALSE;
-
-       return TRUE;
+       return (skey != 'q');
 }
 
 
@@ -4447,8 +2911,7 @@ void process_player_name(player_type *creature_ptr, bool sf)
 #endif
        if (!savefile_base[0] && savefile[0])
        {
-               concptr s;
-               s = savefile;
+               concptr s = savefile;
                while (TRUE)
                {
                        concptr t;
@@ -4467,7 +2930,6 @@ void process_player_name(player_type *creature_ptr, bool sf)
        if (sf)
        {
                char temp[128];
-
                strcpy(savefile_base, creature_ptr->base_name);
 
 #ifdef SAVEFILE_USE_UID
@@ -4594,12 +3056,8 @@ void do_cmd_save_and_exit(player_type *creature_ptr)
  * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @details
- * <pre>
  * This routine is called only in very rare situations, and only
  * by certain visual systems, when they experience fatal errors.
- * XXX XXX Hack -- clear the death flag when creating a HANGUP
- * save file so that player can see tombstone when restart.
- * </pre>
  */
 void exit_game_panic(player_type *creature_ptr)
 {
@@ -4848,54 +3306,31 @@ errr counts_write(player_type *creature_ptr, int where, u32b count)
        char buf[1024];
        path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, _("z_info_j.raw", "z_info.raw"));
 
-       /* Grab permissions */
        safe_setuid_grab();
-
        int fd = fd_open(buf, O_RDWR);
-
-       /* Drop permissions */
        safe_setuid_drop();
-
        if (fd < 0)
        {
-               /* File type is "DATA" */
                FILE_TYPE(FILE_TYPE_DATA);
-
-               /* Grab permissions */
                safe_setuid_grab();
-
-               /* Create a new high score file */
                fd = fd_make(buf, 0644);
-
-               /* Drop permissions */
                safe_setuid_drop();
        }
 
-       /* Grab permissions */
        safe_setuid_grab();
-
        errr err = fd_lock(fd, F_WRLCK);
-
-       /* Drop permissions */
        safe_setuid_drop();
-
        if (err) return 1;
 
        counts_seek(creature_ptr, fd, where, TRUE);
        fd_write(fd, (char*)(&count), sizeof(u32b));
-
-       /* Grab permissions */
        safe_setuid_grab();
-
        err = fd_lock(fd, F_UNLCK);
-
-       /* Drop permissions */
        safe_setuid_drop();
 
        if (err) return 1;
 
        (void)fd_close(fd);
-
        return 0;
 }