OSDN Git Service

Merge branch '#39321' into For2.2.2-Refactoring
[hengband/hengband.git] / src / files.c
index a2b30b8..379e61b 100644 (file)
 
 
 #include "angband.h"
+#include "util.h"
+#include "files.h"
+#include "core.h"
+
+#include "birth.h"
+#include "files.h"
+
+#include "bldg.h"
+
+#include "cmd-magiceat.h"
+#include "cmd-dump.h"
 #include "world.h"
+#include "player-race.h"
 #include "player-status.h"
+#include "player-move.h"
+#include "player-class.h"
+#include "player-skill.h"
+#include "player-personality.h"
+#include "player-sex.h"
+#include "player-effects.h"
 #include "sort.h"
 #include "mutation.h"
 #include "quest.h"
 #include "artifact.h"
 #include "avatar.h"
 #include "shoot.h"
-#include "player-move.h"
 #include "patron.h"
 #include "monster.h"
+#include "monster-process.h"
 #include "monster-status.h"
 #include "object-flavor.h"
 #include "object-hook.h"
+#include "realm.h"
 #include "realm-hex.h"
 #include "cmd-pet.h"
 #include "spells.h"
 #include "term.h"
 #include "view-mainwindow.h"
+#include "floor-events.h"
+#include "floor-town.h"
+#include "dungeon-file.h"
+#include "init.h"
+#include "monster-spell.h"
+#include "floor.h"
+#include "dungeon.h"
+#include "melee.h"
+#include "objectkind.h"
+#include "autopick.h"
+#include "save.h"
+#include "realm-song.h"
+
+concptr ANGBAND_DIR; //!< Path name: The main "lib" directory This variable is not actually used anywhere in the code
+concptr ANGBAND_DIR_APEX; //!< High score files (binary) These files may be portable between platforms
+concptr ANGBAND_DIR_BONE; //!< Bone files for player ghosts (ascii) These files are portable between platforms
+concptr ANGBAND_DIR_DATA; //!< Binary image files for the "*_info" arrays (binary) These files are not portable between platforms
+concptr ANGBAND_DIR_EDIT; //!< Textual template files for the "*_info" arrays (ascii) These files are portable between platforms
+concptr ANGBAND_DIR_SCRIPT; //!< Script files These files are portable between platforms.
+concptr ANGBAND_DIR_FILE; //!< Various extra files (ascii) These files may be portable between platforms
+concptr ANGBAND_DIR_HELP; //!< Help files (normal) for the online help (ascii) These files are portable between platforms
+concptr ANGBAND_DIR_INFO; //!< Help files (spoilers) for the online help (ascii) These files are portable between platforms
+concptr ANGBAND_DIR_PREF; //!< Default user "preference" files (ascii) These files are rarely portable between platforms
+concptr ANGBAND_DIR_SAVE; //!< Savefiles for current characters (binary)
+concptr ANGBAND_DIR_USER; //!< User "preference" files (ascii) These files are rarely portable between platforms
+concptr ANGBAND_DIR_XTRA; //!< Various extra files (binary) These files are rarely portable between platforms
+
+s16b signal_count;             /* Hack -- Count interupts */
+
+/*
+ * Buffer to hold the current savefile name
+ * 'savefile' holds full path name. 'savefile_base' holds only base name.
+ */
+char savefile[1024];
+char savefile_base[40];
+
 
 
 /*
@@ -95,11 +150,11 @@ void safe_setuid_grab(void)
 
 #  ifdef SAFE_SETUID_POSIX
 
-       if (setuid(player_euid) != 0)
+       if (setuid(p_ptr->player_egid) != 0)
        {
                quit(_("setuid(): 正しく許可が取れません!", "setuid(): cannot set permissions correctly!"));
        }
-       if (setgid(player_egid) != 0)
+       if (setgid(p_ptr->player_egid) != 0)
        {
                quit(_("setgid(): 正しく許可が取れません!", "setgid(): cannot set permissions correctly!"));
        }
@@ -350,7 +405,7 @@ static named_num gf_desc[] =
  *   F:\<num\>:\<a\>:\<c\>
  * Specify the attr/char values for unaware "objects" by kind tval
  *   U:\<tv\>:\<a\>:\<c\>
- * Specify the attr/char values for inventory "objects" by kind tval
+ * Specify the attr/char values for p_ptr->inventory_list "objects" by kind tval
  *   E:\<tv\>:\<a\>:\<c\>
  * Define a macro action, given an encoded macro action
  *   A:\<str\>
@@ -514,7 +569,7 @@ errr process_pref_file_command(char *buf)
                        }
                        break;
 
-               /* Process "E:<tv>:<a>" -- attribute for inventory objects */
+               /* Process "E:<tv>:<a>" -- attribute for p_ptr->inventory_list objects */
                case 'E':
                        if (tokenize(buf+2, 2, zz, TOKENIZE_CHECKQUOTE) == 2)
                        {
@@ -588,7 +643,7 @@ errr process_pref_file_command(char *buf)
                                        int os = option_info[i].o_set;
                                        int ob = option_info[i].o_bit;
 
-                                       if ((p_ptr->playing || character_xtra) &&
+                                       if ((p_ptr->playing || current_world_ptr->character_xtra) &&
                                                (OPT_PAGE_BIRTH == option_info[i].o_page) && !p_ptr->wizard)
                                        {
                                                msg_format(_("初期オプションは変更できません! '%s'", "Birth options can not changed! '%s'"), buf);
@@ -1693,7 +1748,7 @@ static void display_player_melee_bonus(int hand, int hand_entry)
        char buf[160];
        HIT_PROB show_tohit = p_ptr->dis_to_h[hand];
        HIT_POINT show_todam = p_ptr->dis_to_d[hand];
-       object_type *o_ptr = &inventory[INVEN_RARM + hand];
+       object_type *o_ptr = &p_ptr->inventory_list[INVEN_RARM + hand];
 
        /* Hack -- add in weapon info if known */
        if (object_is_known(o_ptr)) show_tohit += o_ptr->to_h;
@@ -1728,7 +1783,7 @@ static void display_player_middle(void)
        HIT_POINT show_todam = 0;
 
        /* Range weapon */
-       object_type *o_ptr = &inventory[INVEN_BOW];
+       object_type *o_ptr = &p_ptr->inventory_list[INVEN_BOW];
 
        int tmul = 0;
        int e;
@@ -1772,9 +1827,9 @@ static void display_player_middle(void)
        /* Range attacks */
        display_player_one_line(ENTRY_SHOOT_HIT_DAM, format("(%+d,%+d)", show_tohit, show_todam), TERM_L_BLUE);
 
-       if (inventory[INVEN_BOW].k_idx)
+       if (p_ptr->inventory_list[INVEN_BOW].k_idx)
        {
-               tmul = bow_tmul(inventory[INVEN_BOW].sval);
+               tmul = bow_tmul(p_ptr->inventory_list[INVEN_BOW].sval);
 
                /* Get extra "power" from "extra might" */
                if (p_ptr->xtra_might) tmul++;
@@ -2049,7 +2104,7 @@ static void display_player_various(void)
        xthn = p_ptr->skill_thn + (p_ptr->to_h_m * BTH_PLUS_ADJ);
 
        /* Shooting Skill (with current bow and normal missile) */
-       o_ptr = &inventory[INVEN_BOW];
+       o_ptr = &p_ptr->inventory_list[INVEN_BOW];
        tmp = p_ptr->to_h_b + o_ptr->to_h;
        xthb = p_ptr->skill_thb + (tmp * BTH_PLUS_ADJ);
 
@@ -2106,7 +2161,7 @@ static void display_player_various(void)
                }
                else
                {
-                       o_ptr = &inventory[INVEN_RARM + i];
+                       o_ptr = &p_ptr->inventory_list[INVEN_RARM + i];
 
                        /* Average damage per round */
                        if (o_ptr->k_idx)
@@ -2260,8 +2315,8 @@ static void player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
                        add_flag(flgs, TR_SPEED);
                else
                {
-                       if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
-                           (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
+                       if ((!p_ptr->inventory_list[INVEN_RARM].k_idx || p_ptr->migite) &&
+                           (!p_ptr->inventory_list[INVEN_LARM].k_idx || p_ptr->hidarite))
                                add_flag(flgs, TR_SPEED);
                        if (p_ptr->lev>24)
                                add_flag(flgs, TR_FREE_ACT);
@@ -2688,7 +2743,7 @@ static void tim_player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
        if (IS_FAST() || p_ptr->slow)
                add_flag(flgs, TR_SPEED);
 
-       if (IS_OPPOSE_ACID() && !(p_ptr->special_defense & DEFENSE_ACID) && !(prace_is_(RACE_YEEK) && (p_ptr->lev > 19)))
+       if (IS_OPPOSE_ACID() && !(p_ptr->special_defense & DEFENSE_ACID) && !(PRACE_IS_(p_ptr, RACE_YEEK) && (p_ptr->lev > 19)))
                add_flag(flgs, TR_RES_ACID);
        if (IS_OPPOSE_ELEC() && !(p_ptr->special_defense & DEFENSE_ELEC))
                add_flag(flgs, TR_RES_ELEC);
@@ -2817,7 +2872,7 @@ void display_player_equippy(TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
        for (i = INVEN_RARM; i < max_i; i++)
        {
                /* Object */
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                a = object_attr(o_ptr);
                c = object_char(o_ptr);
@@ -2858,7 +2913,7 @@ static void known_obj_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
                object_type *o_ptr;
 
                /* Object */
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                if (!o_ptr->k_idx) continue;
 
@@ -2887,13 +2942,13 @@ static void player_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
        for (i = 0; i < TR_FLAG_SIZE; i++)
                flgs[i] = 0L;
 
-       if (prace_is_(RACE_SPECTRE))
+       if (PRACE_IS_(p_ptr, RACE_SPECTRE))
                add_flag(flgs, TR_RES_NETHER);
-       if (p_ptr->mimic_form == MIMIC_VAMPIRE || prace_is_(RACE_VAMPIRE))
+       if (p_ptr->mimic_form == MIMIC_VAMPIRE || PRACE_IS_(p_ptr, RACE_VAMPIRE))
                add_flag(flgs, TR_RES_DARK);
        if (p_ptr->mimic_form == MIMIC_DEMON_LORD)
                add_flag(flgs, TR_RES_FIRE);
-       else if (prace_is_(RACE_YEEK) && p_ptr->lev > 19)
+       else if (PRACE_IS_(p_ptr, RACE_YEEK) && p_ptr->lev > 19)
                add_flag(flgs, TR_RES_ACID);
 }
 
@@ -2946,11 +3001,11 @@ static void player_vuln_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
                add_flag(flgs, TR_RES_FIRE);
                add_flag(flgs, TR_RES_COLD);
        }
-       if (prace_is_(RACE_ANDROID))
+       if (PRACE_IS_(p_ptr, RACE_ANDROID))
                add_flag(flgs, TR_RES_ELEC);
-       if (prace_is_(RACE_ENT))
+       if (PRACE_IS_(p_ptr, RACE_ENT))
                add_flag(flgs, TR_RES_FIRE);
-       if (prace_is_(RACE_VAMPIRE) || prace_is_(RACE_S_FAIRY) ||
+       if (PRACE_IS_(p_ptr, RACE_VAMPIRE) || PRACE_IS_(p_ptr, RACE_S_FAIRY) ||
            (p_ptr->mimic_form == MIMIC_VAMPIRE))
                add_flag(flgs, TR_RES_LITE);
 }
@@ -3009,7 +3064,7 @@ static void display_flag_aux(TERM_LEN row, TERM_LEN col, concptr header,
                object_type *o_ptr;
 
                /* Object */
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                /* Known flags */
                object_flags_known(o_ptr, flgs);
@@ -3039,12 +3094,12 @@ static void display_flag_aux(TERM_LEN row, TERM_LEN col, concptr header,
                }
                else if (flag1 == TR_LITE_1)
                {
-                       if (have_dark_flag(flgs))
+                       if (HAVE_DARK_FLAG(flgs))
                        {
                                c_put_str(TERM_L_DARK, "+", row, col);
                                header_color = TERM_WHITE;
                        }
-                       else if (have_lite_flag(flgs))
+                       else if (HAVE_LITE_FLAG(flgs))
                        {
                                c_put_str(TERM_WHITE, "+", row, col);
                                header_color = TERM_WHITE;
@@ -3559,7 +3614,7 @@ static void display_player_stat_info(void)
                if ((p_ptr->stat_max[i] > 18) && (p_ptr->stat_top[i] <= 18))
                        e_adj = p_ptr->stat_top[i] - (p_ptr->stat_max[i] - 19) / 10 - 19;
 
-               if (prace_is_(RACE_ENT))
+               if (PRACE_IS_(p_ptr, RACE_ENT))
                {
                        switch (i)
                        {
@@ -3629,7 +3684,7 @@ static void display_player_stat_info(void)
        /* Process equipment */
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                /* Acquire "known" flags */
                object_flags_known(o_ptr, flgs);
@@ -3959,7 +4014,7 @@ void display_player(int mode)
 #endif
                                }
                        }
-                       else if (character_dungeon)
+                       else if (current_world_ptr->character_dungeon)
                        {
                                if (!current_floor_ptr->dun_level)
                                {
@@ -4183,7 +4238,7 @@ static void dump_aux_pet(FILE *fff)
        bool pet_settings = FALSE;
        GAME_TEXT pet_name[MAX_NLEN];
 
-       for (i = m_max - 1; i >= 1; i--)
+       for (i = current_floor_ptr->m_max - 1; i >= 1; i--)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
@@ -4840,12 +4895,12 @@ static void dump_aux_equipment_inventory(FILE *fff)
        GAME_TEXT o_name[MAX_NLEN];
 
        /* Dump the equipment */
-       if (equip_cnt)
+       if (p_ptr->equip_cnt)
        {
                fprintf(fff, _("  [キャラクタの装備]\n\n", "  [Character Equipment]\n\n"));
                for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
                {
-                       object_desc(o_name, &inventory[i], 0);
+                       object_desc(o_name, &p_ptr->inventory_list[i], 0);
                        if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
                                strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
 
@@ -4855,16 +4910,16 @@ static void dump_aux_equipment_inventory(FILE *fff)
                fprintf(fff, "\n\n");
        }
 
-       /* Dump the inventory */
+       /* Dump the p_ptr->inventory_list */
        fprintf(fff, _("  [キャラクタの持ち物]\n\n", "  [Character Inventory]\n\n"));
 
        for (i = 0; i < INVEN_PACK; i++)
        {
                /* Don't dump the empty slots */
-               if (!inventory[i].k_idx) break;
+               if (!p_ptr->inventory_list[i].k_idx) break;
 
-               /* Dump the inventory slots */
-               object_desc(o_name, &inventory[i], 0);
+               /* Dump the p_ptr->inventory_list slots */
+               object_desc(o_name, &p_ptr->inventory_list[i], 0);
                fprintf(fff, "%c) %s\n", index_to_label(i), o_name);
        }
 
@@ -5767,7 +5822,7 @@ void process_player_name(bool sf)
        int i, k = 0;
        char old_player_base[32] = "";
 
-       if (character_generated) strcpy(old_player_base, player_base);
+       if (current_world_ptr->character_generated) strcpy(old_player_base, p_ptr->base_name);
 
        /* Cannot be too long */
 #if defined(MACINTOSH) || defined(ACORN)
@@ -5812,7 +5867,7 @@ void process_player_name(bool sf)
                if (c == '.') c = '_';
 
                /* Accept all the letters */
-               player_base[k++] = c;
+               p_ptr->base_name[k++] = c;
        }
 
 #else
@@ -5829,35 +5884,35 @@ void process_player_name(bool sf)
                /* Accept some letters */
 #ifdef JP
                if(iskanji(c)){
-                 if(k + 2 >= sizeof(player_base) || !p_ptr->name[i+1]) break;
-                 player_base[k++] = c;
+                 if(k + 2 >= sizeof(p_ptr->base_name) || !p_ptr->name[i+1]) break;
+                 p_ptr->base_name[k++] = c;
                  i++;
-                 player_base[k++] = p_ptr->name[i];
+                 p_ptr->base_name[k++] = p_ptr->name[i];
                }
 #ifdef SJIS
-               else if (iskana(c)) player_base[k++] = c;
+               else if (iskana(c)) p_ptr->base_name[k++] = c;
 #endif
                else
 #endif
                /* Convert path separator to underscore */
                if (!strncmp(PATH_SEP, p_ptr->name+i, strlen(PATH_SEP))){
-                       player_base[k++] = '_';
+                       p_ptr->base_name[k++] = '_';
                        i += strlen(PATH_SEP);
                }
                /* Convert some characters to underscore */
 #if defined(WINDOWS)
-               else if (my_strchr("\"*,/:;<>?\\|", c)) player_base[k++] = '_';
+               else if (my_strchr("\"*,/:;<>?\\|", c)) p_ptr->base_name[k++] = '_';
 #endif
-               else if (isprint(c)) player_base[k++] = c;
+               else if (isprint(c)) p_ptr->base_name[k++] = c;
        }
 
 #endif
 
        /* Terminate */
-       player_base[k] = '\0';
+       p_ptr->base_name[k] = '\0';
 
        /* Require a "base" name */
-       if (!player_base[0]) strcpy(player_base, "PLAYER");
+       if (!p_ptr->base_name[0]) strcpy(p_ptr->base_name, "PLAYER");
 
 
 #ifdef SAVEFILE_MUTABLE
@@ -5889,14 +5944,14 @@ void process_player_name(bool sf)
        {
                char temp[128];
 
-               strcpy(savefile_base, player_base);
+               strcpy(savefile_base, p_ptr->base_name);
 
 #ifdef SAVEFILE_USE_UID
-               /* Rename the savefile, using the player_uid and player_base */
-               (void)sprintf(temp, "%d.%s", player_uid, player_base);
+               /* Rename the savefile, using the p_ptr->player_uid and p_ptr->base_name */
+               (void)sprintf(temp, "%d.%s", p_ptr->player_uid, p_ptr->base_name);
 #else
-               /* Rename the savefile, using the player_base */
-               (void)sprintf(temp, "%s", player_base);
+               /* Rename the savefile, using the p_ptr->base_name */
+               (void)sprintf(temp, "%s", p_ptr->base_name);
 #endif
 
                /* Build the filename */
@@ -5904,9 +5959,9 @@ void process_player_name(bool sf)
        }
 
        /* Load an autopick preference file */
-       if (character_generated)
+       if (current_world_ptr->character_generated)
        {
-               if (!streq(old_player_base, player_base)) autopick_load_pref(FALSE);
+               if (!streq(old_player_base, p_ptr->base_name)) autopick_load_pref(FALSE);
        }
 }
 
@@ -6016,7 +6071,7 @@ void do_cmd_save_game(int is_autosave)
        (void)strcpy(p_ptr->died_from, _("(元気に生きている)", "(alive and well)"));
 
        /* HACK -- don't get sanity blast on updating view */
-       is_loading_now = FALSE;
+       current_world_ptr->is_loading_now = FALSE;
 
        update_creature(p_ptr);
 
@@ -6024,7 +6079,7 @@ void do_cmd_save_game(int is_autosave)
        mproc_init();
 
        /* HACK -- reset the hackish flag */
-       is_loading_now = TRUE;
+       current_world_ptr->is_loading_now = TRUE;
 }
 
 
@@ -6042,70 +6097,6 @@ void do_cmd_save_and_exit(void)
 }
 
 
-/*!
- * @brief スコアを計算する /
- * Hack -- Calculates the total number of points earned                -JWT-
- * @return なし
- * @details
- */
-long total_points(void)
-{
-       int i, mult = 100;
-       DEPTH max_dl = 0;
-       u32b point, point_h, point_l;
-       int arena_win = MIN(p_ptr->arena_number, MAX_ARENA_MONS);
-
-       if (!preserve_mode) mult += 10;
-       if (!autoroller) mult += 10;
-       if (!smart_learn) mult -= 20;
-       if (smart_cheat) mult += 30;
-       if (ironman_shops) mult += 50;
-       if (ironman_small_levels) mult += 10;
-       if (ironman_empty_levels) mult += 20;
-       if (!powerup_home) mult += 50;
-       if (ironman_rooms) mult += 100;
-       if (ironman_nightmare) mult += 100;
-
-       if (mult < 5) mult = 5;
-
-       for (i = 0; i < max_d_idx; i++)
-               if(max_dlv[i] > max_dl)
-                       max_dl = max_dlv[i];
-
-       point_l = (p_ptr->max_max_exp + (100 * max_dl));
-       point_h = point_l / 0x10000L;
-       point_l = point_l % 0x10000L;
-       point_h *= mult;
-       point_l *= mult;
-       point_h += point_l / 0x10000L;
-       point_l %= 0x10000L;
-
-       point_l += ((point_h % 100) << 16);
-       point_h /= 100;
-       point_l /= 100;
-
-       point = (point_h << 16) + (point_l);
-       if (p_ptr->arena_number >= 0)
-               point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
-
-       if (ironman_downward) point *= 2;
-       if (p_ptr->pclass == CLASS_BERSERKER)
-       {
-               if ( p_ptr->prace == RACE_SPECTRE )
-                       point = point / 5;
-       }
-
-       if ((p_ptr->pseikaku == SEIKAKU_MUNCHKIN) && point)
-       {
-               point = 1;
-               if (p_ptr->total_winner) point = 2;
-       }
-       if (easy_band) point = (0 - point);
-
-       return point;
-}
-
-
 #define GRAVE_LINE_WIDTH 31
 
 /*!
@@ -6429,9 +6420,7 @@ void show_info(void)
        /* Hack -- Know everything in the inven/equip */
        for (i = 0; i < INVEN_TOTAL; i++)
        {
-               o_ptr = &inventory[i];
-
-               /* Skip non-objects */
+               o_ptr = &p_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
 
                /* Aware and Known */
@@ -6447,8 +6436,6 @@ void show_info(void)
                for (j = 0; j < st_ptr->stock_num; j++)
                {
                        o_ptr = &st_ptr->stock[j];
-
-                       /* Skip non-objects */
                        if (!o_ptr->k_idx) continue;
 
                        /* Aware and Known */
@@ -6497,30 +6484,30 @@ void show_info(void)
        update_playtime();
        display_player(0);
 
-       /* Prompt for inventory */
+       /* Prompt for p_ptr->inventory_list */
        prt(_("何かキーを押すとさらに情報が続きます (ESCで中断): ", "Hit any key to see more information (ESC to abort): "), 23, 0);
 
        /* Allow abort at this point */
        if (inkey() == ESCAPE) return;
 
 
-       /* Show equipment and inventory */
+       /* Show equipment and p_ptr->inventory_list */
 
        /* Equipment -- if any */
-       if (equip_cnt)
+       if (p_ptr->equip_cnt)
        {
                Term_clear();
-               (void)show_equip(0, USE_FULL);
+               (void)show_equip(0, USE_FULL, 0);
                prt(_("装備していたアイテム: -続く-", "You are using: -more-"), 0, 0);
 
                if (inkey() == ESCAPE) return;
        }
 
        /* Inventory -- if any */
-       if (inven_cnt)
+       if (p_ptr->inven_cnt)
        {
                Term_clear();
-               (void)show_inven(0, USE_FULL);
+               (void)show_inven(0, USE_FULL, 0);
                prt(_("持っていたアイテム: -続く-", "You are carrying: -more-"), 0, 0);
 
                if (inkey() == ESCAPE) return;
@@ -6567,71 +6554,6 @@ void show_info(void)
        }
 }
 
-/*!
- * @brief スコアファイル出力
- * Display some character info
- * @return なし
- */
-bool check_score(void)
-{
-       Term_clear();
-
-       /* No score file */
-       if (highscore_fd < 0)
-       {
-               msg_print(_("スコア・ファイルが使用できません。", "Score file unavailable."));
-               msg_print(NULL);
-               return FALSE;
-       }
-
-#ifndef SCORE_WIZARDS
-       /* Wizard-mode pre-empts scoring */
-       if (p_ptr->noscore & 0x000F)
-       {
-               msg_print(_("ウィザード・モードではスコアが記録されません。", "Score not registered for wizards."));
-               msg_print(NULL);
-               return FALSE;
-       }
-#endif
-
-#ifndef SCORE_BORGS
-       /* Borg-mode pre-empts scoring */
-       if (p_ptr->noscore & 0x00F0)
-       {
-               msg_print(_("ボーグ・モードではスコアが記録されません。", "Score not registered for borgs."));
-               msg_print(NULL);
-               return FALSE;
-       }
-#endif
-
-#ifndef SCORE_CHEATERS
-       /* Cheaters are not scored */
-       if (p_ptr->noscore & 0xFF00)
-       {
-               msg_print(_("詐欺をやった人はスコアが記録されません。", "Score not registered for cheaters."));
-               msg_print(NULL);
-               return FALSE;
-       }
-#endif
-
-       /* Interupted */
-       if (!p_ptr->total_winner && streq(p_ptr->died_from, _("強制終了", "Interrupting")))
-       {
-               msg_print(_("強制終了のためスコアが記録されません。", "Score not registered due to interruption."));
-               msg_print(NULL);
-               return FALSE;
-       }
-
-       /* Quitter */
-       if (!p_ptr->total_winner && streq(p_ptr->died_from, _("途中終了", "Quitting")))
-       {
-               msg_print(_("途中終了のためスコアが記録されません。", "Score not registered due to quitting."));
-               msg_print(NULL);
-               return FALSE;
-       }
-       return TRUE;
-}
-
 
 /*!
  * @brief 異常発生時のゲーム緊急終了処理 /
@@ -6648,7 +6570,7 @@ bool check_score(void)
 void exit_game_panic(void)
 {
        /* If nothing important has happened, just quit */
-       if (!character_generated || character_saved) quit(_("緊急事態", "panic"));
+       if (!current_world_ptr->character_generated || current_world_ptr->character_saved) quit(_("緊急事態", "panic"));
 
        /* Mega-Hack -- see "msg_print()" */
        msg_flag = FALSE;
@@ -6847,17 +6769,17 @@ errr process_histpref_file(concptr name)
 {
        char buf[1024];
        errr err = 0;
-       bool old_character_xtra = character_xtra;
+       bool old_character_xtra = current_world_ptr->character_xtra;
 
        /* Build the filename */
        path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
 
        /* Hack -- prevent modification birth options in this file */
-       character_xtra = TRUE;
+       current_world_ptr->character_xtra = TRUE;
 
        err = process_pref_file_aux(buf, PREF_TYPE_HISTPREF);
 
-       character_xtra = old_character_xtra;
+       current_world_ptr->character_xtra = old_character_xtra;
        return (err);
 }
 
@@ -6877,7 +6799,7 @@ static errr counts_seek(int fd, u32b where, bool flag)
        int i;
 
 #ifdef SAVEFILE_USE_UID
-       (void)sprintf(temp1, "%d.%s.%d%d%d", player_uid, savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
+       (void)sprintf(temp1, "%d.%s.%d%d%d", p_ptr->player_uid, savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
 #else
        (void)sprintf(temp1, "%s.%d%d%d", savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
 #endif
@@ -7068,7 +6990,7 @@ static void handle_signal_simple(int sig)
 
 
        /* Nothing to save, just quit */
-       if (!character_generated || character_saved) quit(NULL);
+       if (!current_world_ptr->character_generated || current_world_ptr->character_saved) quit(NULL);
 
 
        /* Count the signals */
@@ -7171,7 +7093,7 @@ static void handle_signal_abort(int sig)
 
 
        /* Nothing to save, just quit */
-       if (!character_generated || character_saved) quit(NULL);
+       if (!current_world_ptr->character_generated || current_world_ptr->character_saved) quit(NULL);
 
 
        forget_lite();