• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision0dbae6f56c7024ac1985958dd99c5f9936b2116b (tree)
Time2019-02-09 18:43:03
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

[Refactor] #37353 dungeon_idx を player_type 構造体に編入。 / Enter dungeon_idx to player_type structure.

Change Summary

Incremental Difference

--- a/src/birth.c
+++ b/src/birth.c
@@ -1815,7 +1815,7 @@ static void player_wipe_without_name(void)
18151815 /* Reset virtues */
18161816 for (i = 0; i < 8; i++) p_ptr->virtues[i]=0;
18171817
1818- dungeon_idx = 0;
1818+ p_ptr->dungeon_idx = 0;
18191819
18201820 /* Set the recall dungeon accordingly */
18211821 if (vanilla_town || ironman_downward)
--- a/src/cave.c
+++ b/src/cave.c
@@ -2960,7 +2960,7 @@ void update_mon_lite(void)
29602960 s16b end_temp;
29612961
29622962 /* Non-Ninja player in the darkness */
2963- int dis_lim = ((d_info[dungeon_idx].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto) ?
2963+ int dis_lim = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto) ?
29642964 (MAX_SIGHT / 2 + 1) : (MAX_SIGHT + 3);
29652965
29662966 /* Clear all monster lit squares */
@@ -3011,7 +3011,7 @@ void update_mon_lite(void)
30113011 else if (rad > 0)
30123012 {
30133013 if (!(r_ptr->flags7 & (RF7_SELF_LITE_1 | RF7_SELF_LITE_2)) && (MON_CSLEEP(m_ptr) || (!dun_level && is_daytime()) || p_ptr->inside_battle)) continue;
3014- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) rad = 1;
3014+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) rad = 1;
30153015 add_mon_lite = mon_lite_hack;
30163016 f_flag = FF_LOS;
30173017 }
@@ -4255,7 +4255,7 @@ void map_area(POSITION range)
42554255 FEAT_IDX feat;
42564256 feature_type *f_ptr;
42574257
4258- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
4258+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
42594259
42604260 /* Scan that area */
42614261 for (y = 1; y < cur_hgt - 1; y++)
@@ -4379,7 +4379,7 @@ void wiz_lite(bool ninja)
43794379 f_ptr = &f_info[get_feat_mimic(c_ptr)];
43804380
43814381 /* Perma-lite the grid */
4382- if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS) && !ninja)
4382+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !ninja)
43834383 {
43844384 c_ptr->info |= (CAVE_GLOW);
43854385 }
@@ -4495,7 +4495,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat)
44954495 c_ptr->feat = feat;
44964496
44974497 /* Hack -- glow the GLOW terrain */
4498- if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS))
4498+ if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
44994499 {
45004500 DIRECTION i;
45014501 POSITION yy, xx;
@@ -4524,7 +4524,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat)
45244524 /* Remove flag for mirror/glyph */
45254525 c_ptr->info &= ~(CAVE_OBJECT);
45264526
4527- if (old_mirror && (d_info[dungeon_idx].flags1 & DF1_DARKNESS))
4527+ if (old_mirror && (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
45284528 {
45294529 c_ptr->info &= ~(CAVE_GLOW);
45304530 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
@@ -4555,7 +4555,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat)
45554555 }
45564556
45574557 /* Hack -- glow the GLOW terrain */
4558- if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS))
4558+ if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
45594559 {
45604560 DIRECTION i;
45614561 POSITION yy, xx;
@@ -4608,9 +4608,9 @@ FEAT_IDX conv_dungeon_feat(FEAT_IDX newfeat)
46084608 case CONVERT_TYPE_SOLID:
46094609 return feat_wall_solid;
46104610 case CONVERT_TYPE_STREAM1:
4611- return d_info[dungeon_idx].stream1;
4611+ return d_info[p_ptr->dungeon_idx].stream1;
46124612 case CONVERT_TYPE_STREAM2:
4613- return d_info[dungeon_idx].stream2;
4613+ return d_info[p_ptr->dungeon_idx].stream2;
46144614 default:
46154615 return newfeat;
46164616 }
@@ -4707,7 +4707,7 @@ void remove_mirror(POSITION y, POSITION x)
47074707 c_ptr->info &= ~(CAVE_OBJECT);
47084708 c_ptr->mimic = 0;
47094709
4710- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS)
4710+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
47114711 {
47124712 c_ptr->info &= ~(CAVE_GLOW);
47134713 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
@@ -5016,7 +5016,7 @@ void glow_deep_lava_and_bldg(void)
50165016 cave_type *c_ptr;
50175017
50185018 /* Not in the darkness dungeon */
5019- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) return;
5019+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) return;
50205020
50215021 for (y = 0; y < cur_hgt; y++)
50225022 {
--- a/src/cmd2.c
+++ b/src/cmd2.c
@@ -59,7 +59,7 @@ bool confirm_leave_level(bool down_stair)
5959 */
6060 bool cmd_limit_cast(player_type *creature_ptr)
6161 {
62- if (dun_level && (d_info[dungeon_idx].flags1 & DF1_NO_MAGIC))
62+ if (dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC))
6363 {
6464 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
6565 msg_print(NULL);
@@ -240,7 +240,7 @@ void do_cmd_go_up(void)
240240 }
241241
242242 /* Get out from current dungeon */
243- if (dun_level - up_num < d_info[dungeon_idx].mindepth)
243+ if (dun_level - up_num < d_info[p_ptr->dungeon_idx].mindepth)
244244 up_num = dun_level;
245245 }
246246 if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to"));
@@ -355,7 +355,7 @@ void do_cmd_go_down(void)
355355 /* Save old player position */
356356 p_ptr->oldpx = p_ptr->x;
357357 p_ptr->oldpy = p_ptr->y;
358- dungeon_idx = target_dungeon;
358+ p_ptr->dungeon_idx = target_dungeon;
359359
360360 /*
361361 * Clear all saved floors
@@ -376,7 +376,7 @@ void do_cmd_go_down(void)
376376 {
377377 /* Enter the dungeon just now */
378378 p_ptr->enter_dungeon = TRUE;
379- down_num = d_info[dungeon_idx].mindepth;
379+ down_num = d_info[p_ptr->dungeon_idx].mindepth;
380380 }
381381
382382 if (record_stair)
@@ -394,7 +394,7 @@ void do_cmd_go_down(void)
394394 /* Success */
395395 if (target_dungeon)
396396 {
397- msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[dungeon_idx].text);
397+ msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[p_ptr->dungeon_idx].text);
398398 }
399399 else
400400 {
--- a/src/cmd4.c
+++ b/src/cmd4.c
@@ -439,9 +439,9 @@ errr do_cmd_write_nikki(int type, int num, concptr note)
439439 else
440440 {
441441 #ifdef JP
442- sprintf(note_level_buf, "%d階(%s):", (int)dun_level, d_name+d_info[dungeon_idx].name);
442+ sprintf(note_level_buf, "%d階(%s):", (int)dun_level, d_name+d_info[p_ptr->dungeon_idx].name);
443443 #else
444- sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_idx].name, (int)dun_level);
444+ sprintf(note_level_buf, "%s L%d:", d_name+d_info[p_ptr->dungeon_idx].name, (int)dun_level);
445445 #endif
446446 note_level = note_level_buf;
447447 }
@@ -516,8 +516,8 @@ errr do_cmd_write_nikki(int type, int num, concptr note)
516516 {
517517 fprintf(fff, _(" %2d:%02d %20s %sの最深階%d階に到達した。\n",
518518 " %2d:%02d %20s reached level %d of %s for the first time.\n"), hour, min, note_level,
519- _(d_name+d_info[dungeon_idx].name, num),
520- _(num, d_name+d_info[dungeon_idx].name));
519+ _(d_name+d_info[p_ptr->dungeon_idx].name, num),
520+ _(num, d_name+d_info[p_ptr->dungeon_idx].name));
521521 break;
522522 }
523523 case NIKKI_TRUMP:
@@ -548,8 +548,8 @@ errr do_cmd_write_nikki(int type, int num, concptr note)
548548 {
549549 if (!num)
550550 fprintf(fff, _(" %2d:%02d %20s 帰還を使って%sの%d階へ下りた。\n", " %2d:%02d %20s recalled to dungeon level %d of %s.\n"),
551- hour, min, note_level, _(d_name+d_info[dungeon_idx].name, (int)max_dlv[dungeon_idx]),
552- _((int)max_dlv[dungeon_idx], d_name+d_info[dungeon_idx].name));
551+ hour, min, note_level, _(d_name+d_info[p_ptr->dungeon_idx].name, (int)max_dlv[p_ptr->dungeon_idx]),
552+ _((int)max_dlv[p_ptr->dungeon_idx], d_name+d_info[p_ptr->dungeon_idx].name));
553553 else
554554 fprintf(fff, _(" %2d:%02d %20s 帰還を使って地上へと戻った。\n", " %2d:%02d %20s recalled from dungeon to surface.\n"), hour, min, note_level);
555555 break;
@@ -608,7 +608,7 @@ errr do_cmd_write_nikki(int type, int num, concptr note)
608608 if (!dun_level)
609609 to = _("地上", "the surface");
610610 else
611- to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_idx].name);
611+ to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[p_ptr->dungeon_idx].name);
612612
613613 fprintf(fff, _(" %2d:%02d %20s %sへとウィザード・テレポートで移動した。\n",
614614 " %2d:%02d %20s wizard-teleport to %s.\n"), hour, min, note_level, to);
@@ -620,7 +620,7 @@ errr do_cmd_write_nikki(int type, int num, concptr note)
620620 if (!dun_level)
621621 to = _("地上", "the surface");
622622 else
623- to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_idx].name);
623+ to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[p_ptr->dungeon_idx].name);
624624
625625 fprintf(fff, _(" %2d:%02d %20s %sへとパターンの力で移動した。\n",
626626 " %2d:%02d %20s used Pattern to teleport to %s.\n"), hour, min, note_level, to);
--- a/src/defines.h
+++ b/src/defines.h
@@ -4684,7 +4684,7 @@ extern int PlayerUID;
46844684 #define TELE_LEVEL_IS_INEFF(TARGET) \
46854685 (p_ptr->inside_arena || p_ptr->inside_battle || \
46864686 (p_ptr->inside_quest && !random_quest_number(dun_level)) || \
4687- (((TARGET) <= 0) && (quest_number(dun_level) || (dun_level >= d_info[dungeon_idx].maxdepth)) && \
4687+ (((TARGET) <= 0) && (quest_number(dun_level) || (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) && \
46884688 (dun_level >= 1) && ironman_downward))
46894689
46904690
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -539,7 +539,7 @@ static void pattern_teleport(void)
539539 min_level = dun_level;
540540
541541 /* Maximum level */
542- if (dungeon_idx == DUNGEON_ANGBAND)
542+ if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
543543 {
544544 if (dun_level > 100)
545545 max_level = MAX_DEPTH - 1;
@@ -548,8 +548,8 @@ static void pattern_teleport(void)
548548 }
549549 else
550550 {
551- max_level = d_info[dungeon_idx].maxdepth;
552- min_level = d_info[dungeon_idx].mindepth;
551+ max_level = d_info[p_ptr->dungeon_idx].maxdepth;
552+ min_level = d_info[p_ptr->dungeon_idx].mindepth;
553553 }
554554
555555 /* Prompt */
@@ -3001,12 +3001,12 @@ static void process_world_aux_movement(void)
30013001 {
30023002 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
30033003
3004- if (dungeon_idx) p_ptr->recall_dungeon = dungeon_idx;
3004+ if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
30053005 if (record_stair)
30063006 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
30073007
30083008 dun_level = 0;
3009- dungeon_idx = 0;
3009+ p_ptr->dungeon_idx = 0;
30103010
30113011 leave_quest_check();
30123012 leave_tower_check();
@@ -3019,17 +3019,17 @@ static void process_world_aux_movement(void)
30193019 {
30203020 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
30213021
3022- dungeon_idx = p_ptr->recall_dungeon;
3022+ p_ptr->dungeon_idx = p_ptr->recall_dungeon;
30233023
30243024 if (record_stair)
30253025 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
30263026
30273027 /* New depth */
3028- dun_level = max_dlv[dungeon_idx];
3028+ dun_level = max_dlv[p_ptr->dungeon_idx];
30293029 if (dun_level < 1) dun_level = 1;
30303030
30313031 /* Nightmare mode makes recall more dangerous */
3032- if (ironman_nightmare && !randint0(666) && (dungeon_idx == DUNGEON_ANGBAND))
3032+ if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
30333033 {
30343034 if (dun_level < 50)
30353035 {
@@ -3041,7 +3041,7 @@ static void process_world_aux_movement(void)
30413041 }
30423042 else if (dun_level > 100)
30433043 {
3044- dun_level = d_info[dungeon_idx].maxdepth - 1;
3044+ dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
30453045 }
30463046 }
30473047
@@ -3067,7 +3067,7 @@ static void process_world_aux_movement(void)
30673067 /* Leaving */
30683068 p_ptr->leaving = TRUE;
30693069
3070- if (dungeon_idx == DUNGEON_ANGBAND)
3070+ if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
30713071 {
30723072 int i;
30733073
@@ -3384,10 +3384,10 @@ static void process_world(void)
33843384 update_dungeon_feeling();
33853385
33863386 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3387- if (ironman_downward && (dungeon_idx != DUNGEON_ANGBAND && dungeon_idx != 0))
3387+ if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
33883388 {
33893389 dun_level = 0;
3390- dungeon_idx = 0;
3390+ p_ptr->dungeon_idx = 0;
33913391 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
33923392 p_ptr->inside_arena = FALSE;
33933393 p_ptr->wild_mode = FALSE;
@@ -3576,7 +3576,7 @@ static void process_world(void)
35763576 /*** Process the monsters ***/
35773577
35783578 /* Check for creature generation. */
3579- if (one_in_(d_info[dungeon_idx].max_m_alloc_chance) &&
3579+ if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
35803580 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
35813581 {
35823582 /* Make a new monster */
@@ -4198,7 +4198,7 @@ static void process_command(void)
41984198 {
41994199 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
42004200 }
4201- else if (dun_level && (d_info[dungeon_idx].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4201+ else if (dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
42024202 {
42034203 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
42044204 msg_print(NULL);
@@ -5321,9 +5321,9 @@ static void dungeon(bool load_game)
53215321
53225322
53235323 /* Track maximum dungeon level (if not in quest -KMW-) */
5324- if ((max_dlv[dungeon_idx] < dun_level) && !p_ptr->inside_quest)
5324+ if ((max_dlv[p_ptr->dungeon_idx] < dun_level) && !p_ptr->inside_quest)
53255325 {
5326- max_dlv[dungeon_idx] = dun_level;
5326+ max_dlv[p_ptr->dungeon_idx] = dun_level;
53275327 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
53285328 }
53295329
@@ -5390,22 +5390,22 @@ static void dungeon(bool load_game)
53905390 if (!p_ptr->playing || p_ptr->is_dead) return;
53915391
53925392 /* Print quest message if appropriate */
5393- if (!p_ptr->inside_quest && (dungeon_idx == DUNGEON_ANGBAND))
5393+ if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
53945394 {
53955395 quest_discovery(random_quest_number(dun_level));
53965396 p_ptr->inside_quest = random_quest_number(dun_level);
53975397 }
5398- if ((dun_level == d_info[dungeon_idx].maxdepth) && d_info[dungeon_idx].final_guardian)
5398+ if ((dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
53995399 {
5400- if (r_info[d_info[dungeon_idx].final_guardian].max_num)
5400+ if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
54015401 #ifdef JP
54025402 msg_format("この階には%sの主である%sが棲んでいる。",
5403- d_name+d_info[dungeon_idx].name,
5404- r_name+r_info[d_info[dungeon_idx].final_guardian].name);
5403+ d_name+d_info[p_ptr->dungeon_idx].name,
5404+ r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
54055405 #else
54065406 msg_format("%^s lives in this level as the keeper of %s.",
5407- r_name+r_info[d_info[dungeon_idx].final_guardian].name,
5408- d_name+d_info[dungeon_idx].name);
5407+ r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5408+ d_name+d_info[p_ptr->dungeon_idx].name);
54095409 #endif
54105410 }
54115411
@@ -5966,7 +5966,7 @@ void play_game(bool new_game)
59665966 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
59675967
59685968 /* Fill the arrays of floors and walls in the good proportions */
5969- set_floor_and_wall(dungeon_idx);
5969+ set_floor_and_wall(p_ptr->dungeon_idx);
59705970
59715971 /* Flavor the objects */
59725972 flavor_init();
--- a/src/externs.h
+++ b/src/externs.h
@@ -438,7 +438,6 @@ extern FEAT_IDX feat_mountain;
438438 extern FEAT_IDX feat_swamp;
439439 extern FEAT_IDX feat_undetected;
440440
441-extern DUNGEON_IDX dungeon_idx;
442441 extern DEPTH *max_dlv;
443442 extern FEAT_IDX feat_wall_outer;
444443 extern FEAT_IDX feat_wall_inner;
--- a/src/floor-generate.c
+++ b/src/floor-generate.c
@@ -180,7 +180,7 @@ static bool alloc_stairs(IDX feat, int num, int walls)
180180 /* No up stairs in town or in ironman mode */
181181 if (ironman_downward || !dun_level) return TRUE;
182182
183- if (dun_level > d_info[dungeon_idx].mindepth)
183+ if (dun_level > d_info[p_ptr->dungeon_idx].mindepth)
184184 shaft_num = (randint1(num+1))/2;
185185 }
186186 else if (have_flag(f_ptr->flags, FF_MORE))
@@ -198,9 +198,9 @@ static bool alloc_stairs(IDX feat, int num, int walls)
198198 }
199199
200200 /* No downstairs at the bottom */
201- if (dun_level >= d_info[dungeon_idx].maxdepth) return TRUE;
201+ if (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) return TRUE;
202202
203- if ((dun_level < d_info[dungeon_idx].maxdepth-1) && !quest_number(dun_level+1))
203+ if ((dun_level < d_info[p_ptr->dungeon_idx].maxdepth-1) && !quest_number(dun_level+1))
204204 shaft_num = (randint1(num)+1)/2;
205205 }
206206
@@ -390,7 +390,7 @@ bool place_quest_monsters(void)
390390 (quest[i].type != QUEST_TYPE_KILL_LEVEL &&
391391 quest[i].type != QUEST_TYPE_RANDOM) ||
392392 quest[i].level != dun_level ||
393- dungeon_idx != quest[i].dungeon ||
393+ p_ptr->dungeon_idx != quest[i].dungeon ||
394394 (quest[i].flags & QUEST_FLAG_PRESET))
395395 {
396396 /* Ignore it */
@@ -499,7 +499,7 @@ static void gen_caverns_and_lakes(void)
499499 {
500500 #ifdef ALLOW_CAVERNS_AND_LAKES
501501 /* Possible "destroyed" level */
502- if ((dun_level > 30) && one_in_(DUN_DEST*2) && (small_levels) && (d_info[dungeon_idx].flags1 & DF1_DESTROY))
502+ if ((dun_level > 30) && one_in_(DUN_DEST*2) && (small_levels) && (d_info[p_ptr->dungeon_idx].flags1 & DF1_DESTROY))
503503 {
504504 dun->destroyed = TRUE;
505505
@@ -509,15 +509,15 @@ static void gen_caverns_and_lakes(void)
509509
510510 /* Make a lake some of the time */
511511 if (one_in_(LAKE_LEVEL) && !dun->empty_level && !dun->destroyed &&
512- (d_info[dungeon_idx].flags1 & DF1_LAKE_MASK))
512+ (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_MASK))
513513 {
514514 int count = 0;
515- if (d_info[dungeon_idx].flags1 & DF1_LAKE_WATER) count += 3;
516- if (d_info[dungeon_idx].flags1 & DF1_LAKE_LAVA) count += 3;
517- if (d_info[dungeon_idx].flags1 & DF1_LAKE_RUBBLE) count += 3;
518- if (d_info[dungeon_idx].flags1 & DF1_LAKE_TREE) count += 3;
515+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_WATER) count += 3;
516+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_LAVA) count += 3;
517+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_RUBBLE) count += 3;
518+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_TREE) count += 3;
519519
520- if (d_info[dungeon_idx].flags1 & DF1_LAKE_LAVA)
520+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_LAVA)
521521 {
522522 /* Lake of Lava */
523523 if ((dun_level > 80) && (randint0(count) < 2)) dun->laketype = LAKE_T_LAVA;
@@ -528,7 +528,7 @@ static void gen_caverns_and_lakes(void)
528528 count--;
529529 }
530530
531- if ((d_info[dungeon_idx].flags1 & DF1_LAKE_WATER) && !dun->laketype)
531+ if ((d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_WATER) && !dun->laketype)
532532 {
533533 /* Lake of Water */
534534 if ((dun_level > 50) && randint0(count) < 2) dun->laketype = LAKE_T_WATER;
@@ -539,7 +539,7 @@ static void gen_caverns_and_lakes(void)
539539 count--;
540540 }
541541
542- if ((d_info[dungeon_idx].flags1 & DF1_LAKE_RUBBLE) && !dun->laketype)
542+ if ((d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_RUBBLE) && !dun->laketype)
543543 {
544544 /* Lake of rubble */
545545 if ((dun_level > 35) && (randint0(count) < 2)) dun->laketype = LAKE_T_CAVE;
@@ -551,7 +551,7 @@ static void gen_caverns_and_lakes(void)
551551 }
552552
553553 /* Lake of tree */
554- if ((dun_level > 5) && (d_info[dungeon_idx].flags1 & DF1_LAKE_TREE) && !dun->laketype) dun->laketype = LAKE_T_AIR_VAULT;
554+ if ((dun_level > 5) && (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_TREE) && !dun->laketype) dun->laketype = LAKE_T_AIR_VAULT;
555555
556556 if (dun->laketype)
557557 {
@@ -561,7 +561,7 @@ static void gen_caverns_and_lakes(void)
561561 }
562562
563563 if ((dun_level > DUN_CAVERN) && !dun->empty_level &&
564- (d_info[dungeon_idx].flags1 & DF1_CAVERN) &&
564+ (d_info[p_ptr->dungeon_idx].flags1 & DF1_CAVERN) &&
565565 !dun->laketype && !dun->destroyed && (randint1(1000) < dun_level))
566566 {
567567 dun->cavern = TRUE;
@@ -598,7 +598,7 @@ static bool cave_gen(void)
598598 dun->laketype = 0;
599599
600600 /* Fill the arrays of floors and walls in the good proportions */
601- set_floor_and_wall(dungeon_idx);
601+ set_floor_and_wall(p_ptr->dungeon_idx);
602602 get_mon_num_prep(get_monster_hook(), NULL);
603603
604604 /* Randomize the dungeon creation values */
@@ -625,7 +625,7 @@ static bool cave_gen(void)
625625 dun->cent_n = 0;
626626
627627 /* Empty arena levels */
628- if (ironman_empty_levels || ((d_info[dungeon_idx].flags1 & DF1_ARENA) && (empty_levels && one_in_(EMPTY_LEVEL))))
628+ if (ironman_empty_levels || ((d_info[p_ptr->dungeon_idx].flags1 & DF1_ARENA) && (empty_levels && one_in_(EMPTY_LEVEL))))
629629 {
630630 dun->empty_level = TRUE;
631631 msg_print_wizard(CHEAT_DUNGEON, _("アリーナレベルを生成。", "Arena level."));
@@ -674,7 +674,7 @@ static bool cave_gen(void)
674674
675675
676676 /* Build maze */
677- if (d_info[dungeon_idx].flags1 & DF1_MAZE)
677+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_MAZE)
678678 {
679679 build_maze_vault(cur_wid/2-1, cur_hgt/2-1, cur_wid-4, cur_hgt-4, FALSE);
680680
@@ -714,7 +714,7 @@ static bool cave_gen(void)
714714 FEAT_IDX feat1 = 0, feat2 = 0;
715715
716716 /* Choose water mainly */
717- if ((randint1(MAX_DEPTH * 2) - 1 > dun_level) && (d_info[dungeon_idx].flags1 & DF1_WATER_RIVER))
717+ if ((randint1(MAX_DEPTH * 2) - 1 > dun_level) && (d_info[p_ptr->dungeon_idx].flags1 & DF1_WATER_RIVER))
718718 {
719719 feat1 = feat_deep_water;
720720 feat2 = feat_shallow_water;
@@ -725,19 +725,19 @@ static bool cave_gen(void)
725725 FEAT_IDX select_shallow_feat[10];
726726 int select_id_max = 0, selected;
727727
728- if (d_info[dungeon_idx].flags1 & DF1_LAVA_RIVER)
728+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAVA_RIVER)
729729 {
730730 select_deep_feat[select_id_max] = feat_deep_lava;
731731 select_shallow_feat[select_id_max] = feat_shallow_lava;
732732 select_id_max++;
733733 }
734- if (d_info[dungeon_idx].flags1 & DF1_POISONOUS_RIVER)
734+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_POISONOUS_RIVER)
735735 {
736736 select_deep_feat[select_id_max] = feat_deep_poisonous_puddle;
737737 select_shallow_feat[select_id_max] = feat_shallow_poisonous_puddle;
738738 select_id_max++;
739739 }
740- if (d_info[dungeon_idx].flags1 & DF1_ACID_RIVER)
740+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_ACID_RIVER)
741741 {
742742 select_deep_feat[select_id_max] = feat_deep_acid_puddle;
743743 select_shallow_feat[select_id_max] = feat_shallow_acid_puddle;
@@ -794,7 +794,7 @@ static bool cave_gen(void)
794794 dun->wall_n = 0;
795795
796796 /* Connect the room to the previous room */
797- if (randint1(dun_level) > d_info[dungeon_idx].tunnel_percent)
797+ if (randint1(dun_level) > d_info[p_ptr->dungeon_idx].tunnel_percent)
798798 {
799799 /* make cave-like tunnel */
800800 (void)build_tunnel2(dun->cent[i].x, dun->cent[i].y, x, y, 2, 2);
@@ -842,7 +842,7 @@ static bool cave_gen(void)
842842 place_floor_grid(c_ptr);
843843
844844 /* Occasional doorway */
845- if ((randint0(100) < dun_tun_pen) && !(d_info[dungeon_idx].flags1 & DF1_NO_DOORS))
845+ if ((randint0(100) < dun_tun_pen) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS))
846846 {
847847 /* Place a random door */
848848 place_random_door(y, x, TRUE);
@@ -877,21 +877,21 @@ static bool cave_gen(void)
877877
878878 if (!dun->laketype)
879879 {
880- if (d_info[dungeon_idx].stream2)
880+ if (d_info[p_ptr->dungeon_idx].stream2)
881881 {
882882 /* Hack -- Add some quartz streamers */
883883 for (i = 0; i < DUN_STR_QUA; i++)
884884 {
885- build_streamer(d_info[dungeon_idx].stream2, DUN_STR_QC);
885+ build_streamer(d_info[p_ptr->dungeon_idx].stream2, DUN_STR_QC);
886886 }
887887 }
888888
889- if (d_info[dungeon_idx].stream1)
889+ if (d_info[p_ptr->dungeon_idx].stream1)
890890 {
891891 /* Hack -- Add some magma streamers */
892892 for (i = 0; i < DUN_STR_MAG; i++)
893893 {
894- build_streamer(d_info[dungeon_idx].stream1, DUN_STR_MC);
894+ build_streamer(d_info[p_ptr->dungeon_idx].stream1, DUN_STR_MC);
895895 }
896896 }
897897 }
@@ -921,7 +921,7 @@ static bool cave_gen(void)
921921 if (k < 2) k = 2;
922922
923923 /* Pick a base number of monsters */
924- i = d_info[dungeon_idx].min_m_alloc_level;
924+ i = d_info[p_ptr->dungeon_idx].min_m_alloc_level;
925925
926926 /* To make small levels a bit more playable */
927927 if (cur_hgt < MAX_HGT || cur_wid < MAX_WID)
@@ -950,7 +950,7 @@ static bool cave_gen(void)
950950 alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_TRAP, randint1(k));
951951
952952 /* Put some rubble in corridors (except NO_CAVE dungeon (Castle)) */
953- if (!(d_info[dungeon_idx].flags1 & DF1_NO_CAVE)) alloc_object(ALLOC_SET_CORR, ALLOC_TYP_RUBBLE, randint1(k));
953+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE)) alloc_object(ALLOC_SET_CORR, ALLOC_TYP_RUBBLE, randint1(k));
954954
955955 /* Mega Hack -- No object at first level of deeper dungeon */
956956 if (p_ptr->enter_dungeon && dun_level > 1)
@@ -972,7 +972,7 @@ static bool cave_gen(void)
972972 /* Put the Guardian */
973973 if (!alloc_guardian(TRUE)) return FALSE;
974974
975- if (dun->empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > dun_level)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS))
975+ if (dun->empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > dun_level)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
976976 {
977977 /* Lite the cave */
978978 for (y = 0; y < cur_hgt; y++)
@@ -1248,16 +1248,16 @@ static bool level_gen(concptr *why)
12481248
12491249 if ((always_small_levels || ironman_small_levels ||
12501250 (one_in_(SMALL_LEVEL) && small_levels) ||
1251- (d_info[dungeon_idx].flags1 & DF1_BEGINNER) ||
1252- (d_info[dungeon_idx].flags1 & DF1_SMALLEST)) &&
1253- !(d_info[dungeon_idx].flags1 & DF1_BIG))
1251+ (d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER) ||
1252+ (d_info[p_ptr->dungeon_idx].flags1 & DF1_SMALLEST)) &&
1253+ !(d_info[p_ptr->dungeon_idx].flags1 & DF1_BIG))
12541254 {
1255- if (d_info[dungeon_idx].flags1 & DF1_SMALLEST)
1255+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_SMALLEST)
12561256 {
12571257 level_height = 1;
12581258 level_width = 1;
12591259 }
1260- else if (d_info[dungeon_idx].flags1 & DF1_BEGINNER)
1260+ else if (d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER)
12611261 {
12621262 level_height = 2;
12631263 level_width = 2;
@@ -1401,7 +1401,7 @@ void generate_cave(void)
14011401 int num;
14021402
14031403 /* Fill the arrays of floors and walls in the good proportions */
1404- set_floor_and_wall(dungeon_idx);
1404+ set_floor_and_wall(p_ptr->dungeon_idx);
14051405
14061406 /* Generate */
14071407 for (num = 0; TRUE; num++)
--- a/src/floor-save.c
+++ b/src/floor-save.c
@@ -878,7 +878,7 @@ void leave_floor(void)
878878 ((quest[i].type == QUEST_TYPE_KILL_LEVEL) ||
879879 (quest[i].type == QUEST_TYPE_RANDOM)) &&
880880 (quest[i].level == dun_level) &&
881- (dungeon_idx == quest[i].dungeon) &&
881+ (p_ptr->dungeon_idx == quest[i].dungeon) &&
882882 !(quest[i].flags & QUEST_FLAG_PRESET))
883883 {
884884 quest_r_idx = quest[i].r_idx;
@@ -970,11 +970,11 @@ void leave_floor(void)
970970 if (change_floor_mode & CFM_DOWN)
971971 {
972972 if (!dun_level)
973- move_num = d_info[dungeon_idx].mindepth;
973+ move_num = d_info[p_ptr->dungeon_idx].mindepth;
974974 }
975975 else if (change_floor_mode & CFM_UP)
976976 {
977- if (dun_level + move_num < d_info[dungeon_idx].mindepth)
977+ if (dun_level + move_num < d_info[p_ptr->dungeon_idx].mindepth)
978978 move_num = -dun_level;
979979 }
980980
@@ -982,16 +982,16 @@ void leave_floor(void)
982982 }
983983
984984 /* Leaving the dungeon to town */
985- if (!dun_level && dungeon_idx)
985+ if (!dun_level && p_ptr->dungeon_idx)
986986 {
987987 p_ptr->leaving_dungeon = TRUE;
988988 if (!vanilla_town && !lite_town)
989989 {
990- p_ptr->wilderness_y = d_info[dungeon_idx].dy;
991- p_ptr->wilderness_x = d_info[dungeon_idx].dx;
990+ p_ptr->wilderness_y = d_info[p_ptr->dungeon_idx].dy;
991+ p_ptr->wilderness_x = d_info[p_ptr->dungeon_idx].dx;
992992 }
993- p_ptr->recall_dungeon = dungeon_idx;
994- dungeon_idx = 0;
993+ p_ptr->recall_dungeon = p_ptr->dungeon_idx;
994+ p_ptr->dungeon_idx = 0;
995995
996996 /* Reach to the surface -- Clear all saved floors */
997997 change_floor_mode &= ~CFM_SAVE_FLOORS;
@@ -1189,7 +1189,7 @@ void change_floor(void)
11891189 MONSTER_IDX i;
11901190 GAME_TURN tmp_last_visit = sf_ptr->last_visit;
11911191 GAME_TURN absence_ticks;
1192- int alloc_chance = d_info[dungeon_idx].max_m_alloc_chance;
1192+ int alloc_chance = d_info[p_ptr->dungeon_idx].max_m_alloc_chance;
11931193 GAME_TURN alloc_times;
11941194
11951195 while (tmp_last_visit > turn) tmp_last_visit -= TURNS_PER_TICK * TOWN_DAWN;
@@ -1415,7 +1415,7 @@ void stair_creation(void)
14151415 if (ironman_downward) up = FALSE;
14161416
14171417 /* Forbid down staircases on quest level */
1418- if (quest_number(dun_level) || (dun_level >= d_info[dungeon_idx].maxdepth)) down = FALSE;
1418+ if (quest_number(dun_level) || (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) down = FALSE;
14191419
14201420 /* No effect out of standard dungeon floor */
14211421 if (!dun_level || (!up && !down) ||
--- a/src/floor-streams.c
+++ b/src/floor-streams.c
@@ -133,7 +133,7 @@ static void recursive_river(POSITION x1, POSITION y1, POSITION x2, POSITION y2,
133133 /* Lava terrain glows */
134134 if (have_flag(f_info[feat1].flags, FF_LAVA))
135135 {
136- if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) c_ptr->info |= CAVE_GLOW;
136+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) c_ptr->info |= CAVE_GLOW;
137137 }
138138
139139 /* Hack -- don't teleport here */
@@ -416,7 +416,7 @@ void place_trees(POSITION x, POSITION y)
416416 c_ptr->mimic = 0;
417417
418418 /* Light area since is open above */
419- if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) cave[j][i].info |= (CAVE_GLOW | CAVE_ROOM);
419+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) cave[j][i].info |= (CAVE_GLOW | CAVE_ROOM);
420420 }
421421 }
422422 }
--- a/src/grid.c
+++ b/src/grid.c
@@ -105,7 +105,7 @@ void place_random_stairs(POSITION y, POSITION x)
105105 if (ironman_downward) up_stairs = FALSE;
106106
107107 /* Bottom */
108- if (dun_level >= d_info[dungeon_idx].maxdepth) down_stairs = FALSE;
108+ if (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) down_stairs = FALSE;
109109
110110 /* Quest-level */
111111 if (quest_number(dun_level) && (dun_level > 1)) down_stairs = FALSE;
@@ -139,15 +139,15 @@ void place_random_door(POSITION y, POSITION x, bool room)
139139 /* Initialize mimic info */
140140 c_ptr->mimic = 0;
141141
142- if (d_info[dungeon_idx].flags1 & DF1_NO_DOORS)
142+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS)
143143 {
144144 place_floor_bold(y, x);
145145 return;
146146 }
147147
148- type = ((d_info[dungeon_idx].flags1 & DF1_CURTAIN) &&
149- one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
150- ((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
148+ type = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
149+ one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
150+ ((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
151151
152152 /* Choose an object */
153153 tmp = randint0(1000);
@@ -219,7 +219,7 @@ void place_closed_door(POSITION y, POSITION x, int type)
219219 int tmp;
220220 FEAT_IDX feat = feat_none;
221221
222- if (d_info[dungeon_idx].flags1 & DF1_NO_DOORS)
222+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS)
223223 {
224224 place_floor_bold(y, x);
225225 return;
@@ -270,13 +270,13 @@ void place_closed_door(POSITION y, POSITION x, int type)
270270 */
271271 void place_locked_door(POSITION y, POSITION x)
272272 {
273- if (d_info[dungeon_idx].flags1 & DF1_NO_DOORS)
273+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS)
274274 {
275275 place_floor_bold(y, x);
276276 }
277277 else
278278 {
279- set_cave_feat(y, x, feat_locked_door_random((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR));
279+ set_cave_feat(y, x, feat_locked_door_random((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR));
280280 cave[y][x].info &= ~(CAVE_FLOOR);
281281 delete_monster(y, x);
282282 }
@@ -292,7 +292,7 @@ void place_locked_door(POSITION y, POSITION x)
292292 */
293293 void place_secret_door(POSITION y, POSITION x, int type)
294294 {
295- if (d_info[dungeon_idx].flags1 & DF1_NO_DOORS)
295+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS)
296296 {
297297 place_floor_bold(y, x);
298298 }
@@ -302,9 +302,9 @@ void place_secret_door(POSITION y, POSITION x, int type)
302302
303303 if (type == DOOR_DEFAULT)
304304 {
305- type = ((d_info[dungeon_idx].flags1 & DF1_CURTAIN) &&
306- one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
307- ((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
305+ type = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
306+ one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
307+ ((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
308308 }
309309
310310 /* Create secret door */
@@ -479,7 +479,7 @@ void try_door(POSITION y, POSITION x)
479479 if (cave[y][x].info & (CAVE_ROOM)) return;
480480
481481 /* Occasional door (if allowed) */
482- if ((randint0(100) < dun_tun_jct) && possible_doorway(y, x) && !(d_info[dungeon_idx].flags1 & DF1_NO_DOORS))
482+ if ((randint0(100) < dun_tun_jct) && possible_doorway(y, x) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS))
483483 {
484484 /* Place a door */
485485 place_random_door(y, x, FALSE);
--- a/src/load.c
+++ b/src/load.c
@@ -2557,11 +2557,11 @@ static errr rd_dungeon_old(void)
25572557 /* Header info */
25582558 rd_s16b(&tmp16s);
25592559 dun_level = (DEPTH)tmp16s;
2560- if (z_older_than(10, 3, 8)) dungeon_idx = DUNGEON_ANGBAND;
2560+ if (z_older_than(10, 3, 8)) p_ptr->dungeon_idx = DUNGEON_ANGBAND;
25612561 else
25622562 {
25632563 rd_byte(&tmp8u);
2564- dungeon_idx = (IDX)tmp8u;
2564+ p_ptr->dungeon_idx = (IDX)tmp8u;
25652565 }
25662566
25672567 /* Set the base level for old versions */
@@ -3282,7 +3282,7 @@ static errr rd_dungeon(void)
32823282 err = rd_dungeon_old();
32833283
32843284 /* Prepare floor_id of current floor */
3285- if (dungeon_idx)
3285+ if (p_ptr->dungeon_idx)
32863286 {
32873287 p_ptr->floor_id = get_new_floor_id();
32883288 get_sf_ptr(p_ptr->floor_id)->dun_level = dun_level;
@@ -3299,7 +3299,7 @@ static errr rd_dungeon(void)
32993299
33003300 /* Current dungeon type */
33013301 rd_byte(&tmp8u);
3302- dungeon_idx = (DUNGEON_IDX)tmp8u;
3302+ p_ptr->dungeon_idx = (DUNGEON_IDX)tmp8u;
33033303
33043304 /* Number of the saved_floors array elements */
33053305 rd_byte(&num);
@@ -3958,7 +3958,7 @@ static errr rd_savefile_new_aux(void)
39583958 {
39593959 if (p_ptr->inside_quest == OLD_QUEST_WATER_CAVE)
39603960 {
3961- dungeon_idx = lite_town ? DUNGEON_ANGBAND : DUNGEON_GALGALS;
3961+ p_ptr->dungeon_idx = lite_town ? DUNGEON_ANGBAND : DUNGEON_GALGALS;
39623962 dun_level = 1;
39633963 p_ptr->inside_quest = 0;
39643964 }
--- a/src/melee1.c
+++ b/src/melee1.c
@@ -1363,7 +1363,7 @@ bool py_attack(POSITION y, POSITION x, BIT_FLAGS mode)
13631363 }
13641364 }
13651365
1366- if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE)
1366+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
13671367 {
13681368 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
13691369 return FALSE;
@@ -1538,7 +1538,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
15381538 /* Not allowed to attack */
15391539 if (r_ptr->flags1 & (RF1_NEVER_BLOW)) return (FALSE);
15401540
1541- if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE) return (FALSE);
1541+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) return (FALSE);
15421542
15431543 /* ...nor if friendly */
15441544 if (!is_hostile(m_ptr)) return FALSE;
--- a/src/monster-process.c
+++ b/src/monster-process.c
@@ -1453,7 +1453,7 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx)
14531453 /* Not allowed to attack */
14541454 if (r_ptr->flags1 & RF1_NEVER_BLOW) return FALSE;
14551455
1456- if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE) return (FALSE);
1456+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) return (FALSE);
14571457
14581458 /* Total armor */
14591459 ac = tr_ptr->ac;
@@ -2849,7 +2849,7 @@ void process_monster(MONSTER_IDX m_idx)
28492849 }
28502850
28512851 /* In anti-melee dungeon, stupid or confused monster takes useless turn */
2852- if (do_move && (d_info[dungeon_idx].flags1 & DF1_NO_MELEE))
2852+ if (do_move && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE))
28532853 {
28542854 if (!MON_CONFUSED(m_ptr))
28552855 {
@@ -2905,7 +2905,7 @@ void process_monster(MONSTER_IDX m_idx)
29052905 if (monst_attack_monst(m_idx, c_ptr->m_idx)) return;
29062906
29072907 /* In anti-melee dungeon, stupid or confused monster takes useless turn */
2908- else if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE)
2908+ else if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
29092909 {
29102910 if (MON_CONFUSED(m_ptr)) return;
29112911 else if (r_ptr->flags2 & RF2_STUPID)
--- a/src/monster-status.c
+++ b/src/monster-status.c
@@ -1121,7 +1121,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note)
11211121 #endif
11221122 }
11231123
1124- if (!(d_info[dungeon_idx].flags1 & DF1_BEGINNER))
1124+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
11251125 {
11261126 if (!dun_level && !ambush_flag && !p_ptr->inside_arena)
11271127 {
--- a/src/monster1.c
+++ b/src/monster1.c
@@ -3000,14 +3000,14 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
30003000 }
30013001 }
30023002
3003- if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[dungeon_idx].final_guardian == m_ptr->r_idx))
3003+ if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[p_ptr->dungeon_idx].final_guardian == m_ptr->r_idx))
30043004 {
3005- KIND_OBJECT_IDX k_idx = d_info[dungeon_idx].final_object ? d_info[dungeon_idx].final_object
3005+ KIND_OBJECT_IDX k_idx = d_info[p_ptr->dungeon_idx].final_object ? d_info[p_ptr->dungeon_idx].final_object
30063006 : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
30073007
3008- if (d_info[dungeon_idx].final_artifact)
3008+ if (d_info[p_ptr->dungeon_idx].final_artifact)
30093009 {
3010- a_idx = d_info[dungeon_idx].final_artifact;
3010+ a_idx = d_info[p_ptr->dungeon_idx].final_artifact;
30113011 artifact_type *a_ptr = &a_info[a_idx];
30123012
30133013 if (!a_ptr->cur_num)
@@ -3023,7 +3023,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
30233023 else if (!preserve_mode) a_ptr->cur_num = 1;
30243024
30253025 /* Prevent rewarding both artifact and "default" object */
3026- if (!d_info[dungeon_idx].final_object) k_idx = 0;
3026+ if (!d_info[p_ptr->dungeon_idx].final_object) k_idx = 0;
30273027 }
30283028 }
30293029
@@ -3037,7 +3037,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
30373037 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | AM_GOOD);
30383038 (void)drop_near(q_ptr, -1, y, x);
30393039 }
3040- msg_format(_("あなたは%sを制覇した!", "You have conquered %s!"), d_name + d_info[dungeon_idx].name);
3040+ msg_format(_("あなたは%sを制覇した!", "You have conquered %s!"), d_name + d_info[p_ptr->dungeon_idx].name);
30413041 }
30423042 }
30433043
--- a/src/monster2.c
+++ b/src/monster2.c
@@ -967,7 +967,7 @@ static int chameleon_change_m_idx = 0;
967967 */
968968 static bool restrict_monster_to_dungeon(MONRACE_IDX r_idx)
969969 {
970- dungeon_info_type *d_ptr = &d_info[dungeon_idx];
970+ dungeon_info_type *d_ptr = &d_info[p_ptr->dungeon_idx];
971971 monster_race *r_ptr = &r_info[r_idx];
972972 byte a;
973973
@@ -1205,7 +1205,7 @@ errr get_mon_num_prep(monsterrace_hook_type monster_hook,
12051205
12061206 if (dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)) && !restrict_monster_to_dungeon(entry->index) && !p_ptr->inside_battle)
12071207 {
1208- int hoge = entry->prob2 * d_info[dungeon_idx].special_div;
1208+ int hoge = entry->prob2 * d_info[p_ptr->dungeon_idx].special_div;
12091209 entry->prob2 = hoge / 64;
12101210 if (randint0(64) < (hoge & 0x3f)) entry->prob2++;
12111211 }
@@ -1256,7 +1256,7 @@ MONRACE_IDX get_mon_num(DEPTH level)
12561256 pls_kakuritu = MAX(NASTY_MON_MAX, NASTY_MON_BASE - ((dungeon_turn / (TURNS_PER_TICK * 5000L) - delay / 10)));
12571257 pls_level = MIN(NASTY_MON_PLUS_MAX, 3 + dungeon_turn / (TURNS_PER_TICK * 40000L) - delay / 40 + MIN(5, level / 10)) ;
12581258
1259- if (d_info[dungeon_idx].flags1 & DF1_MAZE)
1259+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_MAZE)
12601260 {
12611261 pls_kakuritu = MIN(pls_kakuritu / 2, pls_kakuritu - 10);
12621262 if (pls_kakuritu < 2) pls_kakuritu = 2;
@@ -1265,7 +1265,7 @@ MONRACE_IDX get_mon_num(DEPTH level)
12651265 }
12661266
12671267 /* Boost the level */
1268- if (!p_ptr->inside_battle && !(d_info[dungeon_idx].flags1 & DF1_BEGINNER))
1268+ if (!p_ptr->inside_battle && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
12691269 {
12701270 /* Nightmare mode allows more out-of depth monsters */
12711271 if (ironman_nightmare && !randint0(pls_kakuritu))
@@ -2262,7 +2262,7 @@ void update_monster(MONSTER_IDX m_idx, bool full)
22622262 bool easy = FALSE;
22632263
22642264 /* Non-Ninja player in the darkness */
2265- bool in_darkness = (d_info[dungeon_idx].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto;
2265+ bool in_darkness = (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto;
22662266
22672267 /* Do disturb? */
22682268 if (disturb_high)
@@ -2761,7 +2761,7 @@ void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx)
27612761 else
27622762 level = dun_level;
27632763
2764- if (d_info[dungeon_idx].flags1 & DF1_CHAMELEON) level+= 2+randint1(3);
2764+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_CHAMELEON) level+= 2+randint1(3);
27652765
27662766 r_idx = get_mon_num(level);
27672767 r_ptr = &r_info[r_idx];
@@ -3740,9 +3740,9 @@ bool alloc_horde(POSITION y, POSITION x)
37403740 */
37413741 bool alloc_guardian(bool def_val)
37423742 {
3743- MONRACE_IDX guardian = d_info[dungeon_idx].final_guardian;
3743+ MONRACE_IDX guardian = d_info[p_ptr->dungeon_idx].final_guardian;
37443744
3745- if (guardian && (d_info[dungeon_idx].maxdepth == dun_level) && (r_info[guardian].cur_num < r_info[guardian].max_num))
3745+ if (guardian && (d_info[p_ptr->dungeon_idx].maxdepth == dun_level) && (r_info[guardian].cur_num < r_info[guardian].max_num))
37463746 {
37473747 int oy;
37483748 int ox;
@@ -3882,7 +3882,7 @@ static bool summon_specific_okay(MONRACE_IDX r_idx)
38823882 monster_has_hostile_align(NULL, 10, -10, r_ptr))
38833883 return FALSE;
38843884
3885- if ((r_ptr->flags7 & RF7_CHAMELEON) && (d_info[dungeon_idx].flags1 & DF1_CHAMELEON)) return TRUE;
3885+ if ((r_ptr->flags7 & RF7_CHAMELEON) && (d_info[p_ptr->dungeon_idx].flags1 & DF1_CHAMELEON)) return TRUE;
38863886
38873887 return (summon_specific_aux(r_idx));
38883888 }
--- a/src/monsterrace-hook.c
+++ b/src/monsterrace-hook.c
@@ -118,7 +118,7 @@ bool mon_hook_dungeon(MONRACE_IDX r_idx)
118118 return TRUE;
119119 else
120120 {
121- dungeon_info_type *d_ptr = &d_info[dungeon_idx];
121+ dungeon_info_type *d_ptr = &d_info[p_ptr->dungeon_idx];
122122 if ((d_ptr->mflags8 & RF8_WILD_MOUNTAIN) &&
123123 (r_ptr->flags8 & RF8_WILD_MOUNTAIN)) return TRUE;
124124 return FALSE;
--- a/src/mspells1.c
+++ b/src/mspells1.c
@@ -1371,7 +1371,7 @@ bool make_attack_spell(MONSTER_IDX m_idx)
13711371 /* Check "projectable" */
13721372 bool direct;
13731373
1374- bool in_no_magic_dungeon = (d_info[dungeon_idx].flags1 & DF1_NO_MAGIC) && dun_level
1374+ bool in_no_magic_dungeon = (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && dun_level
13751375 && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest));
13761376
13771377 bool can_use_lite_area = FALSE;
@@ -1529,7 +1529,7 @@ bool make_attack_spell(MONSTER_IDX m_idx)
15291529
15301530 if (!(r_ptr->flags2 & RF2_STUPID))
15311531 {
1532- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS);
1532+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS);
15331533 else if ((p_ptr->pclass == CLASS_NINJA) && !can_use_lite_area) f6 &= ~(RF6_DARKNESS);
15341534 }
15351535 }
--- a/src/mspells2.c
+++ b/src/mspells2.c
@@ -286,7 +286,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
286286 bool maneable = player_has_los_bold(m_ptr->fy, m_ptr->fx);
287287 bool pet = is_pet(m_ptr);
288288
289- bool in_no_magic_dungeon = (d_info[dungeon_idx].flags1 & DF1_NO_MAGIC) && dun_level
289+ bool in_no_magic_dungeon = (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && dun_level
290290 && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest));
291291
292292 bool can_use_lite_area = FALSE;
@@ -413,7 +413,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
413413
414414 if (!(r_ptr->flags2 & RF2_STUPID))
415415 {
416- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS);
416+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS);
417417 else if (vs_ninja && !can_use_lite_area) f6 &= ~(RF6_DARKNESS);
418418 }
419419 }
--- a/src/object2.c
+++ b/src/object2.c
@@ -628,7 +628,7 @@ OBJECT_IDX get_obj_num(DEPTH level)
628628 if (level > MAX_DEPTH - 1) level = MAX_DEPTH - 1;
629629
630630 /* Boost level */
631- if ((level > 0) && !(d_info[dungeon_idx].flags1 & DF1_BEGINNER))
631+ if ((level > 0) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
632632 {
633633 /* Occasional "boost" */
634634 if (one_in_(GREAT_OBJ))
@@ -4295,14 +4295,14 @@ void apply_magic(object_type *o_ptr, DEPTH lev, BIT_FLAGS mode)
42954295 f1 = lev + 10;
42964296
42974297 /* Maximal chance of being "good" */
4298- if (f1 > d_info[dungeon_idx].obj_good) f1 = d_info[dungeon_idx].obj_good;
4298+ if (f1 > d_info[p_ptr->dungeon_idx].obj_good) f1 = d_info[p_ptr->dungeon_idx].obj_good;
42994299
43004300 /* Base chance of being "great" */
43014301 f2 = f1 * 2 / 3;
43024302
43034303 /* Maximal chance of being "great" */
4304- if ((p_ptr->pseikaku != SEIKAKU_MUNCHKIN) && (f2 > d_info[dungeon_idx].obj_great))
4305- f2 = d_info[dungeon_idx].obj_great;
4304+ if ((p_ptr->pseikaku != SEIKAKU_MUNCHKIN) && (f2 > d_info[p_ptr->dungeon_idx].obj_great))
4305+ f2 = d_info[p_ptr->dungeon_idx].obj_great;
43064306
43074307 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
43084308 {
@@ -6734,7 +6734,7 @@ bool process_warning(POSITION xx, POSITION yy)
67346734 BIT_FLAGS f5 = r_ptr->a_ability_flags1;
67356735 BIT_FLAGS f6 = r_ptr->a_ability_flags2;
67366736
6737- if (!(d_info[dungeon_idx].flags1 & DF1_NO_MAGIC))
6737+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC))
67386738 {
67396739 if (f4 & RF4_BA_CHAO) spell_damcalc_by_spellnum(MS_BALL_CHAOS, GF_CHAOS, c_ptr->m_idx, &dam_max0);
67406740 if (f5 & RF5_BA_MANA) spell_damcalc_by_spellnum(MS_BALL_MANA, GF_MANA, c_ptr->m_idx, &dam_max0);
@@ -6769,7 +6769,7 @@ bool process_warning(POSITION xx, POSITION yy)
67696769 }
67706770
67716771 /* Monster melee attacks */
6772- if (!(r_ptr->flags1 & RF1_NEVER_BLOW) && !(d_info[dungeon_idx].flags1 & DF1_NO_MELEE))
6772+ if (!(r_ptr->flags1 & RF1_NEVER_BLOW) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE))
67736773 {
67746774 if (mx <= xx + 1 && mx >= xx - 1 && my <= yy + 1 && my >= yy - 1)
67756775 {
--- a/src/player-move.c
+++ b/src/player-move.c
@@ -883,7 +883,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
883883 if ((!p_ptr->blind && !no_lite()) || !is_trap(c_ptr->feat)) c_ptr->info &= ~(CAVE_UNSAFE);
884884
885885 /* For get everything when requested hehe I'm *NASTY* */
886- if (dun_level && (d_info[dungeon_idx].flags1 & DF1_FORGET)) wiz_dark();
886+ if (dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark();
887887 if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff();
888888
889889 if (p_ptr->pclass == CLASS_NINJA)
--- a/src/player-status.c
+++ b/src/player-status.c
@@ -2813,7 +2813,7 @@ static void calc_torch(void)
28132813
28142814 /* max radius is 14 (was 5) without rewriting other code -- */
28152815 /* see cave.c:update_lite() and defines.h:LITE_MAX */
2816- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1)
2816+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1)
28172817 p_ptr->cur_lite = 1;
28182818
28192819 /*
--- a/src/quest.c
+++ b/src/quest.c
@@ -394,7 +394,7 @@ QUEST_IDX quest_number(DEPTH level)
394394 if ((quest[i].type == QUEST_TYPE_KILL_LEVEL) &&
395395 !(quest[i].flags & QUEST_FLAG_PRESET) &&
396396 (quest[i].level == level) &&
397- (quest[i].dungeon == dungeon_idx))
397+ (quest[i].dungeon == p_ptr->dungeon_idx))
398398 return (i);
399399 }
400400
@@ -411,7 +411,7 @@ QUEST_IDX random_quest_number(DEPTH level)
411411 {
412412 QUEST_IDX i;
413413
414- if (dungeon_idx != DUNGEON_ANGBAND) return 0;
414+ if (p_ptr->dungeon_idx != DUNGEON_ANGBAND) return 0;
415415
416416 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
417417 {
--- a/src/realm-hissatsu.c
+++ b/src/realm-hissatsu.c
@@ -277,7 +277,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
277277 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
278278 return NULL;
279279 }
280- if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE)
280+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
281281 {
282282 return "";
283283 }
@@ -649,7 +649,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
649649 return NULL;
650650 }
651651
652- if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE)
652+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
653653 {
654654 return "";
655655 }
@@ -849,7 +849,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
849849 y = p_ptr->y + ddy[dir];
850850 x = p_ptr->x + ddx[dir];
851851
852- if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE)
852+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
853853 {
854854 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
855855 return "";
--- a/src/rooms-fractal.c
+++ b/src/rooms-fractal.c
@@ -40,7 +40,7 @@ bool build_type9(void)
4040 light = done = FALSE;
4141 room = TRUE;
4242
43- if ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
43+ if ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
4444
4545 while (!done)
4646 {
--- a/src/rooms-normal.c
+++ b/src/rooms-normal.c
@@ -18,8 +18,8 @@ bool build_type1(void)
1818
1919 cave_type *c_ptr;
2020
21- bool curtain = (d_info[dungeon_idx].flags1 & DF1_CURTAIN) &&
22- one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 48 : 512);
21+ bool curtain = (d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
22+ one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 48 : 512);
2323
2424 /* Pick a room size */
2525 y1 = randint1(4);
@@ -47,7 +47,7 @@ bool build_type1(void)
4747 }
4848
4949 /* Choose lite or dark */
50- light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS));
50+ light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
5151
5252
5353 /* Get corner values */
@@ -163,8 +163,8 @@ bool build_type1(void)
163163 /* Hack -- Occasional divided room */
164164 else if (one_in_(50))
165165 {
166- bool curtain2 = (d_info[dungeon_idx].flags1 & DF1_CURTAIN) &&
167- one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 2 : 128);
166+ bool curtain2 = (d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
167+ one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 2 : 128);
168168
169169 if (randint1(100) < 50)
170170 {
@@ -216,7 +216,7 @@ bool build_type2(void)
216216 if (!find_space(&yval, &xval, 11, 25)) return FALSE;
217217
218218 /* Choose lite or dark */
219- light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS));
219+ light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
220220
221221 /* Determine extents of the first room */
222222 y1a = yval - randint1(4);
@@ -341,7 +341,7 @@ bool build_type3(void)
341341
342342
343343 /* Choose lite or dark */
344- light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS));
344+ light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
345345
346346 /* For now, always 3x3 */
347347 wx = wy = 1;
@@ -532,9 +532,9 @@ bool build_type3(void)
532532 /* Sometimes shut using secret doors */
533533 if (one_in_(3))
534534 {
535- int door_type = ((d_info[dungeon_idx].flags1 & DF1_CURTAIN) &&
536- one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
537- ((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
535+ int door_type = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
536+ one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
537+ ((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
538538
539539 place_secret_door(yval, x1a - 1, door_type);
540540 place_secret_door(yval, x2a + 1, door_type);
@@ -595,7 +595,7 @@ bool build_type4(void)
595595 if (!find_space(&yval, &xval, 11, 25)) return FALSE;
596596
597597 /* Choose lite or dark */
598- light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS));
598+ light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
599599
600600 /* Large room */
601601 y1 = yval - 4;
@@ -773,9 +773,9 @@ bool build_type4(void)
773773 /* Occasionally, some Inner rooms */
774774 if (one_in_(3))
775775 {
776- int door_type = ((d_info[dungeon_idx].flags1 & DF1_CURTAIN) &&
777- one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
778- ((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
776+ int door_type = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
777+ one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
778+ ((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
779779
780780 /* Long horizontal walls */
781781 for (x = xval - 5; x <= xval + 5; x++)
@@ -850,9 +850,9 @@ bool build_type4(void)
850850 /* Four small rooms. */
851851 case 5:
852852 {
853- int door_type = ((d_info[dungeon_idx].flags1 & DF1_CURTAIN) &&
854- one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
855- ((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
853+ int door_type = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
854+ one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
855+ ((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
856856
857857 /* Inner "cross" */
858858 for (y = y1; y <= y2; y++)
@@ -916,7 +916,7 @@ bool build_type11(void)
916916 int light = FALSE;
917917
918918 /* Occasional light */
919- if ((randint1(dun_level) <= 15) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
919+ if ((randint1(dun_level) <= 15) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
920920
921921 rad = randint0(9);
922922
@@ -971,7 +971,7 @@ bool build_type12(void)
971971 h4 = randint1(32) - 16;
972972
973973 /* Occasional light */
974- if ((randint1(dun_level) <= 5) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
974+ if ((randint1(dun_level) <= 5) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
975975
976976 rad = randint1(9);
977977
--- a/src/rooms-pitnest.c
+++ b/src/rooms-pitnest.c
@@ -286,7 +286,7 @@ bool build_type5(void)
286286
287287 cave_type *c_ptr;
288288
289- int cur_nest_type = pick_vault_type(nest_types, d_info[dungeon_idx].nest);
289+ int cur_nest_type = pick_vault_type(nest_types, d_info[p_ptr->dungeon_idx].nest);
290290 vault_aux_type *n_ptr;
291291
292292 /* No type available */
@@ -497,7 +497,7 @@ bool build_type6(void)
497497
498498 cave_type *c_ptr;
499499
500- int cur_pit_type = pick_vault_type(pit_types, d_info[dungeon_idx].pit);
500+ int cur_pit_type = pick_vault_type(pit_types, d_info[p_ptr->dungeon_idx].pit);
501501 vault_aux_type *n_ptr;
502502
503503 /* No type available */
@@ -802,11 +802,11 @@ bool build_type13(void)
802802
803803 cave_type *c_ptr;
804804
805- int cur_pit_type = pick_vault_type(pit_types, d_info[dungeon_idx].pit);
805+ int cur_pit_type = pick_vault_type(pit_types, d_info[p_ptr->dungeon_idx].pit);
806806 vault_aux_type *n_ptr;
807807
808808 /* Only in Angband */
809- if (dungeon_idx != DUNGEON_ANGBAND) return FALSE;
809+ if (p_ptr->dungeon_idx != DUNGEON_ANGBAND) return FALSE;
810810
811811 /* No type available */
812812 if (cur_pit_type < 0) return FALSE;
--- a/src/rooms-special.c
+++ b/src/rooms-special.c
@@ -27,7 +27,7 @@ bool build_type15(void)
2727 if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;
2828
2929 /* Choose lite or dark */
30- light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS));
30+ light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
3131
3232 /* Get corner values */
3333 y1 = yval - ysize / 2;
--- a/src/rooms-trap.c
+++ b/src/rooms-trap.c
@@ -33,7 +33,7 @@ bool build_type14(void)
3333 if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;
3434
3535 /* Choose lite or dark */
36- light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS));
36+ light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
3737
3838
3939 /* Get corner values */
--- a/src/rooms-vault.c
+++ b/src/rooms-vault.c
@@ -1186,13 +1186,13 @@ bool build_type10(void)
11861186 do
11871187 {
11881188 vtype = randint1(15);
1189- } while ((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) &&
1189+ } while ((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) &&
11901190 ((vtype == 1) || (vtype == 3) || (vtype == 8) || (vtype == 9) || (vtype == 11)));
11911191 #else /* ALLOW_CAVERNS_AND_LAKES */
11921192 do
11931193 {
11941194 vtype = randint1(7);
1195- } while ((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) &&
1195+ } while ((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) &&
11961196 ((vtype == 1) || (vtype == 3)));
11971197 #endif /* ALLOW_CAVERNS_AND_LAKES */
11981198
--- a/src/rooms.c
+++ b/src/rooms.c
@@ -411,7 +411,7 @@ bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width)
411411 }
412412
413413 /* Normal dungeon */
414- if (!(d_info[dungeon_idx].flags1 & DF1_NO_CAVE))
414+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE))
415415 {
416416 /* Choose a random one */
417417 pick = randint1(candidates);
@@ -1142,7 +1142,7 @@ void build_cavern(void)
11421142 bool done, light;
11431143
11441144 light = done = FALSE;
1145- if ((dun_level <= randint1(50)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
1145+ if ((dun_level <= randint1(50)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
11461146
11471147 /* Make a cave the size of the dungeon */
11481148 xsize = cur_wid - 1;
@@ -1309,7 +1309,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int
13091309 /* Light lava */
13101310 if (cave_have_flag_bold(y0 + y - yhsize, x0 + x - xhsize, FF_LAVA))
13111311 {
1312- if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) cave[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW;
1312+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) cave[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW;
13131313 }
13141314 }
13151315 }
@@ -1697,7 +1697,7 @@ void build_maze_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION ysize,
16971697 msg_print_wizard(CHEAT_DUNGEON, _("迷路ランダムVaultを生成しました。", "Maze Vault."));
16981698
16991699 /* Choose lite or dark */
1700- light = ((dun_level <= randint1(25)) && is_vault && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS));
1700+ light = ((dun_level <= randint1(25)) && is_vault && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
17011701
17021702 /* Pick a random room size - randomized by calling routine */
17031703 dy = ysize / 2 - 1;
@@ -2161,7 +2161,7 @@ bool generate_rooms(void)
21612161 /*! @details ダンジョンにBEGINNER、CHAMELEON、SMALLESTいずれのフラグもなく、
21622162 * かつ「常に通常でない部屋を生成する」フラグがONならば、
21632163 * GRATER_VAULTのみを生成対象とする。 / Ironman sees only Greater Vaults */
2164- if (ironman_rooms && !((d_info[dungeon_idx].flags1 & (DF1_BEGINNER | DF1_CHAMELEON | DF1_SMALLEST))))
2164+ if (ironman_rooms && !((d_info[p_ptr->dungeon_idx].flags1 & (DF1_BEGINNER | DF1_CHAMELEON | DF1_SMALLEST))))
21652165 {
21662166 for (i = 0; i < ROOM_T_MAX; i++)
21672167 {
@@ -2171,7 +2171,7 @@ bool generate_rooms(void)
21712171 }
21722172
21732173 /*! @details ダンジョンにNO_VAULTフラグがあるならば、LESSER_VAULT / GREATER_VAULT/ RANDOM_VAULTを除外 / Forbidden vaults */
2174- else if (d_info[dungeon_idx].flags1 & DF1_NO_VAULT)
2174+ else if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_VAULT)
21752175 {
21762176 prob_list[ROOM_T_LESSER_VAULT] = 0;
21772177 prob_list[ROOM_T_GREATER_VAULT] = 0;
@@ -2179,13 +2179,13 @@ bool generate_rooms(void)
21792179 }
21802180
21812181 /*! @details ダンジョンにBEGINNERフラグがあるならば、FIXED_ROOMを除外 / Forbidden vaults */
2182- if (d_info[dungeon_idx].flags1 & DF1_BEGINNER)
2182+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER)
21832183 {
21842184 prob_list[ROOM_T_FIXED] = 0;
21852185 }
21862186
21872187 /*! @details ダンジョンにNO_CAVEフラグがある場合、FRACAVEの生成枠がNORMALに与えられる。CRIPT、OVALの生成枠がINNER_Fに与えられる。/ NO_CAVE dungeon (Castle)*/
2188- if (d_info[dungeon_idx].flags1 & DF1_NO_CAVE)
2188+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE)
21892189 {
21902190 MOVE_PLIST(ROOM_T_NORMAL, ROOM_T_FRACAVE);
21912191 MOVE_PLIST(ROOM_T_INNER_FEAT, ROOM_T_CRYPT);
@@ -2193,7 +2193,7 @@ bool generate_rooms(void)
21932193 }
21942194
21952195 /*! @details ダンジョンにCAVEフラグがある場合、NORMALの生成枠がFRACAVEに与えられる。/ CAVE dungeon (Orc cave etc.) */
2196- else if (d_info[dungeon_idx].flags1 & DF1_CAVE)
2196+ else if (d_info[p_ptr->dungeon_idx].flags1 & DF1_CAVE)
21972197 {
21982198 MOVE_PLIST(ROOM_T_FRACAVE, ROOM_T_NORMAL);
21992199 }
@@ -2205,13 +2205,13 @@ bool generate_rooms(void)
22052205 }
22062206
22072207 /*! @details ダンジョンに最初からGLASS_ROOMフラグがある場合、GLASS を生成から除外。/ Forbidden glass rooms */
2208- if (!(d_info[dungeon_idx].flags1 & DF1_GLASS_ROOM))
2208+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_ROOM))
22092209 {
22102210 prob_list[ROOM_T_GLASS] = 0;
22112211 }
22122212
22132213 /*! @details ARCADEは同フラグがダンジョンにないと生成されない。 / Forbidden glass rooms */
2214- if (!(d_info[dungeon_idx].flags1 & DF1_ARCADE))
2214+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_ARCADE))
22152215 {
22162216 prob_list[ROOM_T_ARCADE] = 0;
22172217 }
--- a/src/save.c
+++ b/src/save.c
@@ -1166,7 +1166,7 @@ static bool wr_dungeon(void)
11661166 wr_s16b(max_floor_id);
11671167
11681168 /* Current dungeon type */
1169- wr_byte((byte_hack)dungeon_idx);
1169+ wr_byte((byte_hack)p_ptr->dungeon_idx);
11701170
11711171
11721172 /*** No saved floor (On the surface etc.) ***/
--- a/src/scores.c
+++ b/src/scores.c
@@ -509,7 +509,7 @@ errr top_twenty(void)
509509 sprintf(the_score.cur_lev, "%3d", MIN((u16b)p_ptr->lev, 999));
510510 sprintf(the_score.cur_dun, "%3d", (int)dun_level);
511511 sprintf(the_score.max_lev, "%3d", MIN((u16b)p_ptr->max_plv, 999));
512- sprintf(the_score.max_dun, "%3d", (int)max_dlv[dungeon_idx]);
512+ sprintf(the_score.max_dun, "%3d", (int)max_dlv[p_ptr->dungeon_idx]);
513513
514514 /* Save the cause of death (31 chars) */
515515 if (strlen(p_ptr->died_from) >= sizeof(the_score.how))
@@ -622,7 +622,7 @@ errr predict_score(void)
622622 sprintf(the_score.cur_lev, "%3d", MIN((u16b)p_ptr->lev, 999));
623623 sprintf(the_score.cur_dun, "%3d", (int)dun_level);
624624 sprintf(the_score.max_lev, "%3d", MIN((u16b)p_ptr->max_plv, 999));
625- sprintf(the_score.max_dun, "%3d", (int)max_dlv[dungeon_idx]);
625+ sprintf(the_score.max_dun, "%3d", (int)max_dlv[p_ptr->dungeon_idx]);
626626
627627 /* Hack -- no cause of death */
628628 /* まだ死んでいないときの識別文字 */
--- a/src/spells1.c
+++ b/src/spells1.c
@@ -606,7 +606,7 @@ static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P
606606 case GF_LITE:
607607 {
608608 /* Turn on the light */
609- if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS))
609+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
610610 {
611611 c_ptr->info |= (CAVE_GLOW);
612612 note_spot(y, x);
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -40,7 +40,7 @@ static bool detect_feat_flag(POSITION range, int flag, bool known)
4040 bool detect = FALSE;
4141 cave_type *c_ptr;
4242
43- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
43+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
4444
4545 /* Scan the current panel */
4646 for (y = 1; y < cur_hgt - 1; y++)
@@ -172,7 +172,7 @@ bool detect_objects_gold(POSITION range)
172172
173173 bool detect = FALSE;
174174
175- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
175+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
176176
177177 /* Scan objects */
178178 for (i = 1; i < o_max; i++)
@@ -227,7 +227,7 @@ bool detect_objects_normal(POSITION range)
227227
228228 bool detect = FALSE;
229229
230- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
230+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
231231
232232 /* Scan objects */
233233 for (i = 1; i < o_max; i++)
@@ -290,7 +290,7 @@ bool detect_objects_magic(POSITION range)
290290
291291 bool detect = FALSE;
292292
293- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
293+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
294294
295295 /* Scan all objects */
296296 for (i = 1; i < o_max; i++)
@@ -365,7 +365,7 @@ bool detect_monsters_normal(POSITION range)
365365 POSITION y, x;
366366 bool flag = FALSE;
367367
368- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
368+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
369369
370370 for (i = 1; i < m_max; i++)
371371 {
@@ -413,7 +413,7 @@ bool detect_monsters_invis(POSITION range)
413413 POSITION y, x;
414414 bool flag = FALSE;
415415
416- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
416+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
417417
418418 for (i = 1; i < m_max; i++)
419419 {
@@ -466,7 +466,7 @@ bool detect_monsters_evil(POSITION range)
466466 POSITION y, x;
467467 bool flag = FALSE;
468468
469- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
469+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
470470
471471 for (i = 1; i < m_max; i++)
472472 {
@@ -523,7 +523,7 @@ bool detect_monsters_nonliving(POSITION range)
523523 POSITION y, x;
524524 bool flag = FALSE;
525525
526- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
526+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
527527
528528 for (i = 1; i < m_max; i++)
529529 {
@@ -573,7 +573,7 @@ bool detect_monsters_mind(POSITION range)
573573 POSITION y, x;
574574 bool flag = FALSE;
575575
576- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
576+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
577577
578578 for (i = 1; i < m_max; i++)
579579 {
@@ -626,7 +626,7 @@ bool detect_monsters_string(POSITION range, concptr Match)
626626 POSITION y, x;
627627 bool flag = FALSE;
628628
629- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
629+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
630630
631631 for (i = 1; i < m_max; i++)
632632 {
@@ -681,7 +681,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
681681 bool flag = FALSE;
682682 concptr desc_monsters = _("変なモンスター", "weird monsters");
683683
684- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
684+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
685685
686686 for (i = 1; i < m_max; i++)
687687 {
@@ -1593,7 +1593,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
15931593 c_ptr = &cave[y][x];
15941594
15951595 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1596- else if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS))
1596+ else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
15971597 {
15981598 DIRECTION i;
15991599 POSITION yy, xx;
@@ -2063,7 +2063,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
20632063 c_ptr = &cave[yy][xx];
20642064
20652065 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2066- else if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS))
2066+ else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
20672067 {
20682068 DIRECTION ii;
20692069 POSITION yyy, xxx;
@@ -2616,7 +2616,7 @@ bool lite_area(HIT_POINT dam, POSITION rad)
26162616 {
26172617 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
26182618
2619- if (d_info[dungeon_idx].flags1 & DF1_DARKNESS)
2619+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
26202620 {
26212621 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
26222622 return FALSE;
@@ -4609,7 +4609,7 @@ bool_hack vampirism(void)
46094609 int dummy;
46104610 cave_type *c_ptr;
46114611
4612- if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE)
4612+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
46134613 {
46144614 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
46154615 return FALSE;
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -629,7 +629,7 @@ void teleport_level(MONSTER_IDX m_idx)
629629 }
630630
631631 /* Down only */
632- if ((ironman_downward && (m_idx <= 0)) || (dun_level <= d_info[dungeon_idx].mindepth))
632+ if ((ironman_downward && (m_idx <= 0)) || (dun_level <= d_info[p_ptr->dungeon_idx].mindepth))
633633 {
634634 #ifdef JP
635635 if (see_m) msg_format("%^sは床を突き破って沈んでいく。", m_name);
@@ -640,7 +640,7 @@ void teleport_level(MONSTER_IDX m_idx)
640640 {
641641 if (!dun_level)
642642 {
643- dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon;
643+ p_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon;
644644 p_ptr->oldpy = p_ptr->y;
645645 p_ptr->oldpx = p_ptr->x;
646646 }
@@ -651,7 +651,7 @@ void teleport_level(MONSTER_IDX m_idx)
651651
652652 if (!dun_level)
653653 {
654- dun_level = d_info[dungeon_idx].mindepth;
654+ dun_level = d_info[p_ptr->dungeon_idx].mindepth;
655655 prepare_change_floor_mode(CFM_RAND_PLACE);
656656 }
657657 else
@@ -665,7 +665,7 @@ void teleport_level(MONSTER_IDX m_idx)
665665 }
666666
667667 /* Up only */
668- else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_idx].maxdepth))
668+ else if (quest_number(dun_level) || (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth))
669669 {
670670 #ifdef JP
671671 if (see_m) msg_format("%^sは天井を突き破って宙へ浮いていく。", m_name);
@@ -721,7 +721,7 @@ void teleport_level(MONSTER_IDX m_idx)
721721 if (m_idx <= 0) /* To player */
722722 {
723723 /* Never reach this code on the surface */
724- /* if (!dun_level) dungeon_idx = p_ptr->recall_dungeon; */
724+ /* if (!dun_level) p_ptr->dungeon_idx = p_ptr->recall_dungeon; */
725725
726726 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
727727
@@ -859,13 +859,13 @@ bool recall_player(player_type *creature_ptr, TIME_EFFECT turns)
859859 return TRUE;
860860 }
861861
862- if (dun_level && (max_dlv[dungeon_idx] > dun_level) && !creature_ptr->inside_quest && !creature_ptr->word_recall)
862+ if (dun_level && (max_dlv[p_ptr->dungeon_idx] > dun_level) && !creature_ptr->inside_quest && !creature_ptr->word_recall)
863863 {
864864 if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? ")))
865865 {
866- max_dlv[dungeon_idx] = dun_level;
866+ max_dlv[p_ptr->dungeon_idx] = dun_level;
867867 if (record_maxdepth)
868- do_cmd_write_nikki(NIKKI_TRUMP, dungeon_idx, _("帰還のときに", "when recall from dungeon"));
868+ do_cmd_write_nikki(NIKKI_TRUMP, p_ptr->dungeon_idx, _("帰還のときに", "when recall from dungeon"));
869869 }
870870
871871 }
--- a/src/trap.c
+++ b/src/trap.c
@@ -65,7 +65,7 @@ FEAT_IDX choose_random_trap(void)
6565 if (p_ptr->inside_arena || quest_number(dun_level)) continue;
6666
6767 /* Hack -- no trap doors on the deepest level */
68- if (dun_level >= d_info[dungeon_idx].maxdepth) continue;
68+ if (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) continue;
6969
7070 break;
7171 }
--- a/src/types.h
+++ b/src/types.h
@@ -1026,6 +1026,7 @@ struct player_type
10261026 QUEST_IDX inside_quest; /* Inside quest level */
10271027 bool inside_battle; /* Is character inside tougijou? */
10281028
1029+ DUNGEON_IDX dungeon_idx; /* current dungeon index */
10291030 POSITION wilderness_x; /* Coordinates in the wilderness */
10301031 POSITION wilderness_y;
10311032 bool wild_mode;
--- a/src/util.c
+++ b/src/util.c
@@ -1718,7 +1718,7 @@ void select_floor_music(void)
17181718 { // TODO マクロで類似条件を統合すること
17191719 if(quest[i].status == QUEST_STATUS_TAKEN &&
17201720 (quest[i].type == QUEST_TYPE_KILL_LEVEL || quest[i].type == QUEST_TYPE_RANDOM) &&
1721- quest[i].level == dun_level && dungeon_idx == quest[i].dungeon)
1721+ quest[i].level == dun_level && p_ptr->dungeon_idx == quest[i].dungeon)
17221722 {
17231723 if(play_music(TERM_XTRA_MUSIC_QUEST, i))
17241724 {
@@ -1728,13 +1728,13 @@ void select_floor_music(void)
17281728 }
17291729 }
17301730
1731- if(dungeon_idx)
1731+ if(p_ptr->dungeon_idx)
17321732 {
17331733 if(p_ptr->feeling == 2) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL2);
17341734 else if(p_ptr->feeling >= 3 && p_ptr->feeling <= 5) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL1);
17351735 else
17361736 {
1737- if(play_music(TERM_XTRA_MUSIC_DUNGEON, dungeon_idx))
1737+ if(play_music(TERM_XTRA_MUSIC_DUNGEON, p_ptr->dungeon_idx))
17381738 {
17391739 if(dun_level < 40) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_LOW);
17401740 else if(dun_level < 80) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_MED);
--- a/src/variable.c
+++ b/src/variable.c
@@ -950,7 +950,6 @@ FEAT_IDX feat_undetected;
950950 /*
951951 * Which dungeon ?
952952 */
953-DUNGEON_IDX dungeon_idx;
954953 DEPTH *max_dlv;
955954
956955 FEAT_IDX feat_wall_outer;
--- a/src/view-mainwindow.c
+++ b/src/view-mainwindow.c
@@ -162,7 +162,7 @@ concptr map_name(void)
162162 else if (!dun_level && p_ptr->town_num)
163163 return town[p_ptr->town_num].name;
164164 else
165- return d_name+d_info[dungeon_idx].name;
165+ return d_name+d_info[p_ptr->dungeon_idx].name;
166166 }
167167
168168 /*!
@@ -936,7 +936,7 @@ static void prt_depth(void)
936936 {
937937 strcpy(depths, _("地上", "Surf."));
938938 }
939- else if (p_ptr->inside_quest && !dungeon_idx)
939+ else if (p_ptr->inside_quest && !p_ptr->dungeon_idx)
940940 {
941941 strcpy(depths, _("地上", "Quest"));
942942 }
--- a/src/wizard2.c
+++ b/src/wizard2.c
@@ -1356,7 +1356,7 @@ static void do_cmd_wiz_jump(void)
13561356 sprintf(ppp, "Jump which dungeon : ");
13571357
13581358 /* Default */
1359- sprintf(tmp_val, "%d", dungeon_idx);
1359+ sprintf(tmp_val, "%d", p_ptr->dungeon_idx);
13601360
13611361 /* Ask for a level */
13621362 if (!get_string(ppp, tmp_val, 2)) return;
@@ -1377,12 +1377,12 @@ static void do_cmd_wiz_jump(void)
13771377 /* Extract request */
13781378 command_arg = (COMMAND_ARG)atoi(tmp_val);
13791379
1380- dungeon_idx = tmp_dungeon_type;
1380+ p_ptr->dungeon_idx = tmp_dungeon_type;
13811381 }
13821382
13831383 /* Paranoia */
1384- if (command_arg < d_info[dungeon_idx].mindepth) command_arg = 0;
1385- if (command_arg > d_info[dungeon_idx].maxdepth) command_arg = (COMMAND_ARG)d_info[dungeon_idx].maxdepth;
1384+ if (command_arg < d_info[p_ptr->dungeon_idx].mindepth) command_arg = 0;
1385+ if (command_arg > d_info[p_ptr->dungeon_idx].maxdepth) command_arg = (COMMAND_ARG)d_info[p_ptr->dungeon_idx].maxdepth;
13861386
13871387 /* Accept request */
13881388 msg_format("You jump to dungeon level %d.", command_arg);
@@ -1394,7 +1394,7 @@ static void do_cmd_wiz_jump(void)
13941394
13951395 prepare_change_floor_mode(CFM_RAND_PLACE);
13961396
1397- if (!dun_level) dungeon_idx = 0;
1397+ if (!dun_level) p_ptr->dungeon_idx = 0;
13981398 p_ptr->inside_arena = FALSE;
13991399 p_ptr->wild_mode = FALSE;
14001400
@@ -2097,8 +2097,8 @@ void cheat_death(player_type *creature_ptr)
20972097 creature_ptr->inside_battle = FALSE;
20982098 leaving_quest = 0;
20992099 creature_ptr->inside_quest = 0;
2100- if (dungeon_idx) creature_ptr->recall_dungeon = dungeon_idx;
2101- dungeon_idx = 0;
2100+ if (p_ptr->dungeon_idx) creature_ptr->recall_dungeon = p_ptr->dungeon_idx;
2101+ p_ptr->dungeon_idx = 0;
21022102 if (lite_town || vanilla_town)
21032103 {
21042104 creature_ptr->wilderness_y = 1;
Show on old repository browser