• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision51d62e860115df9be4f5749d1cce2fb842029ecb (tree)
Time2019-08-18 17:47:05
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 ウィザードモードフラグ を player_type 構造体から world_type 構造体へ移動.

Change Summary

Incremental Difference

--- a/src/artifact.c
+++ b/src/artifact.c
@@ -33,6 +33,7 @@
3333 #include "view-mainwindow.h"
3434 #include "player-class.h"
3535 #include "player-personality.h"
36+#include "world.h"
3637
3738 /*
3839 * The artifact arrays
@@ -1700,7 +1701,7 @@ bool become_random_artifact(object_type *o_ptr, bool a_scroll)
17001701 random_slay(o_ptr);
17011702 break;
17021703 default:
1703- if (p_ptr->wizard) msg_print("Switch error in become_random_artifact!");
1704+ if (current_world_ptr->wizard) msg_print("Switch error in become_random_artifact!");
17041705 powers++;
17051706 }
17061707 };
--- a/src/birth.c
+++ b/src/birth.c
@@ -1799,7 +1799,7 @@ static void player_wipe_without_name(player_type *creature_ptr)
17991799
18001800 /* Assume no cheating */
18011801 creature_ptr->noscore = 0;
1802- creature_ptr->wizard = FALSE;
1802+ current_world_ptr->wizard = FALSE;
18031803
18041804 /* Not waiting to report score */
18051805 creature_ptr->wait_report_score = FALSE;
--- a/src/cmd/cmd-dump.c
+++ b/src/cmd/cmd-dump.c
@@ -3427,7 +3427,7 @@ static KIND_OBJECT_IDX collect_objects(int grp_cur, KIND_OBJECT_IDX object_idx[]
34273427 }
34283428 else
34293429 {
3430- if (!p_ptr->wizard)
3430+ if (!current_world_ptr->wizard)
34313431 {
34323432 /* Skip non-flavoured objects */
34333433 if (!k_ptr->flavor) continue;
@@ -5202,9 +5202,9 @@ static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
52025202 /* Hack -- visual_list mode */
52035203 if (per_page == 1)
52045204 {
5205- c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
5205+ c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (current_world_ptr->wizard || visual_only) ? 56 : 61);
52065206 }
5207- if (p_ptr->wizard || visual_only)
5207+ if (current_world_ptr->wizard || visual_only)
52085208 {
52095209 c_prt(attr, format("%d", r_idx), row + i, 62);
52105210 }
@@ -5328,7 +5328,7 @@ static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX d
53285328 prt(format(_("%s - モンスター", "%s - monsters"), !visual_only ? _("知識", "Knowledge") : _("表示", "Visuals")), 2, 0);
53295329 if (direct_r_idx < 0) prt(_("グループ", "Group"), 4, 0);
53305330 prt(_("名前", "Name"), 4, max + 3);
5331- if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
5331+ if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 62);
53325332 prt(_("文字", "Sym"), 4, 67);
53335333 if (!visual_only) prt(_("殺害数", "Kills"), 4, 72);
53345334
@@ -5534,9 +5534,9 @@ static void display_object_list(int col, int row, int per_page, IDX object_idx[]
55345534 /* Hack -- visual_list mode */
55355535 if (per_page == 1)
55365536 {
5537- 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);
5537+ 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);
55385538 }
5539- if (p_ptr->wizard || visual_only)
5539+ if (current_world_ptr->wizard || visual_only)
55405540 {
55415541 c_prt(attr, format("%d", k_idx), row + i, 70);
55425542 }
@@ -5698,13 +5698,13 @@ static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX di
56985698 prt(format("%s - アイテム", !visual_only ? "知識" : "表示"), 2, 0);
56995699 if (direct_k_idx < 0) prt("グループ", 4, 0);
57005700 prt("名前", 4, max + 3);
5701- if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
5701+ if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 70);
57025702 prt("文字", 4, 74);
57035703 #else
57045704 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
57055705 if (direct_k_idx < 0) prt("Group", 4, 0);
57065706 prt("Name", 4, max + 3);
5707- if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
5707+ if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 70);
57085708 prt("Sym", 4, 75);
57095709 #endif
57105710
@@ -5908,9 +5908,9 @@ static void display_feature_list(int col, int row, int per_page, FEAT_IDX *feat_
59085908 /* Display lighting level */
59095909 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
59105910
5911- 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));
5911+ 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));
59125912 }
5913- if (p_ptr->wizard || visual_only)
5913+ if (current_world_ptr->wizard || visual_only)
59145914 {
59155915 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
59165916 }
@@ -6048,12 +6048,12 @@ static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX d
60486048 prt(_("名前", "Name"), 4, max + 3);
60496049 if (use_bigtile)
60506050 {
6051- if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6051+ if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 62);
60526052 prt(_("文字 ( l/ d)", "Sym ( l/ d)"), 4, 66);
60536053 }
60546054 else
60556055 {
6056- if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
6056+ if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 64);
60576057 prt(_("文字 (l/d)", "Sym (l/d)"), 4, 68);
60586058 }
60596059
@@ -6774,7 +6774,7 @@ static void do_cmd_knowledge_quests(void)
67746774 do_cmd_knowledge_quests_completed(fff, quest_num);
67756775 fputc('\n', fff);
67766776 do_cmd_knowledge_quests_failed(fff, quest_num);
6777- if (p_ptr->wizard)
6777+ if (current_world_ptr->wizard)
67786778 {
67796779 fputc('\n', fff);
67806780 do_cmd_knowledge_quests_wiz_random(fff);
--- a/src/cmd/cmd-gameoption.c
+++ b/src/cmd/cmd-gameoption.c
@@ -1307,7 +1307,7 @@ void do_cmd_options(void)
13071307 case 'b':
13081308 {
13091309 /* Spawn */
1310- do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ?
1310+ do_cmd_options_aux(OPT_PAGE_BIRTH, (!current_world_ptr->wizard || !allow_debug_opts) ?
13111311 _("初期オプション(参照のみ)", "Birth Options(browse only)") :
13121312 _("初期オプション((*)はスコアに影響)", "Birth Options((*)s effect score)"));
13131313 break;
@@ -1476,7 +1476,7 @@ void do_cmd_options_aux(int page, concptr info)
14761476 int opt[24];
14771477 char buf[80];
14781478 bool browse_only = (page == OPT_PAGE_BIRTH) && current_world_ptr->character_generated &&
1479- (!p_ptr->wizard || !allow_debug_opts);
1479+ (!current_world_ptr->wizard || !allow_debug_opts);
14801480
14811481
14821482 /* Lookup the options */
--- a/src/combat/melee1.c
+++ b/src/combat/melee1.c
@@ -1543,7 +1543,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b
15431543 {
15441544 old_ptr = ma_ptr;
15451545
1546- if (p_ptr->wizard && cheat_xtra)
1546+ if (current_world_ptr->wizard && cheat_xtra)
15471547 {
15481548 msg_print(_("攻撃を再選択しました。", "Attack re-selected."));
15491549 }
--- a/src/core.c
+++ b/src/core.c
@@ -3532,14 +3532,14 @@ static void process_command(void)
35323532 /*** Wizard Commands ***/
35333533 case KTRL('W'):
35343534 {
3535- if (p_ptr->wizard)
3535+ if (current_world_ptr->wizard)
35363536 {
3537- p_ptr->wizard = FALSE;
3537+ current_world_ptr->wizard = FALSE;
35383538 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
35393539 }
35403540 else if (enter_wizard_mode())
35413541 {
3542- p_ptr->wizard = TRUE;
3542+ current_world_ptr->wizard = TRUE;
35433543 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
35443544 }
35453545 p_ptr->update |= (PU_MONSTERS);
@@ -5479,7 +5479,7 @@ void play_game(bool new_game)
54795479 {
54805480 if (enter_wizard_mode())
54815481 {
5482- p_ptr->wizard = TRUE;
5482+ current_world_ptr->wizard = TRUE;
54835483
54845484 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
54855485 {
@@ -5661,7 +5661,7 @@ void play_game(bool new_game)
56615661 else
56625662 {
56635663 /* Mega-Hack -- Allow player to cheat death */
5664- if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
5664+ if ((current_world_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
56655665 {
56665666 cheat_death(p_ptr);
56675667 }
--- a/src/files.c
+++ b/src/files.c
@@ -645,7 +645,7 @@ errr process_pref_file_command(char *buf)
645645 int ob = option_info[i].o_bit;
646646
647647 if ((p_ptr->playing || current_world_ptr->character_xtra) &&
648- (OPT_PAGE_BIRTH == option_info[i].o_page) && !p_ptr->wizard)
648+ (OPT_PAGE_BIRTH == option_info[i].o_page) && !current_world_ptr->wizard)
649649 {
650650 msg_format(_("初期オプションは変更できません! '%s'", "Birth options can not changed! '%s'"), buf);
651651 msg_print(NULL);
--- a/src/load.c
+++ b/src/load.c
@@ -1541,7 +1541,7 @@ static void rd_options(void)
15411541
15421542 rd_u16b(&c);
15431543
1544- if (c & 0x0002) p_ptr->wizard = TRUE;
1544+ if (c & 0x0002) current_world_ptr->wizard = TRUE;
15451545
15461546 cheat_peek = (c & 0x0100) ? TRUE : FALSE;
15471547 cheat_hear = (c & 0x0200) ? TRUE : FALSE;
--- a/src/monster-status.c
+++ b/src/monster-status.c
@@ -1034,7 +1034,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note)
10341034
10351035 if (m_ptr->dealt_damage > m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100;
10361036
1037- if (p_ptr->wizard)
1037+ if (current_world_ptr->wizard)
10381038 {
10391039 msg_format(_("合計%d/%dのダメージを与えた。", "You do %d (out of %d) damage."), m_ptr->dealt_damage, m_ptr->maxhp);
10401040 }
--- a/src/monster1.c
+++ b/src/monster1.c
@@ -2041,7 +2041,7 @@ void roff_top(MONRACE_IDX r_idx)
20412041 Term_addstr(-1, TERM_WHITE, "'):");
20422042
20432043 /* Wizards get extra info */
2044- if (p_ptr->wizard)
2044+ if (current_world_ptr->wizard)
20452045 {
20462046 char buf[16];
20472047
@@ -2972,7 +2972,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
29722972 chance = r_ptr->artifact_percent[i];
29732973 }
29742974
2975- if ((a_idx > 0) && ((randint0(100) < chance) || p_ptr->wizard))
2975+ if ((a_idx > 0) && ((randint0(100) < chance) || current_world_ptr->wizard))
29762976 {
29772977 artifact_type *a_ptr = &a_info[a_idx];
29782978
--- a/src/object2.c
+++ b/src/object2.c
@@ -4605,7 +4605,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION
46054605 #else
46064606 msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
46074607 #endif
4608- if (p_ptr->wizard) msg_print(_("(破損)", "(breakage)"));
4608+ if (current_world_ptr->wizard) msg_print(_("(破損)", "(breakage)"));
46094609
46104610 /* Failure */
46114611 return (0);
@@ -4704,7 +4704,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION
47044704 msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
47054705 #endif
47064706
4707- if (p_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
4707+ if (current_world_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
47084708
47094709 /* Failure */
47104710 return (0);
@@ -4753,7 +4753,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION
47534753 msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
47544754 #endif
47554755
4756- if (p_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
4756+ if (current_world_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
47574757
47584758 /* Mega-Hack -- preserve artifacts */
47594759 if (preserve_mode)
@@ -4826,7 +4826,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION
48264826 msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
48274827 #endif
48284828
4829- if (p_ptr->wizard) msg_print(_("(アイテムが多過ぎる)", "(too many objects)"));
4829+ if (current_world_ptr->wizard) msg_print(_("(アイテムが多過ぎる)", "(too many objects)"));
48304830
48314831 /* Hack -- Preserve artifacts */
48324832 if (object_is_fixed_artifact(j_ptr))
--- a/src/player-move.c
+++ b/src/player-move.c
@@ -573,7 +573,7 @@ bool pattern_seq(player_type *creature_ptr, POSITION c_y, POSITION c_x, POSITION
573573 ok_move = PATTERN_TILE_1;
574574 break;
575575 default:
576- if (creature_ptr->wizard)
576+ if (current_world_ptr->wizard)
577577 msg_format(_("おかしなパターン歩行、%d。", "Funny Pattern walking, %d."), pattern_type_cur);
578578
579579 return TRUE; /* Goof-up */
--- a/src/player-status.c
+++ b/src/player-status.c
@@ -5266,7 +5266,7 @@ void sanity_blast(player_type *creature_ptr, monster_type *m_ptr, bool necro)
52665266
52675267 /* Demon characters are unaffected */
52685268 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;
5269- if (creature_ptr->wizard) return;
5269+ if (current_world_ptr->wizard) return;
52705270
52715271 /* Undead characters are 50% likely to be unaffected */
52725272 if (PRACE_IS_(creature_ptr, RACE_SKELETON) || PRACE_IS_(creature_ptr, RACE_ZOMBIE)
--- a/src/player-status.h
+++ b/src/player-status.h
@@ -430,8 +430,6 @@ struct player_type
430430
431431 bool reset_concent; /* Concentration reset flag */
432432
433- bool wizard; /* Player is in wizard mode */
434-
435433 MONSTER_IDX riding; /* Riding on a monster of this index */
436434
437435 #define KNOW_STAT 0x01
--- a/src/realm-hex.c
+++ b/src/realm-hex.c
@@ -36,6 +36,7 @@
3636 #include "targeting.h"
3737 #include "realm-song.h"
3838 #include "view-mainwindow.h"
39+#include "world.h"
3940
4041 #define MAX_KEEP 4 /*!<呪術の最大詠唱数 */
4142
@@ -543,7 +544,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
543544 project(0, rad, caster_ptr->y, caster_ptr->x, power, GF_HELL_FIRE,
544545 (PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
545546 }
546- if (caster_ptr->wizard)
547+ if (current_world_ptr->wizard)
547548 {
548549 msg_format(_("%d点のダメージを返した。", "You return %d damages."), power);
549550 }
@@ -1101,7 +1102,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
11011102
11021103 fire_ball(GF_HELL_FIRE, dir, power, 1);
11031104
1104- if (caster_ptr->wizard)
1105+ if (current_world_ptr->wizard)
11051106 {
11061107 msg_format(_("%d点のダメージを返した。", "You return %d damages."), power);
11071108 }
--- a/src/save.c
+++ b/src/save.c
@@ -484,7 +484,7 @@ static void wr_options(void)
484484
485485 c = 0;
486486
487- if (p_ptr->wizard) c |= 0x0002;
487+ if (current_world_ptr->wizard) c |= 0x0002;
488488
489489 if (cheat_sight) c |= 0x0040;
490490 if (cheat_turn) c |= 0x0080;
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -514,7 +514,7 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
514514 }
515515
516516 /* Accept any grid when wizard mode */
517- 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;
517+ 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;
518518
519519 /* Accept teleportable floor grids */
520520 if (cave_player_teleportable_bold(y, x, mode)) break;
@@ -654,7 +654,7 @@ void teleport_level(MONSTER_IDX m_idx)
654654 if (randint0(100) < 50) go_up = TRUE;
655655 else go_up = FALSE;
656656
657- if ((m_idx <= 0) && p_ptr->wizard)
657+ if ((m_idx <= 0) && current_world_ptr->wizard)
658658 {
659659 if (get_check("Force to go up? ")) go_up = TRUE;
660660 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
26522652 char buf[256];
26532653 bool max = FALSE;
26542654
2655- if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && p_ptr->wizard)
2655+ if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && current_world_ptr->wizard)
26562656 msg_print(_("警告! print_spell が領域なしに呼ばれた", "Warning! print_spells called with null realm"));
26572657
26582658 /* Title the list */
--- a/src/targeting.c
+++ b/src/targeting.c
@@ -39,6 +39,7 @@
3939 #include "quest.h"
4040 #include "dungeon.h"
4141 #include "spells.h"
42+#include "world.h"
4243
4344 /*!
4445 * @brief コンソール上におけるマップ表示の左上位置を返す /
@@ -465,7 +466,7 @@ static void evaluate_monster_exp(char *buf, monster_type *m_ptr)
465466 }
466467 else if (!ap_r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG2_KAGE))
467468 {
468- if (!p_ptr->wizard)
469+ if (!current_world_ptr->wizard)
469470 {
470471 sprintf(buf,"??");
471472 return;
@@ -974,7 +975,7 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, concptr info)
974975 #endif
975976
976977 /* Display a message */
977- if (p_ptr->wizard)
978+ if (current_world_ptr->wizard)
978979 {
979980 char f_idx_str[32];
980981 if (g_ptr->mimic) sprintf(f_idx_str, "%d/%d", g_ptr->feat, g_ptr->mimic);
--- a/src/view-mainwindow.c
+++ b/src/view-mainwindow.c
@@ -745,7 +745,7 @@ static void prt_title(void)
745745 concptr p = "";
746746 GAME_TEXT str[14];
747747
748- if (p_ptr->wizard)
748+ if (current_world_ptr->wizard)
749749 {
750750 p = _("[ウィザード]", "[=-WIZARD-=]");
751751 }
@@ -1011,7 +1011,7 @@ static void prt_depth(void)
10111011 */
10121012 static void prt_hunger(void)
10131013 {
1014- if(p_ptr->wizard && p_ptr->inside_arena) return;
1014+ if(current_world_ptr->wizard && p_ptr->inside_arena) return;
10151015
10161016 /* Fainting / Starving */
10171017 if (p_ptr->food < PY_FOOD_FAINT)
@@ -1392,7 +1392,7 @@ static void health_redraw(bool riding)
13921392
13931393 m_ptr = &current_floor_ptr->m_list[health_who];
13941394
1395- if (p_ptr->wizard && p_ptr->phase_out)
1395+ if (current_world_ptr->wizard && p_ptr->phase_out)
13961396 {
13971397 row = ROW_INFO - 2;
13981398 col = COL_INFO + 2;
--- a/src/world.h
+++ b/src/world.h
@@ -55,9 +55,11 @@ typedef struct {
5555
5656 bool creating_savefile; /* New savefile is currently created */
5757
58+ bool wizard; /* This world under wizard mode */
59+
5860
5961 } world_type;
6062
6163 extern bool is_daytime(void);
6264 extern void extract_day_hour_min(int *day, int *hour, int *min);
63-extern world_type *current_world_ptr;
\ No newline at end of file
65+extern world_type *current_world_ptr;
Show on old repository browser