OSDN Git Service

[Refactor] #37353 ウィザードモードフラグ を player_type 構造体から world_type 構造体へ移動.
authordeskull <deskull@users.sourceforge.jp>
Sun, 18 Aug 2019 08:47:05 +0000 (17:47 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 18 Aug 2019 08:47:05 +0000 (17:47 +0900)
20 files changed:
src/artifact.c
src/birth.c
src/cmd/cmd-dump.c
src/cmd/cmd-gameoption.c
src/combat/melee1.c
src/core.c
src/files.c
src/load.c
src/monster-status.c
src/monster1.c
src/object2.c
src/player-move.c
src/player-status.c
src/player-status.h
src/realm-hex.c
src/save.c
src/spells3.c
src/targeting.c
src/view-mainwindow.c
src/world.h

index ed46d9c..35bf1df 100644 (file)
@@ -33,6 +33,7 @@
 #include "view-mainwindow.h"
 #include "player-class.h"
 #include "player-personality.h"
+#include "world.h"
 
  /*
   * The artifact arrays
@@ -1700,7 +1701,7 @@ bool become_random_artifact(object_type *o_ptr, bool a_scroll)
                                random_slay(o_ptr);
                                break;
                        default:
-                               if (p_ptr->wizard) msg_print("Switch error in become_random_artifact!");
+                               if (current_world_ptr->wizard) msg_print("Switch error in become_random_artifact!");
                                powers++;
                }
        };
index 2ec2288..b623ed4 100644 (file)
@@ -1799,7 +1799,7 @@ static void player_wipe_without_name(player_type *creature_ptr)
 
        /* Assume no cheating */
        creature_ptr->noscore = 0;
-       creature_ptr->wizard = FALSE;
+       current_world_ptr->wizard = FALSE;
 
        /* Not waiting to report score */
        creature_ptr->wait_report_score = FALSE;
index 6a20685..eb06ab4 100644 (file)
@@ -3427,7 +3427,7 @@ static KIND_OBJECT_IDX collect_objects(int grp_cur, KIND_OBJECT_IDX object_idx[]
                }
                else
                {
-                       if (!p_ptr->wizard)
+                       if (!current_world_ptr->wizard)
                        {
                                /* Skip non-flavoured objects */
                                if (!k_ptr->flavor) continue;
@@ -5202,9 +5202,9 @@ static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
                /* Hack -- visual_list mode */
                if (per_page == 1)
                {
-                       c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
+                       c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (current_world_ptr->wizard || visual_only) ? 56 : 61);
                }
-               if (p_ptr->wizard || visual_only)
+               if (current_world_ptr->wizard || visual_only)
                {
                        c_prt(attr, format("%d", r_idx), row + i, 62);
                }
@@ -5328,7 +5328,7 @@ static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX d
                        prt(format(_("%s - モンスター", "%s - monsters"), !visual_only ? _("知識", "Knowledge") : _("表示", "Visuals")), 2, 0);
                        if (direct_r_idx < 0) prt(_("グループ", "Group"), 4, 0);
                        prt(_("名前", "Name"), 4, max + 3);
-                       if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
+                       if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 62);
                        prt(_("文字", "Sym"), 4, 67);
                        if (!visual_only) prt(_("殺害数", "Kills"), 4, 72);
 
@@ -5534,9 +5534,9 @@ static void display_object_list(int col, int row, int per_page, IDX object_idx[]
                /* Hack -- visual_list mode */
                if (per_page == 1)
                {
-                       c_prt(attr, format("%02x/%02x", flavor_k_ptr->x_attr, flavor_k_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 64 : 68);
+                       c_prt(attr, format("%02x/%02x", flavor_k_ptr->x_attr, flavor_k_ptr->x_char), row + i, (current_world_ptr->wizard || visual_only) ? 64 : 68);
                }
-               if (p_ptr->wizard || visual_only)
+               if (current_world_ptr->wizard || visual_only)
                {
                        c_prt(attr, format("%d", k_idx), row + i, 70);
                }
@@ -5698,13 +5698,13 @@ static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX di
                        prt(format("%s - アイテム", !visual_only ? "知識" : "表示"), 2, 0);
                        if (direct_k_idx < 0) prt("グループ", 4, 0);
                        prt("名前", 4, max + 3);
-                       if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
+                       if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 70);
                        prt("文字", 4, 74);
 #else
                        prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
                        if (direct_k_idx < 0) prt("Group", 4, 0);
                        prt("Name", 4, max + 3);
-                       if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
+                       if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 70);
                        prt("Sym", 4, 75);
 #endif
 
@@ -5908,9 +5908,9 @@ static void display_feature_list(int col, int row, int per_page, FEAT_IDX *feat_
                        /* Display lighting level */
                        c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
 
-                       c_prt(attr, format("%02x/%02x", f_ptr->x_attr[lighting_level], f_ptr->x_char[lighting_level]), row_i, f_idx_col - ((p_ptr->wizard || visual_only) ? 6 : 2));
+                       c_prt(attr, format("%02x/%02x", f_ptr->x_attr[lighting_level], f_ptr->x_char[lighting_level]), row_i, f_idx_col - ((current_world_ptr->wizard || visual_only) ? 6 : 2));
                }
-               if (p_ptr->wizard || visual_only)
+               if (current_world_ptr->wizard || visual_only)
                {
                        c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
                }
@@ -6048,12 +6048,12 @@ static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX d
                        prt(_("名前", "Name"), 4, max + 3);
                        if (use_bigtile)
                        {
-                               if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
+                               if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 62);
                                prt(_("文字 ( l/ d)", "Sym ( l/ d)"), 4, 66);
                        }
                        else
                        {
-                               if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
+                               if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 64);
                                prt(_("文字 (l/d)", "Sym (l/d)"), 4, 68);
                        }
 
