*/
bool cmd_limit_cast(player_type *creature_ptr)
{
- if (creature_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC)) {
+ if (is_in_dungeon(creature_ptr) && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC)) {
msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
msg_print(NULL);
return TRUE;
return;
}
- if (!creature_ptr->current_floor_ptr->dun_level)
+ if (!is_in_dungeon(creature_ptr))
go_up = TRUE;
else
go_up = confirm_leave_level(creature_ptr, FALSE);
}
DUNGEON_IDX target_dungeon = 0;
- if (!creature_ptr->current_floor_ptr->dun_level) {
+ if (!is_in_dungeon(creature_ptr)) {
target_dungeon = has_flag(f_ptr->flags, FF_ENTRANCE) ? g_ptr->special : DUNGEON_ANGBAND;
if (ironman_downward && (target_dungeon != DUNGEON_ANGBAND)) {
msg_print(_("ダンジョンの入口は塞がれている!", "The entrance of this dungeon is closed!"));
else
down_num += 1;
- if (!creature_ptr->current_floor_ptr->dun_level) {
+ if (!is_in_dungeon(creature_ptr)) {
creature_ptr->enter_dungeon = TRUE;
down_num = d_info[creature_ptr->dungeon_idx].mindepth;
}
old_town_num = player_ptr->town_num;
if ((which == STORE_HOME) || (which == STORE_MUSEUM))
player_ptr->town_num = 1;
- if (player_ptr->current_floor_ptr->dun_level)
+ if (is_in_dungeon(player_ptr))
player_ptr->town_num = NO_TOWN;
inner_town_num = player_ptr->town_num;
return;
}
- if (!creature_ptr->current_floor_ptr->dun_level) {
+ if (!is_in_dungeon(creature_ptr)) {
msg_print(_("典型的な荒野のようだ。", "Looks like a typical wilderness."));
return;
}
}
if (is_specific_player_race(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE)) {
- if (!creature_ptr->current_floor_ptr->dun_level && !has_resist_lite(creature_ptr) && !is_invuln(creature_ptr) && is_daytime()) {
+ if (!is_in_dungeon(creature_ptr) && !has_resist_lite(creature_ptr) && !is_invuln(creature_ptr) && is_daytime()) {
if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) {
msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
bool success = FALSE;
get_mon_num_prep(creature_ptr, monster_is_fishing_target, NULL);
r_idx = get_mon_num(creature_ptr, 0,
- creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level
+ is_in_dungeon(creature_ptr) ? creature_ptr->current_floor_ptr->dun_level
: wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level,
0);
msg_print(NULL);
move_num += SGN(move_num);
if (creature_ptr->change_floor_mode & CFM_DOWN) {
- if (!creature_ptr->current_floor_ptr->dun_level)
+ if (!is_in_dungeon(creature_ptr))
move_num = d_info[creature_ptr->dungeon_idx].mindepth;
} else if (creature_ptr->change_floor_mode & CFM_UP) {
if (creature_ptr->current_floor_ptr->dun_level + move_num < d_info[creature_ptr->dungeon_idx].mindepth)
static void exit_to_wilderness(player_type *creature_ptr)
{
- if ((creature_ptr->current_floor_ptr->dun_level != 0) || (creature_ptr->dungeon_idx == 0))
+ if (is_in_dungeon(creature_ptr) || (creature_ptr->dungeon_idx == 0))
return;
creature_ptr->leaving_dungeon = TRUE;
/* Must be a "naked" floor grid */
if (g_ptr->m_idx)
continue;
- if (creature_ptr->current_floor_ptr->dun_level) {
+ if (is_in_dungeon(creature_ptr)) {
f_ptr = &f_info[g_ptr->feat];
if (max_attempts > 5000) /* Rule 1 */
}
case DIARY_WIZ_TELE:
{
- concptr to = !creature_ptr->current_floor_ptr->dun_level
+ concptr to = !is_in_dungeon(creature_ptr)
? _("地上", "the surface")
: format(_("%d階(%s)", "level %d of %s"), creature_ptr->current_floor_ptr->dun_level, d_name + d_info[creature_ptr->dungeon_idx].name);
fprintf(fff, _(" %2d:%02d %20s %sへとウィザード・テレポートで移動した。\n",
}
case DIARY_PAT_TELE:
{
- concptr to = !creature_ptr->current_floor_ptr->dun_level
+ concptr to = !is_in_dungeon(creature_ptr)
? _("地上", "the surface")
: format(_("%d階(%s)", "level %d of %s"), creature_ptr->current_floor_ptr->dun_level, d_name + d_info[creature_ptr->dungeon_idx].name);
fprintf(fff, _(" %2d:%02d %20s %sへとパターンの力で移動した。\n",
creature_ptr->oldpx = (POSITION)tmp16s;
rd_s16b(&tmp16s);
creature_ptr->oldpy = (POSITION)tmp16s;
- if (z_older_than(10, 3, 13) && !creature_ptr->current_floor_ptr->dun_level && !creature_ptr->current_floor_ptr->inside_arena) {
+ if (z_older_than(10, 3, 13) && !is_in_dungeon(creature_ptr) && !creature_ptr->current_floor_ptr->inside_arena) {
creature_ptr->oldpy = 33;
creature_ptr->oldpx = 131;
}
*/
bool mon_hook_dungeon(player_type *player_ptr, MONRACE_IDX r_idx)
{
- if (!player_ptr->current_floor_ptr->dun_level && !player_ptr->current_floor_ptr->inside_quest)
+ if (!is_in_dungeon(player_ptr) && !player_ptr->current_floor_ptr->inside_quest)
return TRUE;
monster_race *r_ptr = &r_info[r_idx];
msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
banish_monsters(creature_ptr, 100);
- if (!creature_ptr->current_floor_ptr->dun_level && creature_ptr->town_num) {
+ if (!is_in_dungeon(creature_ptr) && creature_ptr->town_num) {
int n;
do {
n = randint0(MAX_STORES);
if (creature_ptr->current_floor_ptr->inside_arena)
strcpy(buf, _("アリーナ", "in the Arena"));
- else if (!creature_ptr->current_floor_ptr->dun_level)
+ else if (!is_in_dungeon(creature_ptr))
strcpy(buf, _("地上", "on the surface"));
else if (q_idx && (is_fixed_quest_idx(q_idx) && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
strcpy(buf, _("クエスト", "in a quest"));
}
return PLAYER_HAND_MAIN;
}
+
+/*!
+ * @brief プレイヤーが現在ダンジョンに潜っているかどうかを返す。
+ * @memo 現在はdun_levelが0でないかそうでないかに限るが可読性を高めるため。
+ */
+bool is_in_dungeon(player_type *creature_ptr)
+{
+ return creature_ptr->current_floor_ptr->dun_level > 0;
+}
bool is_hero(player_type *creature_ptr);
bool is_shero(player_type *creature_ptr);
bool is_echizen(player_type *creature_ptr);
+bool is_in_dungeon(player_type *creature_ptr);
/*
* Player "food" crucial values
msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s");
#endif
if (m_idx <= 0) {
- if (!creature_ptr->current_floor_ptr->dun_level) {
+ if (!is_in_dungeon(creature_ptr)) {
creature_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : creature_ptr->recall_dungeon;
creature_ptr->oldpy = creature_ptr->y;
creature_ptr->oldpx = creature_ptr->x;
if (autosave_l)
do_cmd_save_game(creature_ptr, TRUE);
- if (!creature_ptr->current_floor_ptr->dun_level) {
+ if (!is_in_dungeon(creature_ptr)) {
creature_ptr->current_floor_ptr->dun_level = d_info[creature_ptr->dungeon_idx].mindepth;
prepare_change_floor_mode(creature_ptr, CFM_RAND_PLACE);
} else {
return TRUE;
}
- bool is_special_floor = creature_ptr->current_floor_ptr->dun_level > 0;
+ bool is_special_floor = is_in_dungeon(creature_ptr);
is_special_floor &= max_dlv[creature_ptr->dungeon_idx] > creature_ptr->current_floor_ptr->dun_level;
is_special_floor &= !creature_ptr->current_floor_ptr->inside_quest;
is_special_floor &= !creature_ptr->word_recall;
return TRUE;
}
- if (!creature_ptr->current_floor_ptr->dun_level) {
+ if (!is_in_dungeon(creature_ptr)) {
DUNGEON_IDX select_dungeon;
select_dungeon = choose_dungeon(_("に帰還", "recall"), 2, 14);
if (!select_dungeon)
creature_ptr->current_floor_ptr->dun_level = command_arg;
prepare_change_floor_mode(creature_ptr, CFM_RAND_PLACE);
- if (!creature_ptr->current_floor_ptr->dun_level)
+ if (!is_in_dungeon(creature_ptr))
creature_ptr->dungeon_idx = 0;
creature_ptr->current_floor_ptr->inside_arena = FALSE;