From 8601160dbf33565c79884a7c0d064bc47ead8be4 Mon Sep 17 00:00:00 2001 From: Hourier Date: Wed, 29 Apr 2020 23:03:00 +0900 Subject: [PATCH] [Refactor] #39963 Moved TELEPORT_* from spells.h to spells-util.h and made them enum as teleport_flags --- src/cmd/cmd-activate.c | 8 ++++---- src/cmd/cmd-basic.c | 2 +- src/cmd/cmd-mane.c | 4 ++-- src/cmd/cmd-read.c | 4 ++-- src/combat/melee.c | 6 +++--- src/core.c | 4 ++-- src/grid.c | 5 ++--- src/grid.h | 5 +++-- src/mind.c | 16 ++++++++-------- src/mspells3.c | 4 ++-- src/mspells4.c | 5 ++--- src/mutation.c | 4 ++-- src/racial.c | 2 +- src/realm/realm-arcane.c | 4 ++-- src/realm/realm-chaos.c | 2 +- src/realm/realm-crusade.c | 2 +- src/realm/realm-hex.c | 4 ++-- src/realm/realm-hissatsu.c | 4 ++-- src/realm/realm-sorcery.c | 4 ++-- src/realm/realm-trump.c | 4 ++-- src/spell/spells-util.h | 22 +++++++++++++++++----- src/spells.h | 19 ++++--------------- src/spells2.c | 4 ++-- src/spells3.c | 20 ++++++++++---------- src/wizard2.c | 4 ++-- 25 files changed, 81 insertions(+), 81 deletions(-) diff --git a/src/cmd/cmd-activate.c b/src/cmd/cmd-activate.c index b9702be45..56ef3d723 100644 --- a/src/cmd/cmd-activate.c +++ b/src/cmd/cmd-activate.c @@ -1533,7 +1533,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr) case ACT_TELEPORT: { msg_print(_("周りの空間が歪んでいる...", "It twists space around you...")); - teleport_player(user_ptr, 100, 0L); + teleport_player(user_ptr, 100, TELEPORT_SPONTANEOUS); break; } @@ -1603,10 +1603,10 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr) switch (randint1(13)) { case 1: case 2: case 3: case 4: case 5: - teleport_player(user_ptr, 10, 0L); + teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS); break; case 6: case 7: case 8: case 9: case 10: - teleport_player(user_ptr, 222, 0L); + teleport_player(user_ptr, 222, TELEPORT_SPONTANEOUS); break; case 11: case 12: (void)stair_creation(user_ptr); @@ -1659,7 +1659,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr) case ACT_PHASE_DOOR: { - teleport_player(user_ptr, 10, 0L); + teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS); break; } diff --git a/src/cmd/cmd-basic.c b/src/cmd/cmd-basic.c index 03d401145..48a288486 100644 --- a/src/cmd/cmd-basic.c +++ b/src/cmd/cmd-basic.c @@ -2267,7 +2267,7 @@ void do_cmd_fire(player_type *creature_ptr, SPELL_IDX snipe_type) /* Sniper actions after some shootings */ if (snipe_type == SP_AWAY) { - teleport_player(creature_ptr, 10 + (creature_ptr->concent * 2), 0L); + teleport_player(creature_ptr, 10 + (creature_ptr->concent * 2), TELEPORT_SPONTANEOUS); } if (snipe_type == SP_FINAL) diff --git a/src/cmd/cmd-mane.c b/src/cmd/cmd-mane.c index aff34cbd5..5ca49ad07 100644 --- a/src/cmd/cmd-mane.c +++ b/src/cmd/cmd-mane.c @@ -665,10 +665,10 @@ static bool use_mane(player_type *caster_ptr, int spell) (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE); break; case MS_BLINK: - teleport_player(caster_ptr, 10, 0L); + teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS); break; case MS_TELEPORT: - teleport_player(caster_ptr, plev * 5, 0L); + teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS); break; case MS_WORLD: (void)time_walk(caster_ptr); diff --git a/src/cmd/cmd-read.c b/src/cmd/cmd-read.c index 407b194e9..943b3a3c0 100644 --- a/src/cmd/cmd-read.c +++ b/src/cmd/cmd-read.c @@ -169,14 +169,14 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known) case SV_SCROLL_PHASE_DOOR: { - teleport_player(creature_ptr, 10, 0L); + teleport_player(creature_ptr, 10, TELEPORT_SPONTANEOUS); ident = TRUE; break; } case SV_SCROLL_TELEPORT: { - teleport_player(creature_ptr, 100, 0L); + teleport_player(creature_ptr, 100, TELEPORT_SPONTANEOUS); ident = TRUE; break; } diff --git a/src/combat/melee.c b/src/combat/melee.c index 91489a5df..f2649e38b 100644 --- a/src/combat/melee.c +++ b/src/combat/melee.c @@ -3838,7 +3838,7 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx) if (is_mirror_grid(&floor_ptr->grid_array[target_ptr->y][target_ptr->x])) { - teleport_player(target_ptr, 10, 0L); + teleport_player(target_ptr, 10, TELEPORT_SPONTANEOUS); } } @@ -4088,7 +4088,7 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx) else { msg_print(_("泥棒は笑って逃げた!", "The thief flees laughing!")); - teleport_away(target_ptr, m_idx, MAX_SIGHT * 2 + 5, 0L); + teleport_away(target_ptr, m_idx, MAX_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS); } } @@ -4719,7 +4719,7 @@ bool monst_attack_monst(player_type *subject_ptr, MONSTER_IDX m_idx, MONSTER_IDX subject_ptr->current_floor_ptr->monster_noise = TRUE; } - teleport_away(subject_ptr, m_idx, MAX_SIGHT * 2 + 5, 0L); + teleport_away(subject_ptr, m_idx, MAX_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS); } return TRUE; diff --git a/src/core.c b/src/core.c index 84b2f8c15..c38ed07e2 100644 --- a/src/core.c +++ b/src/core.c @@ -572,7 +572,7 @@ static void pattern_teleport(player_type *creature_ptr) } else if (get_check(_("通常テレポート?", "Normal teleport? "))) { - teleport_player(creature_ptr, 200, 0L); + teleport_player(creature_ptr, 200, TELEPORT_SPONTANEOUS); return; } else @@ -2294,7 +2294,7 @@ static void process_world_aux_curse(player_type *creature_ptr) if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL)) { disturb(creature_ptr, FALSE, TRUE); - teleport_player(creature_ptr, 50, 0L); + teleport_player(creature_ptr, 50, TELEPORT_SPONTANEOUS); } else { diff --git a/src/grid.c b/src/grid.c index e8c5bddb5..256d4b235 100644 --- a/src/grid.c +++ b/src/grid.c @@ -34,7 +34,6 @@ #include "player-status.h" #include "player-effects.h" #include "player-class.h" -#include "spells.h" #include "view/display-main-window.h" #include "realm/realm-song.h" @@ -1103,7 +1102,7 @@ bool is_explosive_rune_grid(grid_type *g_ptr) * @param mode オプション * @return テレポート先として妥当ならばtrue */ -bool cave_monster_teleportable_bold(player_type *player_ptr, MONSTER_IDX m_idx, POSITION y, POSITION x, BIT_FLAGS mode) +bool cave_monster_teleportable_bold(player_type *player_ptr, MONSTER_IDX m_idx, POSITION y, POSITION x, teleport_flags mode) { monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx]; grid_type *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x]; @@ -1135,7 +1134,7 @@ bool cave_monster_teleportable_bold(player_type *player_ptr, MONSTER_IDX m_idx, * @param mode オプション * @return テレポート先として妥当ならばtrue */ -bool cave_player_teleportable_bold(player_type *player_ptr, POSITION y, POSITION x, BIT_FLAGS mode) +bool cave_player_teleportable_bold(player_type *player_ptr, POSITION y, POSITION x, teleport_flags mode) { grid_type *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; diff --git a/src/grid.h b/src/grid.h index 29da5e3ee..27b14a111 100644 --- a/src/grid.h +++ b/src/grid.h @@ -14,6 +14,7 @@ * included in all such copies. */ +#include "spell/spells-util.h" /* * A single "grid" in a Cave @@ -199,8 +200,8 @@ extern void remove_mirror(player_type *caster_ptr, POSITION y, POSITION x); extern bool is_open(player_type *player_ptr, FEAT_IDX feat); extern bool check_local_illumination(player_type *creature_ptr, POSITION y, POSITION x); -extern bool cave_monster_teleportable_bold(player_type *player_ptr, MONSTER_IDX m_idx, POSITION y, POSITION x, BIT_FLAGS mode); -extern bool cave_player_teleportable_bold(player_type *player_ptr, POSITION y, POSITION x, BIT_FLAGS mode); +extern bool cave_monster_teleportable_bold(player_type *player_ptr, MONSTER_IDX m_idx, POSITION y, POSITION x, teleport_flags mode); +extern bool cave_player_teleportable_bold(player_type *player_ptr, POSITION y, POSITION x, teleport_flags mode); typedef enum { diff --git a/src/mind.c b/src/mind.c index e19d4e0a1..0d102dad8 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1077,11 +1077,11 @@ static bool cast_mindcrafter_spell(player_type *caster_ptr, int spell) break; case 2: /* Minor displace */ - teleport_player(caster_ptr, 10, 0L); + teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS); break; case 3: /* Major displace */ - teleport_player(caster_ptr, plev * 5, 0L); + teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS); break; case 4: /* Domination */ @@ -1357,7 +1357,7 @@ static bool cast_mirror_spell(player_type *caster_ptr, int spell) break; /* warped mirror */ case 3: - teleport_player(caster_ptr, 10, 0L); + teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS); break; /* mirror of light */ case 4: @@ -1365,7 +1365,7 @@ static bool cast_mirror_spell(player_type *caster_ptr, int spell) break; /* mirror of wandering */ case 5: - teleport_player(caster_ptr, plev * 5, 0L); + teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS); break; /* robe of dust */ case 6: @@ -1570,7 +1570,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell) break; case 2: { - teleport_player(caster_ptr, 10, 0L); + teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS); break; } case 3: @@ -1585,7 +1585,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell) } case 4: { - teleport_player(caster_ptr, caster_ptr->lev * 5, 0L); + teleport_player(caster_ptr, caster_ptr->lev * 5, TELEPORT_SPONTANEOUS); break; } case 5: @@ -1606,7 +1606,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell) break; case 9: fire_ball(caster_ptr, GF_FIRE, 0, 50+plev, plev/10+2); - teleport_player(caster_ptr, 30, 0L); + teleport_player(caster_ptr, 30, TELEPORT_SPONTANEOUS); set_oppose_fire(caster_ptr, (TIME_EFFECT)plev, FALSE); break; case 10: @@ -1665,7 +1665,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell) fire_ball(caster_ptr, GF_POIS, 0, 75+plev*2/3, plev/5+2); fire_ball(caster_ptr, GF_HYPODYNAMIA, 0, 75+plev*2/3, plev/5+2); fire_ball(caster_ptr, GF_CONFUSION, 0, 75+plev*2/3, plev/5+2); - teleport_player(caster_ptr, 30, 0L); + teleport_player(caster_ptr, 30, TELEPORT_SPONTANEOUS); break; case 18: { diff --git a/src/mspells3.c b/src/mspells3.c index a4f26aebf..4eedab3b9 100644 --- a/src/mspells3.c +++ b/src/mspells3.c @@ -1301,10 +1301,10 @@ static bool cast_learned_spell(player_type *caster_ptr, int spell, bool success) (void)set_invuln(caster_ptr, randint1(4) + 4, FALSE); break; case MS_BLINK: - teleport_player(caster_ptr, 10, 0L); + teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS); break; case MS_TELEPORT: - teleport_player(caster_ptr, plev * 5, 0L); + teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS); break; case MS_WORLD: (void)time_walk(caster_ptr); diff --git a/src/mspells4.c b/src/mspells4.c index cd7af9eda..a9923ccbe 100644 --- a/src/mspells4.c +++ b/src/mspells4.c @@ -2013,7 +2013,7 @@ void spell_RF6_BLINK(player_type *target_ptr, MONSTER_IDX m_idx, int TARGET_TYPE if (see_monster(floor_ptr, m_idx)) msg_format(_("%^sが瞬時に消えた。", "%^s blinks away."), m_name); - teleport_away(target_ptr, m_idx, 10, 0L); + teleport_away(target_ptr, m_idx, 10, TELEPORT_SPONTANEOUS); if (TARGET_TYPE == MONSTER_TO_PLAYER) target_ptr->update |= (PU_MONSTERS); @@ -2079,7 +2079,6 @@ HIT_POINT spell_RF6_SPECIAL_BANORLUPART(player_type *target_ptr, MONSTER_IDX m_i floor_type *floor_ptr = target_ptr->current_floor_ptr; monster_type *m_ptr = &floor_ptr->m_list[m_idx]; HIT_POINT dummy_hp, dummy_maxhp; - MONSTER_IDX k; POSITION dummy_y = m_ptr->fy; POSITION dummy_x = m_ptr->fx; BIT_FLAGS mode = 0L; @@ -2112,7 +2111,7 @@ HIT_POINT spell_RF6_SPECIAL_BANORLUPART(player_type *target_ptr, MONSTER_IDX m_i if (!r_info[MON_BANOR].cur_num || !r_info[MON_LUPART].cur_num) return -1; - for (k = 1; k < floor_ptr->m_max; k++) + for (MONSTER_IDX k = 1; k < floor_ptr->m_max; k++) { if (floor_ptr->m_list[k].r_idx == MON_BANOR || floor_ptr->m_list[k].r_idx == MON_LUPART) { diff --git a/src/mutation.c b/src/mutation.c index af3819d3e..25d07b66d 100644 --- a/src/mutation.c +++ b/src/mutation.c @@ -1604,7 +1604,7 @@ bool exe_mutation_power(player_type *creature_ptr, int power) case MUT1_VTELEPORT: msg_print(_("集中している...", "You concentrate...")); - teleport_player(creature_ptr, 10 + 4 * lvl, 0L); + teleport_player(creature_ptr, 10 + 4 * lvl, TELEPORT_SPONTANEOUS); break; case MUT1_MIND_BLST: @@ -1633,7 +1633,7 @@ bool exe_mutation_power(player_type *creature_ptr, int power) break; case MUT1_BLINK: - teleport_player(creature_ptr, 10, 0L); + teleport_player(creature_ptr, 10, TELEPORT_SPONTANEOUS); break; case MUT1_EAT_ROCK: diff --git a/src/racial.c b/src/racial.c index 7c4e6afcf..715c3d7fc 100644 --- a/src/racial.c +++ b/src/racial.c @@ -657,7 +657,7 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command) case RACE_GNOME: msg_print(_("パッ!", "Blink!")); - teleport_player(creature_ptr, 10, 0L); + teleport_player(creature_ptr, 10, TELEPORT_SPONTANEOUS); break; case RACE_HALF_ORC: diff --git a/src/realm/realm-arcane.c b/src/realm/realm-arcane.c index 8276a456c..bf876dde6 100644 --- a/src/realm/realm-arcane.c +++ b/src/realm/realm-arcane.c @@ -111,7 +111,7 @@ concptr do_arcane_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mod if (cast) { - teleport_player(caster_ptr, range, 0L); + teleport_player(caster_ptr, range, TELEPORT_SPONTANEOUS); } } break; @@ -343,7 +343,7 @@ concptr do_arcane_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mod if (cast) { - teleport_player(caster_ptr, range, 0L); + teleport_player(caster_ptr, range, TELEPORT_SPONTANEOUS); } } break; diff --git a/src/realm/realm-chaos.c b/src/realm/realm-chaos.c index 9c3f61558..5af248474 100644 --- a/src/realm/realm-chaos.c +++ b/src/realm/realm-chaos.c @@ -186,7 +186,7 @@ concptr do_chaos_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode if (cast) { - teleport_player(caster_ptr, range, 0L); + teleport_player(caster_ptr, range, TELEPORT_SPONTANEOUS); } } break; diff --git a/src/realm/realm-crusade.c b/src/realm/realm-crusade.c index a23b7a480..451a8f1b1 100644 --- a/src/realm/realm-crusade.c +++ b/src/realm/realm-crusade.c @@ -102,7 +102,7 @@ concptr do_crusade_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mo { POSITION range = 25 + plev / 2; if (info) return info_range(range); - if (cast) teleport_player(caster_ptr, range, 0L); + if (cast) teleport_player(caster_ptr, range, TELEPORT_SPONTANEOUS); } break; diff --git a/src/realm/realm-hex.c b/src/realm/realm-hex.c index 383908226..0b66146bf 100644 --- a/src/realm/realm-hex.c +++ b/src/realm/realm-hex.c @@ -1040,12 +1040,12 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode) if (flag && randint0(plev * plev / 2)) { - teleport_player_to(caster_ptr, y, x, 0L); + teleport_player_to(caster_ptr, y, x, TELEPORT_SPONTANEOUS); } else { msg_print(_("おっと!", "Oops!")); - teleport_player(caster_ptr, 30, 0L); + teleport_player(caster_ptr, 30, TELEPORT_SPONTANEOUS); } add = FALSE; diff --git a/src/realm/realm-hissatsu.c b/src/realm/realm-hissatsu.c index d1d2f2092..681f62aa8 100644 --- a/src/realm/realm-hissatsu.c +++ b/src/realm/realm-hissatsu.c @@ -803,7 +803,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type m if (!tgt_pt(caster_ptr, &x, &y)) return NULL; - if (!cave_player_teleportable_bold(caster_ptr, y, x, 0L) || + if (!cave_player_teleportable_bold(caster_ptr, y, x, TELEPORT_SPONTANEOUS) || (distance(y, x, caster_ptr->y, caster_ptr->x) > MAX_SIGHT / 2) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) { @@ -816,7 +816,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type m break; } project(caster_ptr, 0, 0, y, x, HISSATSU_ISSEN, GF_ATTACK, PROJECT_BEAM | PROJECT_KILL, -1); - teleport_player_to(caster_ptr, y, x, 0L); + teleport_player_to(caster_ptr, y, x, TELEPORT_SPONTANEOUS); } break; diff --git a/src/realm/realm-sorcery.c b/src/realm/realm-sorcery.c index 59591e4d5..1e31154d8 100644 --- a/src/realm/realm-sorcery.c +++ b/src/realm/realm-sorcery.c @@ -58,7 +58,7 @@ concptr do_sorcery_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mo if (cast) { - teleport_player(caster_ptr, range, 0L); + teleport_player(caster_ptr, range, TELEPORT_SPONTANEOUS); } } break; @@ -128,7 +128,7 @@ concptr do_sorcery_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mo if (cast) { - teleport_player(caster_ptr, range, 0L); + teleport_player(caster_ptr, range, TELEPORT_SPONTANEOUS); } } break; diff --git a/src/realm/realm-trump.c b/src/realm/realm-trump.c index f4b259f7b..77bf41f86 100644 --- a/src/realm/realm-trump.c +++ b/src/realm/realm-trump.c @@ -44,7 +44,7 @@ concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode if (cast) { - teleport_player(caster_ptr, range, 0L); + teleport_player(caster_ptr, range, TELEPORT_SPONTANEOUS); } } break; @@ -105,7 +105,7 @@ concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode if (cast) { - teleport_player(caster_ptr, range, 0L); + teleport_player(caster_ptr, range, TELEPORT_SPONTANEOUS); } } break; diff --git a/src/spell/spells-util.h b/src/spell/spells-util.h index 15b92d55a..787b287be 100644 --- a/src/spell/spells-util.h +++ b/src/spell/spells-util.h @@ -1,6 +1,10 @@ #pragma once -typedef enum +#define DETECT_RAD_DEFAULT 30 +#define DETECT_RAD_MAP 30 +#define DETECT_RAD_ALL 255 + +typedef enum spell_type { SPELL_NAME = 0, SPELL_DESC = 1, @@ -11,9 +15,17 @@ typedef enum SPELL_CONT = 6 } spell_type; -typedef enum +typedef enum spell_operation { - SPOP_DISPLAY_MES = 0x0001, // !< スペル処理オプション … メッセージを表示する - SPOP_NO_UPDATE = 0x0002, // !< スペル処理オプション … ステータス更新を解決後行う - SPOP_DEBUG = 0x8000, // !< スペル処理オプション … デバッグ処理あり + SPOP_DISPLAY_MES = 0x0001, // !< スペル処理オプション … メッセージを表示する + SPOP_NO_UPDATE = 0x0002, // !< スペル処理オプション … ステータス更新を解決後行う + SPOP_DEBUG = 0x8000 // !< スペル処理オプション … デバッグ処理あり } spell_operation; + +typedef enum teleport_flags +{ + TELEPORT_SPONTANEOUS = 0x0000, + TELEPORT_NONMAGICAL = 0x0001, + TELEPORT_PASSIVE = 0x0002, + TELEPORT_DEC_VALOUR = 0x0004 +} teleport_flags; diff --git a/src/spells.h b/src/spells.h index eb75f0caa..1c306c5f4 100644 --- a/src/spells.h +++ b/src/spells.h @@ -1,10 +1,6 @@ #pragma once #include "realm/realm.h" -#define DETECT_RAD_DEFAULT 30 -#define DETECT_RAD_MAP 30 -#define DETECT_RAD_ALL 255 - /* spells1.c */ extern bool in_disintegration_range(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2); extern void breath_shape(player_type *caster_ptr, u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *gy, POSITION *gm, POSITION *pgm_rad, POSITION rad, POSITION y1, POSITION x1, POSITION y2, POSITION x2, EFFECT_ID typ); @@ -137,20 +133,13 @@ extern bool clear_mind(player_type *creature_ptr); extern bool concentration(player_type *creature_ptr); extern bool vanish_dungeon(player_type *caster_ptr); -/* - * Bit flags for teleportation - */ -#define TELEPORT_NONMAGICAL 0x00000001 -#define TELEPORT_PASSIVE 0x00000002 -#define TELEPORT_DEC_VALOUR 0x00000004 - /* spells3.c */ -extern bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode); -extern void teleport_monster_to(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, BIT_FLAGS mode); -extern bool teleport_player_aux(player_type *creature_ptr, POSITION dis, bool is_quantum_effect, BIT_FLAGS mode); +extern bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, teleport_flags mode); +extern void teleport_monster_to(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, teleport_flags mode); +extern bool teleport_player_aux(player_type *creature_ptr, POSITION dis, bool is_quantum_effect, teleport_flags mode); extern void teleport_player(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode); extern void teleport_player_away(MONSTER_IDX m_idx, player_type *target_ptr, POSITION dis, bool is_quantum_effect); -extern void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mode); +extern void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, teleport_flags mode); extern void teleport_away_followable(player_type *creature_ptr, MONSTER_IDX m_idx); extern bool teleport_level_other(player_type *caster_ptr); extern void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx); diff --git a/src/spells2.c b/src/spells2.c index a019d60c5..038a135b6 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -2862,7 +2862,7 @@ bool kawarimi(player_type *caster_ptr, bool success) POSITION y = caster_ptr->y; POSITION x = caster_ptr->x; - teleport_player(caster_ptr, 10 + randint1(90), 0L); + teleport_player(caster_ptr, 10 + randint1(90), TELEPORT_SPONTANEOUS); object_wipe(q_ptr); object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE)); @@ -3909,7 +3909,7 @@ bool hit_and_away(player_type *caster_ptr) if (randint0(caster_ptr->skill_dis) < 7) msg_print(_("うまく逃げられなかった。", "You failed to run away.")); else - teleport_player(caster_ptr, 30, 0L); + teleport_player(caster_ptr, 30, TELEPORT_SPONTANEOUS); return TRUE; } diff --git a/src/spells3.c b/src/spells3.c index c787d6345..b6969e766 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -85,7 +85,7 @@ static bool redraw_player(player_type *caster_ptr); * Attempt to move the monster at least "dis/2" grids away. * But allow variation to prevent infinite loops. */ -bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode) +bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, teleport_flags mode) { monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx]; if (!monster_is_valid(m_ptr)) return FALSE; @@ -162,7 +162,7 @@ bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT * @param mode オプション * @return なし */ -void teleport_monster_to(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, BIT_FLAGS mode) +void teleport_monster_to(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, teleport_flags mode) { monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx]; if(!m_ptr->r_idx) return; @@ -244,7 +244,7 @@ void teleport_monster_to(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION ty * of candidates has equal possibility to be choosen as a destination. * */ -bool teleport_player_aux(player_type *creature_ptr, POSITION dis, bool is_quantum_effect, BIT_FLAGS mode) +bool teleport_player_aux(player_type *creature_ptr, POSITION dis, bool is_quantum_effect, teleport_flags mode) { if (creature_ptr->wild_mode) return FALSE; if (!is_quantum_effect && creature_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL)) @@ -353,7 +353,7 @@ void teleport_player(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode) is_resistible &= MON_CSLEEP(m_ptr) == 0; if (is_resistible) { - teleport_monster_to(creature_ptr, tmp_m_idx, creature_ptr->y, creature_ptr->x, r_ptr->level, 0L); + teleport_monster_to(creature_ptr, tmp_m_idx, creature_ptr->y, creature_ptr->x, r_ptr->level, TELEPORT_SPONTANEOUS); } } } @@ -396,7 +396,7 @@ void teleport_player_away(MONSTER_IDX m_idx, player_type *target_ptr, POSITION d is_resistible &= MON_CSLEEP(m_ptr) == 0; if (is_resistible) { - teleport_monster_to(target_ptr, tmp_m_idx, target_ptr->y, target_ptr->x, r_ptr->level, 0L); + teleport_monster_to(target_ptr, tmp_m_idx, target_ptr->y, target_ptr->x, r_ptr->level, TELEPORT_SPONTANEOUS); } } } @@ -417,7 +417,7 @@ void teleport_player_away(MONSTER_IDX m_idx, player_type *target_ptr, POSITION d * This function allows teleporting into vaults (!) * */ -void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mode) +void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, teleport_flags mode) { if (creature_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL)) { @@ -465,7 +465,7 @@ void teleport_away_followable(player_type *tracer_ptr, MONSTER_IDX m_idx) bool old_ml = m_ptr->ml; POSITION old_cdis = m_ptr->cdis; - teleport_away(tracer_ptr, m_idx, MAX_SIGHT * 2 + 5, 0L); + teleport_away(tracer_ptr, m_idx, MAX_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS); bool is_followable = old_ml; is_followable &= old_cdis <= MAX_SIGHT; @@ -508,7 +508,7 @@ void teleport_away_followable(player_type *tracer_ptr, MONSTER_IDX m_idx) } else { - teleport_player_to(tracer_ptr, m_ptr->fy, m_ptr->fx, 0L); + teleport_player_to(tracer_ptr, m_ptr->fy, m_ptr->fx, TELEPORT_SPONTANEOUS); } tracer_ptr->energy_need += ENERGY_NEED(); @@ -2507,7 +2507,7 @@ static bool dimension_door_aux(player_type *caster_ptr, POSITION x, POSITION y) caster_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L); - if (!cave_player_teleportable_bold(caster_ptr, y, x, 0L) || + if (!cave_player_teleportable_bold(caster_ptr, y, x, TELEPORT_SPONTANEOUS) || (distance(y, x, caster_ptr->y, caster_ptr->x) > plev / 2 + 10) || (!randint0(plev / 10 + 10))) { @@ -2516,7 +2516,7 @@ static bool dimension_door_aux(player_type *caster_ptr, POSITION x, POSITION y) return FALSE; } - teleport_player_to(caster_ptr, y, x, 0L); + teleport_player_to(caster_ptr, y, x, TELEPORT_SPONTANEOUS); return TRUE; } diff --git a/src/wizard2.c b/src/wizard2.c index 2b1ea61aa..3084774f3 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1850,7 +1850,7 @@ void do_cmd_debug(player_type *creature_ptr) /* Phase Door */ case 'p': - teleport_player(creature_ptr, 10, 0L); + teleport_player(creature_ptr, 10, TELEPORT_SPONTANEOUS); break; /* Take a Quests */ @@ -1921,7 +1921,7 @@ void do_cmd_debug(player_type *creature_ptr) /* Teleport */ case 't': - teleport_player(creature_ptr, 100, 0L); + teleport_player(creature_ptr, 100, TELEPORT_SPONTANEOUS); break; /* Game Time Setting */ -- 2.11.0