@@ -6774,7 +6774,7 @@ static void do_cmd_knowledge_quests(void)
        do_cmd_knowledge_quests_completed(fff, quest_num);
        fputc('\n', fff);
        do_cmd_knowledge_quests_failed(fff, quest_num);
-       if (p_ptr->wizard)
+       if (current_world_ptr->wizard)
        {
                fputc('\n', fff);
                do_cmd_knowledge_quests_wiz_random(fff);
index 49ea5c7..9b10cf6 100644 (file)
@@ -1307,7 +1307,7 @@ void do_cmd_options(void)
                case 'b':
                {
                        /* Spawn */
-                       do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ?
+                       do_cmd_options_aux(OPT_PAGE_BIRTH, (!current_world_ptr->wizard || !allow_debug_opts) ?
                                _("初期オプション(参照のみ)", "Birth Options(browse only)") :
                                _("初期オプション((*)はスコアに影響)", "Birth Options((*)s effect score)"));
                        break;
@@ -1476,7 +1476,7 @@ void do_cmd_options_aux(int page, concptr info)
        int     opt[24];
        char    buf[80];
        bool    browse_only = (page == OPT_PAGE_BIRTH) && current_world_ptr->character_generated &&
-               (!p_ptr->wizard || !allow_debug_opts);
+               (!current_world_ptr->wizard || !allow_debug_opts);
 
 
        /* Lookup the options */
index 48ab90b..703e533 100644 (file)
@@ -1543,7 +1543,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b
                                        {
                                                old_ptr = ma_ptr;
 
-                                               if (p_ptr->wizard && cheat_xtra)
+                                               if (current_world_ptr->wizard && cheat_xtra)
                                                {
                                                        msg_print(_("攻撃を再選択しました。", "Attack re-selected."));
                                                }
index cd22100..b81ce89 100644 (file)
@@ -3532,14 +3532,14 @@ static void process_command(void)
                /*** Wizard Commands ***/
                case KTRL('W'):
                {
-                       if (p_ptr->wizard)
+                       if (current_world_ptr->wizard)
                        {
-                               p_ptr->wizard = FALSE;
+                               current_world_ptr->wizard = FALSE;
                                msg_print(_("ウィザードモード解除。", "Wizard mode off."));
                        }
                        else if (enter_wizard_mode())
                        {
-                               p_ptr->wizard = TRUE;
+                               current_world_ptr->wizard = TRUE;
                                msg_print(_("ウィザードモード突入。", "Wizard mode on."));
                        }
                        p_ptr->update |= (PU_MONSTERS);
@@ -5479,7 +5479,7 @@ void play_game(bool new_game)
        {
                if (enter_wizard_mode())
                {
-                       p_ptr->wizard = TRUE;
+                       current_world_ptr->wizard = TRUE;
 
                        if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
                        {
@@ -5661,7 +5661,7 @@ void play_game(bool new_game)
                        else
                        {
                                /* Mega-Hack -- Allow player to cheat death */
-                               if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
+                               if ((current_world_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
                                {
                                        cheat_death(p_ptr);
                                }
index a30d739..2b9ed19 100644 (file)
@@ -645,7 +645,7 @@ errr process_pref_file_command(char *buf)
                                        int ob = option_info[i].o_bit;
 
                                        if ((p_ptr->playing || current_world_ptr->character_xtra) &&
-                                               (OPT_PAGE_BIRTH == option_info[i].o_page) && !p_ptr->wizard)
+                                               (OPT_PAGE_BIRTH == option_info[i].o_page) && !current_world_ptr->wizard)
                                        {
                                                msg_format(_("初期オプションは変更できません! '%s'", "Birth options can not changed! '%s'"), buf);
                                                msg_print(NULL);
index 7d1738d..e88136b 100644 (file)
@@ -1541,7 +1541,7 @@ static void rd_options(void)
 
        rd_u16b(&c);
 
-       if (c & 0x0002) p_ptr->wizard = TRUE;
+       if (c & 0x0002) current_world_ptr->wizard = TRUE;
 
        cheat_peek = (c & 0x0100) ? TRUE : FALSE;
        cheat_hear = (c & 0x0200) ? TRUE : FALSE;
index be8c671..e5c8fcb 100644 (file)
@@ -1034,7 +1034,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note)
 
        if (m_ptr->dealt_damage > m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100;
 
-       if (p_ptr->wizard)
+       if (current_world_ptr->wizard)
        {
                msg_format(_("合計%d/%dのダメージを与えた。", "You do %d (out of %d) damage."), m_ptr->dealt_damage, m_ptr->maxhp);
        }
index 0f46a4d..c1cdfe4 100644 (file)
@@ -2041,7 +2041,7 @@ void roff_top(MONRACE_IDX r_idx)
        Term_addstr(-1, TERM_WHITE, "'):");
 
        /* Wizards get extra info */
-       if (p_ptr->wizard)
+       if (current_world_ptr->wizard)
        {
                char buf[16];
 
@@ -2972,7 +2972,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                        chance = r_ptr->artifact_percent[i];
                }
 
-               if ((a_idx > 0) && ((randint0(100) < chance) || p_ptr->wizard))
+               if ((a_idx > 0) && ((randint0(100) < chance) || current_world_ptr->wizard))
                {
                        artifact_type *a_ptr = &a_info[a_idx];
 
index 5b08b82..4542b79 100644 (file)
@@ -4605,7 +4605,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION
 #else
                msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
 #endif
-               if (p_ptr->wizard) msg_print(_("(破損)", "(breakage)"));
+               if (current_world_ptr->wizard) msg_print(_("(破損)", "(breakage)"));
 
                /* Failure */
                return (0);
@@ -4704,7 +4704,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION
                msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
 #endif
 
-               if (p_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
+               if (current_world_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
 
                /* Failure */
                return (0);
@@ -4753,7 +4753,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION
                        msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
 #endif
 
-                       if (p_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
+                       if (current_world_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
 
                        /* Mega-Hack -- preserve artifacts */
                        if (preserve_mode)
@@ -4826,7 +4826,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION
                msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
 #endif
 
-               if (p_ptr->wizard) msg_print(_("(アイテムが多過ぎる)", "(too many objects)"));
+               if (current_world_ptr->wizard) msg_print(_("(アイテムが多過ぎる)", "(too many objects)"));
 
                /* Hack -- Preserve artifacts */
                if (object_is_fixed_artifact(j_ptr))
index 8ab9373..6060dc6 100644 (file)
@@ -573,7 +573,7 @@ bool pattern_seq(player_type *creature_ptr, POSITION c_y, POSITION c_x, POSITION
                                        ok_move = PATTERN_TILE_1;
                                        break;
                                default:
-                                       if (creature_ptr->wizard)
+                                       if (current_world_ptr->wizard)
                                                msg_format(_("おかしなパターン歩行、%d。", "Funny Pattern walking, %d."), pattern_type_cur);
 
                                        return TRUE; /* Goof-up */
index 47649ef..ef873ee 100644 (file)
@@ -5266,7 +5266,7 @@ void sanity_blast(player_type *creature_ptr, monster_type *m_ptr, bool necro)
 
                /* Demon characters are unaffected */
                if (PRACE_IS_(creature_ptr, RACE_IMP) || PRACE_IS_(creature_ptr, RACE_DEMON) || (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) return;
-               if (creature_ptr->wizard) return;
+               if (current_world_ptr->wizard) return;
 
                /* Undead characters are 50% likely to be unaffected */
                if (PRACE_IS_(creature_ptr, RACE_SKELETON) || PRACE_IS_(creature_ptr, RACE_ZOMBIE)
index 1f3df00..24ffbb2 100644 (file)
@@ -430,8 +430,6 @@ struct player_type
 
        bool reset_concent;   /* Concentration reset flag */
 
-       bool wizard;              /* Player is in wizard mode */
-
        MONSTER_IDX riding;              /* Riding on a monster of this index */
 
        #define KNOW_STAT   0x01
index 7bd99c7..f1f5a5c 100644 (file)
@@ -36,6 +36,7 @@
 #include "targeting.h"
 #include "realm-song.h"
 #include "view-mainwindow.h"
+#include "world.h"
 
 #define MAX_KEEP 4 /*!<呪術の最大詠唱数 */
 
@@ -543,7 +544,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
                                        project(0, rad, caster_ptr->y, caster_ptr->x, power, GF_HELL_FIRE,
                                                (PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
                                }
-                               if (caster_ptr->wizard)
+                               if (current_world_ptr->wizard)
                                {
                                        msg_format(_("%d点のダメージを返した。", "You return %d damages."), power);
                                }
@@ -1101,7 +1102,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
 
                                        fire_ball(GF_HELL_FIRE, dir, power, 1);
 
-                                       if (caster_ptr->wizard)
+                                       if (current_world_ptr->wizard)
                                        {
                                                msg_format(_("%d点のダメージを返した。", "You return %d damages."), power);
                                        }
index 84fff14..44ad47a 100644 (file)
@@ -484,7 +484,7 @@ static void wr_options(void)
 
        c = 0;
 
-       if (p_ptr->wizard) c |= 0x0002;
+       if (current_world_ptr->wizard) c |= 0x0002;
 
        if (cheat_sight) c |= 0x0040;
        if (cheat_turn) c |= 0x0080;
index 84b4671..d9787e5 100644 (file)
@@ -514,7 +514,7 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
                }
 
                /* Accept any grid when wizard mode */
-               if (p_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!current_floor_ptr->grid_array[y][x].m_idx || (current_floor_ptr->grid_array[y][x].m_idx == p_ptr->riding))) break;
+               if (current_world_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!current_floor_ptr->grid_array[y][x].m_idx || (current_floor_ptr->grid_array[y][x].m_idx == p_ptr->riding))) break;
 
                /* Accept teleportable floor grids */
                if (cave_player_teleportable_bold(y, x, mode)) break;
@@ -654,7 +654,7 @@ void teleport_level(MONSTER_IDX m_idx)
        if (randint0(100) < 50) go_up = TRUE;
        else go_up = FALSE;
 
-       if ((m_idx <= 0) && p_ptr->wizard)
+       if ((m_idx <= 0) && current_world_ptr->wizard)
        {
                if (get_check("Force to go up? ")) go_up = TRUE;
                else if (get_check("Force to go down? ")) go_up = FALSE;
@@ -2652,7 +2652,7 @@ void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y
        char buf[256];
        bool max = FALSE;
 
-       if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && p_ptr->wizard)
+       if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && current_world_ptr->wizard)
        msg_print(_("警告! print_spell が領域なしに呼ばれた", "Warning! print_spells called with null realm"));
 
        /* Title the list */
index 7e0a7a8..1460e67 100644 (file)
@@ -39,6 +39,7 @@
 #include "quest.h"
 #include "dungeon.h"
 #include "spells.h"
+#include "world.h"
 
 /*!
  * @brief コンソール上におけるマップ表示の左上位置を返す /
@@ -465,7 +466,7 @@ static void evaluate_monster_exp(char *buf, monster_type *m_ptr)
        }
        else if (!ap_r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG2_KAGE))
        {
-               if (!p_ptr->wizard)
+               if (!current_world_ptr->wizard)
                {
                        sprintf(buf,"??");
                        return;
@@ -974,7 +975,7 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, concptr info)
 #endif
 
                /* Display a message */
-               if (p_ptr->wizard)
+               if (current_world_ptr->wizard)
                {
                        char f_idx_str[32];
                        if (g_ptr->mimic) sprintf(f_idx_str, "%d/%d", g_ptr->feat, g_ptr->mimic);
index d907ed9..962b5d7 100644 (file)
@@ -745,7 +745,7 @@ static void prt_title(void)
        concptr p = "";
        GAME_TEXT str[14];
 
-       if (p_ptr->wizard)
+       if (current_world_ptr->wizard)
        {
                p = _("[ウィザード]", "[=-WIZARD-=]");
        }
@@ -1011,7 +1011,7 @@ static void prt_depth(void)
  */
 static void prt_hunger(void)
 {
-       if(p_ptr->wizard && p_ptr->inside_arena) return;
+       if(current_world_ptr->wizard && p_ptr->inside_arena) return;
 
        /* Fainting / Starving */
        if (p_ptr->food < PY_FOOD_FAINT)
@@ -1392,7 +1392,7 @@ static void health_redraw(bool riding)
 
        m_ptr = &current_floor_ptr->m_list[health_who];
 
-       if (p_ptr->wizard && p_ptr->phase_out)
+       if (current_world_ptr->wizard && p_ptr->phase_out)
        {
                row = ROW_INFO - 2;
                col = COL_INFO + 2;
index 1d4b485..c3c93ba 100644 (file)
@@ -55,9 +55,11 @@ typedef struct {
 
        bool creating_savefile;         /* New savefile is currently created */
 
+       bool wizard;              /* This world under wizard mode */
+
 
 } world_type;
 
 extern bool is_daytime(void);
 extern void extract_day_hour_min(int *day, int *hour, int *min);
-extern world_type *current_world_ptr;
\ No newline at end of file
+extern world_type *current_world_ptr;