From: 火炎の飛竜 <87808091+Slimebreath6078@users.noreply.github.com> Date: Sun, 3 Mar 2024 13:40:54 +0000 (+0900) Subject: Merge pull request #3814 from Slimebreath6078/feature/Add_Laffey_II X-Git-Tag: 3.0.1.8-release^2~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=6d9388145abdf476b2ace2dbb47f2ad2d8948e8f;hp=e061469087a3d4a38ef82a2bb1b13fba8ee015ea;p=hengbandforosx%2Fhengbandosx.git Merge pull request #3814 from Slimebreath6078/feature/Add_Laffey_II モンスター「ラフィーII」実装 --- diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index ffbc8921c..651e388a9 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -1453,12 +1453,7 @@ - - - - - @@ -2047,4 +2042,4 @@ - + \ No newline at end of file diff --git a/configure.ac b/configure.ac index 2ca5b23b5..1dac5aee8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(hengband, 3.0.1.6-Beta) +AC_INIT(hengband, 3.0.1.7-Beta) AC_CONFIG_MACRO_DIRS([m4]) AC_CONFIG_HEADERS(src/autoconf.h) diff --git a/doxygen/Hengband.doxyfile b/doxygen/Hengband.doxyfile index 374b63fb7..58ae90d1e 100644 --- a/doxygen/Hengband.doxyfile +++ b/doxygen/Hengband.doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = Hengband # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 3.0.1.6-Beta +PROJECT_NUMBER = 3.0.1.7-Beta # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/hengband.spec b/hengband.spec index 09aee208a..fd056c9c9 100644 --- a/hengband.spec +++ b/hengband.spec @@ -1,4 +1,4 @@ -%define version 3.0.1.6 +%define version 3.0.1.7 %define release 1 Summary: hengband %{version} @@ -95,6 +95,9 @@ exit 0 %license lib/help/jlicense.txt %changelog +* Mon Feb 05 2024 Shiro Hara +- hengband RPM 3.0.1.7(Beta) + * Mon Jan 22 2024 Shiro Hara - hengband RPM 3.0.1.6(Beta) diff --git a/lib/edit/MonsterRaceDefinitions.txt b/lib/edit/MonsterRaceDefinitions.txt index 9052dd064..10b71782f 100644 --- a/lib/edit/MonsterRaceDefinitions.txt +++ b/lib/edit/MonsterRaceDefinitions.txt @@ -26478,7 +26478,7 @@ D:とは言え普通は、巨大でしつこい死を呼ぶトカゲを投入す N:1322:溶岩の怪物『ヨガン』 E:Magman,Lava monster G:~:R -I:107:30d100:20:110:70:0 +I:107:30d100:20:110:70 W:50:4:15000:0:0 B:TOUCH:FIRE:12d8 B:TOUCH:FIRE:12d8 @@ -27121,7 +27121,7 @@ N:1354:赤チォコヴォLv99 E:Lv.99 Red Chiokovo G:B:R I:135:80d100:30:150:10 -W:99:6:80000:0:0:0 +W:99:6:80000:0:0 B:CLAW:HURT:10d10 B:CRUSH:HURT:8d13 B:KICK:HURT:30d5 diff --git a/src/Makefile.am b/src/Makefile.am index b0e1efe74..e6566dd24 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -519,9 +519,6 @@ hengband_SOURCES = \ monster-race/race-drop-flags.h \ monster-race/race-feature-flags.h \ monster-race/race-flags-resistance.h \ - monster-race/race-flags1.h monster-race/race-flags2.h \ - monster-race/race-flags3.h \ - monster-race/race-flags7.h monster-race/race-flags8.h \ monster-race/race-indice-types.h \ monster-race/race-kind-flags.h \ monster-race/race-misc-flags.h \ diff --git a/src/action/movement-execution.cpp b/src/action/movement-execution.cpp index 3c735c3f6..d255c2c10 100644 --- a/src/action/movement-execution.cpp +++ b/src/action/movement-execution.cpp @@ -20,10 +20,6 @@ #include "main/sound-of-music.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" -#include "monster-race/race-flags8.h" #include "monster-race/race-indice-types.h" #include "monster-race/race-resistance-mask.h" #include "monster/monster-describer.h" @@ -169,7 +165,7 @@ void exe_movement(PlayerType *player_ptr, DIRECTION dir, bool do_pickup, bool br std::string m_name; bool can_move = true; bool do_past = false; - if (grid.m_idx && (m_ptr->ml || p_can_enter || p_can_kill_walls)) { + if (grid.has_monster() && (m_ptr->ml || p_can_enter || p_can_kill_walls)) { auto *r_ptr = &m_ptr->get_monrace(); auto effects = player_ptr->effects(); auto is_stunned = effects->stun()->is_stunned(); diff --git a/src/action/mutation-execution.cpp b/src/action/mutation-execution.cpp index 2aef5578b..604179295 100644 --- a/src/action/mutation-execution.cpp +++ b/src/action/mutation-execution.cpp @@ -19,8 +19,6 @@ #include "monster-floor/monster-summon.h" #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-flag-types.h" @@ -249,7 +247,7 @@ bool exe_mutation_power(PlayerType *player_ptr, PlayerMutationType power) const auto y = player_ptr->y + ddy[dir]; const auto x = player_ptr->x + ddx[dir]; const auto &grid = floor.grid_array[y][x]; - if (!grid.m_idx) { + if (!grid.has_monster()) { msg_print(_("邪悪な存在を感じとれません!", "You sense no evil there!")); return true; } @@ -289,7 +287,7 @@ bool exe_mutation_power(PlayerType *player_ptr, PlayerMutationType power) const auto y = player_ptr->y + ddy[dir]; const auto x = player_ptr->x + ddx[dir]; auto &grid = floor.grid_array[y][x]; - if (!grid.m_idx) { + if (!grid.has_monster()) { msg_print(_("あなたは何もない場所で手を振った。", "You wave your hands in the air.")); return true; } diff --git a/src/action/run-execution.cpp b/src/action/run-execution.cpp index ac8a6ccfb..dd9885d52 100644 --- a/src/action/run-execution.cpp +++ b/src/action/run-execution.cpp @@ -226,7 +226,7 @@ static bool run_test(PlayerType *player_ptr) int new_dir = cycle[chome[prev_dir] + i]; const Pos2D pos(player_ptr->y + ddy[new_dir], player_ptr->x + ddx[new_dir]); const auto &grid = floor.get_grid(pos); - if (grid.m_idx) { + if (grid.has_monster()) { const auto &monster = floor.m_list[grid.m_idx]; if (monster.ml) { return true; diff --git a/src/action/travel-execution.cpp b/src/action/travel-execution.cpp index c785ff624..cf4fe710e 100644 --- a/src/action/travel-execution.cpp +++ b/src/action/travel-execution.cpp @@ -61,7 +61,7 @@ static DIRECTION travel_test(PlayerType *player_ptr, DIRECTION prev_dir) POSITION row = player_ptr->y + ddy[dir]; POSITION col = player_ptr->x + ddx[dir]; g_ptr = &floor_ptr->grid_array[row][col]; - if (g_ptr->m_idx) { + if (g_ptr->has_monster()) { auto *m_ptr = &floor_ptr->m_list[g_ptr->m_idx]; if (m_ptr->ml) { return 0; diff --git a/src/autopick/autopick-entry.cpp b/src/autopick/autopick-entry.cpp index 6f1b38a41..d5868354d 100644 --- a/src/autopick/autopick-entry.cpp +++ b/src/autopick/autopick-entry.cpp @@ -9,7 +9,6 @@ #include "flavor/object-flavor-types.h" #include "floor/floor-object.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "object-enchant/item-feeling.h" #include "object-enchant/object-ego.h" #include "object-enchant/special-object-flags.h" diff --git a/src/autopick/autopick-matcher.cpp b/src/autopick/autopick-matcher.cpp index 73a7521a4..718615276 100644 --- a/src/autopick/autopick-matcher.cpp +++ b/src/autopick/autopick-matcher.cpp @@ -11,7 +11,6 @@ #include "autopick/autopick-util.h" #include "inventory/inventory-slot-types.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "object-enchant/item-feeling.h" #include "object-enchant/special-object-flags.h" #include "object-hook/hook-armor.h" diff --git a/src/avatar/avatar-changer.cpp b/src/avatar/avatar-changer.cpp index c462dd733..98173cc2f 100644 --- a/src/avatar/avatar-changer.cpp +++ b/src/avatar/avatar-changer.cpp @@ -9,9 +9,6 @@ #include "monster-race/monster-kind-mask.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-mask.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster-race/race-indice-types.h" #include "monster/monster-info.h" #include "system/dungeon-info.h" diff --git a/src/birth/game-play-initializer.cpp b/src/birth/game-play-initializer.cpp index 33ee8f71a..78e795e3f 100644 --- a/src/birth/game-play-initializer.cpp +++ b/src/birth/game-play-initializer.cpp @@ -7,8 +7,6 @@ #include "inventory/inventory-slot-types.h" #include "market/arena.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "pet/pet-util.h" #include "player-base/player-class.h" #include "player-base/player-race.h" diff --git a/src/blue-magic/blue-magic-caster.cpp b/src/blue-magic/blue-magic-caster.cpp index c13afdac1..ef5b203cd 100644 --- a/src/blue-magic/blue-magic-caster.cpp +++ b/src/blue-magic/blue-magic-caster.cpp @@ -15,7 +15,6 @@ #include "monster-race/monster-race.h" #include "monster-race/race-ability-flags.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" #include "monster/monster-status.h" @@ -100,7 +99,7 @@ static std::optional exe_blue_teleport_back(PlayerType *player_ptr) const auto &floor = *player_ptr->current_floor_ptr; const Pos2D pos(target_row, target_col); const auto &grid = floor.get_grid(pos); - if ((grid.m_idx == 0) || !grid.has_los() || !projectable(player_ptr, player_ptr->y, player_ptr->x, target_row, target_col)) { + if (!grid.has_monster() || !grid.has_los() || !projectable(player_ptr, player_ptr->y, player_ptr->x, target_row, target_col)) { return std::nullopt; } diff --git a/src/cmd-action/cmd-attack.cpp b/src/cmd-action/cmd-attack.cpp index 88d8c3dbc..d7e4f2d20 100644 --- a/src/cmd-action/cmd-attack.cpp +++ b/src/cmd-action/cmd-attack.cpp @@ -20,9 +20,6 @@ #include "main/sound-definitions-table.h" #include "main/sound-of-music.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster/monster-damage.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" diff --git a/src/cmd-action/cmd-mane.cpp b/src/cmd-action/cmd-mane.cpp index d51ad6cb5..6a0b6ab42 100644 --- a/src/cmd-action/cmd-mane.cpp +++ b/src/cmd-action/cmd-mane.cpp @@ -30,7 +30,6 @@ #include "monster-race/race-ability-flags.h" #include "monster-race/race-ability-mask.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" #include "monster/monster-processor.h" @@ -961,7 +960,7 @@ static bool use_mane(PlayerType *player_ptr, MonsterAbilityType spell) const auto &floor = *player_ptr->current_floor_ptr; const Pos2D pos(target_row, target_col); const auto &grid_target = floor.get_grid(pos); - auto should_teleport = grid_target.m_idx == 0; + auto should_teleport = grid_target.has_monster(); should_teleport &= grid_target.has_los(); should_teleport &= projectable(player_ptr, player_ptr->y, player_ptr->x, target_row, target_col); if (!should_teleport) { diff --git a/src/cmd-action/cmd-open-close.cpp b/src/cmd-action/cmd-open-close.cpp index f359ec552..902dbb117 100644 --- a/src/cmd-action/cmd-open-close.cpp +++ b/src/cmd-action/cmd-open-close.cpp @@ -130,7 +130,7 @@ void do_cmd_open(PlayerType *player_ptr) const auto o_idx = chest_check(player_ptr->current_floor_ptr, pos, false); if (grid.get_terrain_mimic().flags.has_not(TerrainCharacteristics::OPEN) && !o_idx) { msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open.")); - } else if (grid.m_idx && player_ptr->riding != grid.m_idx) { + } else if (grid.has_monster() && player_ptr->riding != grid.m_idx) { PlayerEnergy(player_ptr).set_player_turn_energy(100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE); @@ -179,7 +179,7 @@ void do_cmd_close(PlayerType *player_ptr) const auto &grid = player_ptr->current_floor_ptr->get_grid(pos); if (grid.get_terrain_mimic().flags.has_not(TerrainCharacteristics::CLOSE)) { msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close.")); - } else if (grid.m_idx) { + } else if (grid.has_monster()) { PlayerEnergy(player_ptr).set_player_turn_energy(100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE); @@ -231,7 +231,7 @@ void do_cmd_disarm(PlayerType *player_ptr) const auto o_idx = chest_check(player_ptr->current_floor_ptr, pos, true); if (!is_trap(player_ptr, feat) && !o_idx) { msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm.")); - } else if (grid.m_idx && player_ptr->riding != grid.m_idx) { + } else if (grid.has_monster() && player_ptr->riding != grid.m_idx) { msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE); } else if (o_idx) { @@ -284,7 +284,7 @@ void do_cmd_bash(PlayerType *player_ptr) const Grid &grid = player_ptr->current_floor_ptr->get_grid(pos); if (grid.get_terrain_mimic().flags.has_not(TerrainCharacteristics::BASH)) { msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash.")); - } else if (grid.m_idx) { + } else if (grid.has_monster()) { PlayerEnergy(player_ptr).set_player_turn_energy(100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE); @@ -355,7 +355,7 @@ void do_cmd_spike(PlayerType *player_ptr) msg_print(_("そこにはくさびを打てるものが見当たらない。", "You see nothing there to spike.")); } else if (!get_spike(player_ptr, &i_idx)) { msg_print(_("くさびを持っていない!", "You have no spikes!")); - } else if (grid.m_idx) { + } else if (grid.has_monster()) { PlayerEnergy(player_ptr).set_player_turn_energy(100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE); diff --git a/src/cmd-action/cmd-others.cpp b/src/cmd-action/cmd-others.cpp index b856e5bdf..3b4fb5013 100644 --- a/src/cmd-action/cmd-others.cpp +++ b/src/cmd-action/cmd-others.cpp @@ -71,7 +71,7 @@ static bool exe_alter(PlayerType *player_ptr) const auto &grid = player_ptr->current_floor_ptr->get_grid(pos); const auto &terrain = grid.get_terrain_mimic(); PlayerEnergy(player_ptr).set_player_turn_energy(100); - if (grid.m_idx) { + if (grid.has_monster()) { do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE); return false; } diff --git a/src/cmd-action/cmd-pet.cpp b/src/cmd-action/cmd-pet.cpp index 79a035032..6c1142f2b 100644 --- a/src/cmd-action/cmd-pet.cpp +++ b/src/cmd-action/cmd-pet.cpp @@ -23,8 +23,6 @@ #include "monster-floor/monster-object.h" #include "monster-floor/monster-remover.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" @@ -220,7 +218,7 @@ bool do_cmd_riding(PlayerType *player_ptr, bool force) return false; } - if (grid.m_idx) { + if (grid.has_monster()) { PlayerEnergy(player_ptr).set_player_turn_energy(100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); @@ -239,7 +237,7 @@ bool do_cmd_riding(PlayerType *player_ptr, bool force) const auto *m_ptr = &player_ptr->current_floor_ptr->m_list[grid.m_idx]; - if (!grid.m_idx || !m_ptr->ml) { + if (!grid.has_monster() || !m_ptr->ml) { msg_print(_("その場所にはモンスターはいません。", "There is no monster here.")); return false; } @@ -328,7 +326,7 @@ static void do_name_pet(PlayerType *player_ptr) target_pet = old_target_pet; auto &floor = *player_ptr->current_floor_ptr; const auto &grid = floor.grid_array[target_row][target_col]; - if (grid.m_idx == 0) { + if (!grid.has_monster()) { return; } @@ -705,7 +703,7 @@ void do_cmd_pet(PlayerType *player_ptr) player_ptr->pet_t_m_idx = 0; } else { auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[target_row][target_col]; - if (g_ptr->m_idx && (player_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) { + if (g_ptr->has_monster() && (player_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) { player_ptr->pet_t_m_idx = player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx; player_ptr->pet_follow_distance = PET_DESTROY_DIST; } else { diff --git a/src/cmd-action/cmd-tunnel.cpp b/src/cmd-action/cmd-tunnel.cpp index 98c02464f..c260b7c75 100644 --- a/src/cmd-action/cmd-tunnel.cpp +++ b/src/cmd-action/cmd-tunnel.cpp @@ -56,7 +56,7 @@ void do_cmd_tunnel(PlayerType *player_ptr) msg_print(_("ドアは掘れない。", "You cannot tunnel through doors.")); } else if (terrain_mimic.flags.has_not(TerrainCharacteristics::TUNNEL)) { msg_print(_("そこは掘れない。", "You can't tunnel through that.")); - } else if (grid.m_idx) { + } else if (grid.has_monster()) { PlayerEnergy(player_ptr).set_player_turn_energy(100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE); diff --git a/src/cmd-io/cmd-lore.cpp b/src/cmd-io/cmd-lore.cpp index 3d5ac7c74..cdaa7b930 100644 --- a/src/cmd-io/cmd-lore.cpp +++ b/src/cmd-io/cmd-lore.cpp @@ -6,8 +6,6 @@ #include "io/input-key-acceptor.h" #include "lore/lore-util.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "system/monster-race-info.h" #include "system/player-type-definition.h" #include "term/gameterm.h" diff --git a/src/combat/attack-criticality.cpp b/src/combat/attack-criticality.cpp index 385823635..52451024a 100644 --- a/src/combat/attack-criticality.cpp +++ b/src/combat/attack-criticality.cpp @@ -3,8 +3,6 @@ #include "inventory/inventory-slot-types.h" #include "main/sound-of-music.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "object/tval-types.h" #include "player-attack/player-attack.h" #include "player-base/player-class.h" diff --git a/src/combat/aura-counterattack.cpp b/src/combat/aura-counterattack.cpp index b515e4705..ee19cb637 100644 --- a/src/combat/aura-counterattack.cpp +++ b/src/combat/aura-counterattack.cpp @@ -13,7 +13,6 @@ #include "monster-attack/monster-attack-player.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags3.h" #include "monster-race/race-resistance-mask.h" #include "monster/monster-damage.h" #include "monster/monster-info.h" diff --git a/src/combat/shoot.cpp b/src/combat/shoot.cpp index 272222d13..997396acf 100644 --- a/src/combat/shoot.cpp +++ b/src/combat/shoot.cpp @@ -29,10 +29,6 @@ #include "monster-floor/monster-move.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster-race/race-resistance-mask.h" #include "monster/monster-damage.h" @@ -636,7 +632,7 @@ void exe_fire(PlayerType *player_ptr, INVENTORY_IDX i_idx, ItemEntity *j_ptr, SP if (snipe_type == SP_KILL_WALL) { g_ptr = &floor_ptr->grid_array[ny][nx]; - if (g_ptr->cave_has_flag(TerrainCharacteristics::HURT_ROCK) && !g_ptr->m_idx) { + if (g_ptr->cave_has_flag(TerrainCharacteristics::HURT_ROCK) && !g_ptr->has_monster()) { if (any_bits(g_ptr->info, (CAVE_MARK))) { msg_print(_("岩が砕け散った。", "Wall rocks were shattered.")); } @@ -659,7 +655,7 @@ void exe_fire(PlayerType *player_ptr, INVENTORY_IDX i_idx, ItemEntity *j_ptr, SP } /* Stopped by walls/doors */ - if (!cave_has_flag_bold(floor_ptr, ny, nx, TerrainCharacteristics::PROJECT) && !floor_ptr->grid_array[ny][nx].m_idx) { + if (!cave_has_flag_bold(floor_ptr, ny, nx, TerrainCharacteristics::PROJECT) && !floor_ptr->grid_array[ny][nx].has_monster()) { break; } @@ -718,7 +714,7 @@ void exe_fire(PlayerType *player_ptr, INVENTORY_IDX i_idx, ItemEntity *j_ptr, SP y = ny; /* Monster here, Try to hit it */ - if (floor_ptr->grid_array[y][x].m_idx) { + if (floor_ptr->grid_array[y][x].has_monster()) { sound(SOUND_SHOOT_HIT); Grid *c_mon_ptr = &floor_ptr->grid_array[y][x]; diff --git a/src/combat/slaying.cpp b/src/combat/slaying.cpp index 36ae1f5d2..243cc4945 100644 --- a/src/combat/slaying.cpp +++ b/src/combat/slaying.cpp @@ -4,8 +4,6 @@ #include "mind/mind-samurai.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster-race/race-indice-types.h" #include "monster-race/race-resistance-mask.h" #include "monster/monster-info.h" diff --git a/src/core/player-processor.cpp b/src/core/player-processor.cpp index 933cd8589..7782aa733 100644 --- a/src/core/player-processor.cpp +++ b/src/core/player-processor.cpp @@ -25,7 +25,6 @@ #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-describer.h" #include "monster/monster-flag-types.h" #include "monster/monster-list.h" diff --git a/src/dungeon/dungeon-processor.cpp b/src/dungeon/dungeon-processor.cpp index c09e3482f..7c65ba508 100644 --- a/src/dungeon/dungeon-processor.cpp +++ b/src/dungeon/dungeon-processor.cpp @@ -21,7 +21,6 @@ #include "market/arena.h" #include "mind/mind-ninja.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-compaction.h" #include "monster/monster-processor.h" #include "monster/monster-status.h" diff --git a/src/dungeon/quest-monster-placer.cpp b/src/dungeon/quest-monster-placer.cpp index 21374a44e..d302c460c 100644 --- a/src/dungeon/quest-monster-placer.cpp +++ b/src/dungeon/quest-monster-placer.cpp @@ -5,7 +5,6 @@ #include "monster-floor/monster-generator.h" #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-info.h" #include "system/floor-type-definition.h" #include "system/grid-type-definition.h" diff --git a/src/dungeon/quest.cpp b/src/dungeon/quest.cpp index 3f86ecf2c..1d366c4b0 100644 --- a/src/dungeon/quest.cpp +++ b/src/dungeon/quest.cpp @@ -15,9 +15,6 @@ #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" -#include "monster-race/race-flags8.h" #include "monster/monster-info.h" #include "monster/monster-list.h" #include "monster/monster-util.h" diff --git a/src/effect/effect-feature.cpp b/src/effect/effect-feature.cpp index 9a4333d39..04734a0a3 100644 --- a/src/effect/effect-feature.cpp +++ b/src/effect/effect-feature.cpp @@ -12,6 +12,7 @@ #include "mind/mind-elementalist.h" #include "mind/mind-ninja.h" #include "monster/monster-update.h" +#include "monster/monster-util.h" #include "player/special-defense-types.h" #include "room/door-definition.h" #include "spell-class/spells-mirror-master.h" @@ -44,7 +45,7 @@ static bool cave_naked_bold(PlayerType *player_ptr, const Pos2D &pos) /*! * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features * @param player_ptr プレイヤーへの参照ポインタ - * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player") + * @param src_idx 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player") * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball) * @param y 目標Y座標 / Target y location (or location to travel "towards") * @param x 目標X座標 / Target x location (or location to travel "towards") @@ -67,7 +68,7 @@ static bool cave_naked_bold(PlayerType *player_ptr, const Pos2D &pos) * Perhaps we should affect doors? * */ -bool affect_feature(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ) +bool affect_feature(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ) { const Pos2D pos(y, x); auto &floor = *player_ptr->current_floor_ptr; @@ -77,7 +78,7 @@ bool affect_feature(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITIO auto obvious = false; auto known = grid.has_los(); - who = who ? who : 0; + src_idx = is_monster(src_idx) ? src_idx : 0; dam = (dam + r) / (r + 1); if (terrain.flags.has(TerrainCharacteristics::TREE)) { @@ -354,7 +355,7 @@ bool affect_feature(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITIO if (player_can_see_bold(player_ptr, y, x)) { obvious = true; } - if (grid.m_idx) { + if (grid.has_monster()) { update_monster(player_ptr, grid.m_idx, false); } @@ -407,7 +408,7 @@ bool affect_feature(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITIO if (player_can_see_bold(player_ptr, y, x)) { obvious = true; } - if (grid.m_idx) { + if (grid.has_monster()) { update_monster(player_ptr, grid.m_idx, false); } diff --git a/src/effect/effect-feature.h b/src/effect/effect-feature.h index ccb8245f4..4fc828212 100644 --- a/src/effect/effect-feature.h +++ b/src/effect/effect-feature.h @@ -4,4 +4,4 @@ #include "system/angband.h" class PlayerType; -bool affect_feature(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ); +bool affect_feature(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ); diff --git a/src/effect/effect-item.cpp b/src/effect/effect-item.cpp index 08ccd22dd..8a90d2ca6 100644 --- a/src/effect/effect-item.cpp +++ b/src/effect/effect-item.cpp @@ -7,6 +7,7 @@ #include "monster-floor/monster-summon.h" #include "monster-floor/place-monster-types.h" #include "monster/monster-info.h" +#include "monster/monster-util.h" #include "object-enchant/tr-types.h" #include "object-hook/hook-expendable.h" #include "object/object-broken.h" @@ -26,7 +27,7 @@ /*! * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster. * @param player_ptr プレイヤーへの参照ポインタ - * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player") + * @param src_idx 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player") * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball) * @param y 目標Y座標 / Target y location (or location to travel "towards") * @param x 目標X座標 / Target x location (or location to travel "towards") @@ -34,7 +35,7 @@ * @param typ 効果属性 / Type of damage to apply to monsters (and objects) * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE */ -bool affect_item(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ) +bool affect_item(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ) { const auto &floor = *player_ptr->current_floor_ptr; const Pos2D pos(y, x); @@ -42,7 +43,7 @@ bool affect_item(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y auto is_item_affected = false; const auto known = grid.has_los(); - who = who ? who : 0; + src_idx = is_monster(src_idx) ? src_idx : 0; dam = (dam + r) / (r + 1); std::set processed_list; for (auto it = grid.o_idx_list.begin(); it != grid.o_idx_list.end();) { @@ -227,7 +228,7 @@ bool affect_item(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y } BIT_FLAGS mode = 0L; - if (!who || player_ptr->current_floor_ptr->m_list[who].is_pet()) { + if (is_monster(src_idx) || player_ptr->current_floor_ptr->m_list[src_idx].is_pet()) { mode |= PM_FORCE_PET; } @@ -240,7 +241,7 @@ bool affect_item(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y } continue; - } else if (summon_named_creature(player_ptr, who, y, x, corpse_r_idx, mode)) { + } else if (summon_named_creature(player_ptr, src_idx, y, x, corpse_r_idx, mode)) { note_kill = _("生き返った。", " revived."); } else if (!note_kill) { note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust.")); @@ -281,7 +282,7 @@ bool affect_item(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y const auto is_potion = o_ptr->is_potion(); delete_object_idx(player_ptr, this_o_idx); if (is_potion) { - (void)potion_smash_effect(player_ptr, who, y, x, bi_id); + (void)potion_smash_effect(player_ptr, src_idx, y, x, bi_id); // 薬の破壊効果によりリストの次のアイテムが破壊された可能性があるのでリストの最初から処理をやり直す // 処理済みのアイテムは processed_list に登録されており、スキップされる diff --git a/src/effect/effect-item.h b/src/effect/effect-item.h index 9776f98a9..69d06d49c 100644 --- a/src/effect/effect-item.h +++ b/src/effect/effect-item.h @@ -4,4 +4,4 @@ #include "system/angband.h" class PlayerType; -bool affect_item(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ); +bool affect_item(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ); diff --git a/src/effect/effect-monster-charm.cpp b/src/effect/effect-monster-charm.cpp index 92770d216..cc7f261c9 100644 --- a/src/effect/effect-monster-charm.cpp +++ b/src/effect/effect-monster-charm.cpp @@ -7,9 +7,6 @@ #include "monster-race/monster-kind-mask.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-flag-types.h" #include "monster/monster-info.h" diff --git a/src/effect/effect-monster-curse.cpp b/src/effect/effect-monster-curse.cpp index a69cd789c..dd0e27506 100644 --- a/src/effect/effect-monster-curse.cpp +++ b/src/effect/effect-monster-curse.cpp @@ -2,6 +2,7 @@ #include "effect/effect-monster-util.h" #include "monster-race/monster-race.h" #include "monster-race/race-indice-types.h" +#include "monster/monster-util.h" #include "system/monster-entity.h" #include "system/monster-race-info.h" #include "view/display-messages.h" @@ -11,7 +12,7 @@ ProcessResult effect_monster_curse_1(EffectMonster *em_ptr) if (em_ptr->seen) { em_ptr->obvious = true; } - if (!em_ptr->who) { + if (is_player(em_ptr->src_idx)) { msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), em_ptr->m_name); } if (randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35)) { @@ -27,7 +28,7 @@ ProcessResult effect_monster_curse_2(EffectMonster *em_ptr) if (em_ptr->seen) { em_ptr->obvious = true; } - if (!em_ptr->who) { + if (is_player(em_ptr->src_idx)) { msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), em_ptr->m_name); } @@ -44,7 +45,7 @@ ProcessResult effect_monster_curse_3(EffectMonster *em_ptr) if (em_ptr->seen) { em_ptr->obvious = true; } - if (!em_ptr->who) { + if (is_player(em_ptr->src_idx)) { msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), em_ptr->m_name); } @@ -61,13 +62,13 @@ ProcessResult effect_monster_curse_4(EffectMonster *em_ptr) if (em_ptr->seen) { em_ptr->obvious = true; } - if (!em_ptr->who) { + if (is_player(em_ptr->src_idx)) { msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。", "You point at %s, screaming the word, 'DIE!'."), em_ptr->m_name); } - if ((randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35)) && ((em_ptr->who <= 0) || (em_ptr->m_caster_ptr->r_idx != MonsterRaceId::KENSHIROU))) { + if ((randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35)) && (!is_monster(em_ptr->src_idx) || (em_ptr->m_caster_ptr->r_idx != MonsterRaceId::KENSHIROU))) { em_ptr->note = _("には効果がなかった。", " is unaffected."); em_ptr->dam = 0; } diff --git a/src/effect/effect-monster-evil.cpp b/src/effect/effect-monster-evil.cpp index f4254788b..144250112 100644 --- a/src/effect/effect-monster-evil.cpp +++ b/src/effect/effect-monster-evil.cpp @@ -3,8 +3,6 @@ #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" #include "monster/monster-info.h" #include "system/monster-entity.h" #include "system/monster-race-info.h" diff --git a/src/effect/effect-monster-lite-dark.cpp b/src/effect/effect-monster-lite-dark.cpp index 0955ae544..83627402e 100644 --- a/src/effect/effect-monster-lite-dark.cpp +++ b/src/effect/effect-monster-lite-dark.cpp @@ -2,7 +2,6 @@ #include "effect/effect-monster-util.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags3.h" #include "monster/monster-info.h" #include "system/monster-race-info.h" #include "system/player-type-definition.h" diff --git a/src/effect/effect-monster-oldies.cpp b/src/effect/effect-monster-oldies.cpp index d59f8d4de..d3c33eb9a 100644 --- a/src/effect/effect-monster-oldies.cpp +++ b/src/effect/effect-monster-oldies.cpp @@ -3,13 +3,11 @@ #include "effect/effect-monster-util.h" #include "monster-floor/monster-generator.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-info.h" #include "monster/monster-status-setter.h" #include "monster/monster-status.h" +#include "monster/monster-util.h" #include "system/floor-type-definition.h" #include "system/grid-type-definition.h" #include "system/monster-entity.h" @@ -103,7 +101,7 @@ ProcessResult effect_monster_star_heal(PlayerType *player_ptr, EffectMonster *em // who == 0ならばプレイヤーなので、それの判定. static void effect_monster_old_heal_check_player(PlayerType *player_ptr, EffectMonster *em_ptr) { - if (em_ptr->who != 0) { + if (is_monster(em_ptr->src_idx)) { return; } @@ -173,7 +171,7 @@ ProcessResult effect_monster_old_heal(PlayerType *player_ptr, EffectMonster *em_ effect_monster_old_heal_check_player(player_ptr, em_ptr); if (em_ptr->m_ptr->r_idx == MonsterRaceId::LEPER) { em_ptr->heal_leper = true; - if (!em_ptr->who) { + if (is_player(em_ptr->src_idx)) { chg_virtue(player_ptr, Virtue::COMPASSION, 5); } } @@ -202,7 +200,7 @@ ProcessResult effect_monster_old_speed(PlayerType *player_ptr, EffectMonster *em em_ptr->note = _("の動きが速くなった。", " starts moving faster."); } - if (!em_ptr->who) { + if (is_player(em_ptr->src_idx)) { if (em_ptr->r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) { chg_virtue(player_ptr, Virtue::INDIVIDUALISM, 1); } diff --git a/src/effect/effect-monster-psi.cpp b/src/effect/effect-monster-psi.cpp index 67be121be..112bfaea9 100644 --- a/src/effect/effect-monster-psi.cpp +++ b/src/effect/effect-monster-psi.cpp @@ -5,9 +5,6 @@ #include "mind/mind-mirror-master.h" #include "monster-race/monster-kind-mask.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" diff --git a/src/effect/effect-monster-resist-hurt.cpp b/src/effect/effect-monster-resist-hurt.cpp index 9630d200c..c3c5eb02d 100644 --- a/src/effect/effect-monster-resist-hurt.cpp +++ b/src/effect/effect-monster-resist-hurt.cpp @@ -3,10 +3,6 @@ #include "monster-race/monster-race.h" #include "monster-race/race-brightness-flags.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-info.h" #include "monster/monster-status-setter.h" diff --git a/src/effect/effect-monster-spirit.cpp b/src/effect/effect-monster-spirit.cpp index 6e0cfe352..e56f3727b 100644 --- a/src/effect/effect-monster-spirit.cpp +++ b/src/effect/effect-monster-spirit.cpp @@ -3,13 +3,11 @@ #include "hpmp/hp-mp-processor.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-mask.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" #include "monster/monster-status-setter.h" #include "monster/monster-status.h" +#include "monster/monster-util.h" #include "system/grid-type-definition.h" #include "system/monster-entity.h" #include "system/monster-race-info.h" @@ -35,7 +33,7 @@ ProcessResult effect_monster_drain_mana(PlayerType *player_ptr, EffectMonster *e return ProcessResult::PROCESS_CONTINUE; } - if (em_ptr->who <= 0) { + if (!is_monster(em_ptr->src_idx)) { msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), em_ptr->m_name); (void)hp_player(player_ptr, em_ptr->dam); em_ptr->dam = 0; @@ -53,11 +51,11 @@ ProcessResult effect_monster_drain_mana(PlayerType *player_ptr, EffectMonster *e } auto &rfu = RedrawingFlagsUpdater::get_instance(); - if (player_ptr->health_who == em_ptr->who) { + if (player_ptr->health_who == em_ptr->src_idx) { rfu.set_flag(MainWindowRedrawingFlag::HEALTH); } - if (player_ptr->riding == em_ptr->who) { + if (player_ptr->riding == em_ptr->src_idx) { rfu.set_flag(MainWindowRedrawingFlag::UHEALTH); } @@ -75,7 +73,7 @@ ProcessResult effect_monster_mind_blast(PlayerType *player_ptr, EffectMonster *e if (em_ptr->seen) { em_ptr->obvious = true; } - if (!em_ptr->who) { + if (is_player(em_ptr->src_idx)) { msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), em_ptr->m_name); } @@ -108,7 +106,7 @@ ProcessResult effect_monster_mind_blast(PlayerType *player_ptr, EffectMonster *e em_ptr->note = _("は精神攻撃を食らった。", " is blasted by psionic energy."); em_ptr->note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk."); - if (em_ptr->who > 0) { + if (is_monster(em_ptr->src_idx)) { em_ptr->do_conf = randint0(4) + 4; } else { em_ptr->do_conf = randint0(8) + 8; @@ -123,7 +121,7 @@ ProcessResult effect_monster_brain_smash(PlayerType *player_ptr, EffectMonster * if (em_ptr->seen) { em_ptr->obvious = true; } - if (!em_ptr->who) { + if (is_player(em_ptr->src_idx)) { msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), em_ptr->m_name); } @@ -157,7 +155,7 @@ ProcessResult effect_monster_brain_smash(PlayerType *player_ptr, EffectMonster * } else { em_ptr->note = _("は精神攻撃を食らった。", " is blasted by psionic energy."); em_ptr->note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk."); - if (em_ptr->who > 0) { + if (is_monster(em_ptr->src_idx)) { em_ptr->do_conf = randint0(4) + 4; em_ptr->do_stun = randint0(4) + 4; } else { diff --git a/src/effect/effect-monster-switcher.cpp b/src/effect/effect-monster-switcher.cpp index 77748eea3..0aa16a010 100644 --- a/src/effect/effect-monster-switcher.cpp +++ b/src/effect/effect-monster-switcher.cpp @@ -23,12 +23,10 @@ #include "monster-floor/monster-death.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster/monster-info.h" #include "monster/monster-status-setter.h" #include "monster/monster-status.h" +#include "monster/monster-util.h" #include "player/player-damage.h" #include "spell-kind/spells-genocide.h" #include "system/grid-type-definition.h" @@ -139,8 +137,8 @@ ProcessResult effect_monster_hand_doom(EffectMonster *em_ptr) return ProcessResult::PROCESS_CONTINUE; } - if ((em_ptr->who > 0) ? ((em_ptr->caster_lev + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + 10 + randint1(20))) - : (((em_ptr->caster_lev / 2) + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + randint1(200)))) { + if (is_monster(em_ptr->src_idx) ? ((em_ptr->caster_lev + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + 10 + randint1(20))) + : (((em_ptr->caster_lev / 2) + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + randint1(200)))) { em_ptr->dam = ((40 + randint1(20)) * em_ptr->m_ptr->hp) / 100; if (em_ptr->m_ptr->hp < em_ptr->dam) { em_ptr->dam = em_ptr->m_ptr->hp - 1; @@ -267,7 +265,7 @@ ProcessResult effect_monster_genocide(PlayerType *player_ptr, EffectMonster *em_ } std::string_view spell_name(_("モンスター消滅", "Genocide One")); - if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, !em_ptr->who, (em_ptr->r_ptr->level + 1) / 2, spell_name.data())) { + if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, is_player(em_ptr->src_idx), (em_ptr->r_ptr->level + 1) / 2, spell_name.data())) { if (em_ptr->seen_msg) { msg_format(_("%sは消滅した!", "%s^ disappeared!"), em_ptr->m_name); } @@ -281,7 +279,7 @@ ProcessResult effect_monster_genocide(PlayerType *player_ptr, EffectMonster *em_ ProcessResult effect_monster_photo(PlayerType *player_ptr, EffectMonster *em_ptr) { - if (!em_ptr->who) { + if (is_player(em_ptr->src_idx)) { msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), em_ptr->m_name); } diff --git a/src/effect/effect-monster-util.cpp b/src/effect/effect-monster-util.cpp index ee518c7db..6b8c8f334 100644 --- a/src/effect/effect-monster-util.cpp +++ b/src/effect/effect-monster-util.cpp @@ -11,6 +11,7 @@ #include "monster-race/monster-race.h" #include "monster/monster-info.h" #include "monster/monster-status.h" +#include "monster/monster-util.h" #include "system/angband-system.h" #include "system/floor-type-definition.h" #include "system/grid-type-definition.h" @@ -22,7 +23,7 @@ * @brief EffectMonster構造体のコンストラクタ * @param player_ptr プレイヤーへの参照ポインタ * @param em_ptr モンスター効果構造体への参照ポインタ - * @param who 魔法を発動したモンスター (0ならばプレイヤー) + * @param src_idx 魔法を発動したモンスター (0ならばプレイヤー) * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball) * @param y 目標y座標 / Target y location (or location to travel "towards") * @param x 目標x座標 / Target x location (or location to travel "towards") @@ -31,8 +32,8 @@ * @param flag 効果フラグ * @param see_s_msg TRUEならばメッセージを表示する */ -EffectMonster::EffectMonster(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg) - : who(who) +EffectMonster::EffectMonster(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg) + : src_idx(src_idx) , r(r) , y(y) , x(x) @@ -44,12 +45,12 @@ EffectMonster::EffectMonster(PlayerType *player_ptr, MONSTER_IDX who, POSITION r auto *floor_ptr = player_ptr->current_floor_ptr; this->g_ptr = &floor_ptr->grid_array[this->y][this->x]; this->m_ptr = &floor_ptr->m_list[this->g_ptr->m_idx]; - this->m_caster_ptr = (this->who > 0) ? &floor_ptr->m_list[this->who] : nullptr; + this->m_caster_ptr = is_monster(this->src_idx) ? &floor_ptr->m_list[this->src_idx] : nullptr; this->r_ptr = &this->m_ptr->get_monrace(); this->seen = this->m_ptr->ml; this->seen_msg = is_seen(player_ptr, this->m_ptr); this->slept = this->m_ptr->is_asleep(); this->known = (this->m_ptr->cdis <= MAX_PLAYER_SIGHT) || AngbandSystem::get_instance().is_phase_out(); this->note_dies = this->m_ptr->get_died_message(); - this->caster_lev = (this->who > 0) ? this->m_caster_ptr->get_monrace().level : (player_ptr->lev * 2); + this->caster_lev = is_monster(this->src_idx) ? this->m_caster_ptr->get_monrace().level : (player_ptr->lev * 2); } diff --git a/src/effect/effect-monster-util.h b/src/effect/effect-monster-util.h index 738f02117..39fdd7e03 100644 --- a/src/effect/effect-monster-util.h +++ b/src/effect/effect-monster-util.h @@ -10,7 +10,7 @@ class MonsterRaceInfo; class PlayerType; class EffectMonster { public: - EffectMonster(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg); + EffectMonster(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg); char killer[MAX_MONSTER_NAME]{}; bool obvious = false; @@ -29,7 +29,7 @@ public: short photo = 0; std::string note = ""; - MONSTER_IDX who; + MONSTER_IDX src_idx; POSITION r; POSITION y; POSITION x; diff --git a/src/effect/effect-monster.cpp b/src/effect/effect-monster.cpp index 0e3a514eb..8c75835be 100644 --- a/src/effect/effect-monster.cpp +++ b/src/effect/effect-monster.cpp @@ -25,9 +25,6 @@ #include "monster-floor/monster-remover.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster-race/race-resistance-mask.h" #include "monster/monster-damage.h" @@ -38,6 +35,7 @@ #include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/monster-update.h" +#include "monster/monster-util.h" #include "object-enchant/special-object-flags.h" #include "object/object-kind-hook.h" #include "spell-kind/blood-curse.h" @@ -66,10 +64,10 @@ */ static ProcessResult is_affective(PlayerType *player_ptr, EffectMonster *em_ptr) { - if (!em_ptr->g_ptr->m_idx) { + if (!em_ptr->g_ptr->has_monster()) { return ProcessResult::PROCESS_FALSE; } - if (em_ptr->who && (em_ptr->g_ptr->m_idx == em_ptr->who)) { + if (is_monster(em_ptr->src_idx) && (em_ptr->g_ptr->m_idx == em_ptr->src_idx)) { return ProcessResult::PROCESS_FALSE; } if (sukekaku && ((em_ptr->m_ptr->r_idx == MonsterRaceId::SUKE) || (em_ptr->m_ptr->r_idx == MonsterRaceId::KAKU))) { @@ -78,7 +76,7 @@ static ProcessResult is_affective(PlayerType *player_ptr, EffectMonster *em_ptr) if (em_ptr->m_ptr->hp < 0) { return ProcessResult::PROCESS_FALSE; } - if (em_ptr->who || em_ptr->g_ptr->m_idx != player_ptr->riding) { + if (is_monster(em_ptr->src_idx) || em_ptr->g_ptr->m_idx != player_ptr->riding) { return ProcessResult::PROCESS_TRUE; } @@ -191,8 +189,8 @@ static void effect_damage_killed_pet(PlayerType *player_ptr, EffectMonster *em_p } } - if (em_ptr->who > 0) { - monster_gain_exp(player_ptr, em_ptr->who, em_ptr->m_ptr->r_idx); + if (is_monster(em_ptr->src_idx)) { + monster_gain_exp(player_ptr, em_ptr->src_idx, em_ptr->m_ptr->r_idx); } monster_death(player_ptr, em_ptr->g_ptr->m_idx, false, em_ptr->attribute); @@ -235,7 +233,7 @@ static void effect_damage_makes_sleep(PlayerType *player_ptr, EffectMonster *em_ */ static bool deal_effect_damage_from_monster(PlayerType *player_ptr, EffectMonster *em_ptr) { - if (em_ptr->who <= 0) { + if (!is_monster(em_ptr->src_idx)) { return false; } @@ -367,7 +365,7 @@ static void deal_effect_damage_to_monster(PlayerType *player_ptr, EffectMonster */ static void effect_makes_change_virtues(PlayerType *player_ptr, EffectMonster *em_ptr) { - if ((em_ptr->who > 0) || !em_ptr->slept) { + if (is_monster(em_ptr->src_idx) || !em_ptr->slept) { return; } @@ -397,7 +395,7 @@ static void affected_monster_prevents_bad_status(PlayerType *player_ptr, EffectM auto should_alive = r_ptr->kind_flags.has(MonsterKindType::UNIQUE); should_alive |= r_ptr->misc_flags.has(MonsterMiscType::QUESTOR); should_alive |= r_ptr->population_flags.has(MonsterPopulationType::NAZGUL); - if (should_alive && !AngbandSystem::get_instance().is_phase_out() && (em_ptr->who > 0) && (em_ptr->dam > em_ptr->m_ptr->hp)) { + if (should_alive && !AngbandSystem::get_instance().is_phase_out() && is_monster(em_ptr->src_idx) && (em_ptr->dam > em_ptr->m_ptr->hp)) { em_ptr->dam = em_ptr->m_ptr->hp; } } @@ -552,11 +550,11 @@ static void effect_damage_makes_teleport(PlayerType *player_ptr, EffectMonster * em_ptr->note = _("が消え去った!", " disappears!"); - if (!em_ptr->who) { + if (is_monster(em_ptr->src_idx)) { chg_virtue(player_ptr, Virtue::VALOUR, -1); } - teleport_flags tflag = i2enum((!em_ptr->who ? TELEPORT_DEC_VALOUR : TELEPORT_SPONTANEOUS) | TELEPORT_PASSIVE); + teleport_flags tflag = i2enum((is_monster(em_ptr->src_idx) ? TELEPORT_DEC_VALOUR : TELEPORT_SPONTANEOUS) | TELEPORT_PASSIVE); teleport_away(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->do_dist, tflag); em_ptr->y = em_ptr->m_ptr->fy; @@ -645,7 +643,7 @@ static void postprocess_by_effected_pet(PlayerType *player_ptr, EffectMonster *e return; } - if (em_ptr->who == 0) { + if (is_player(em_ptr->src_idx)) { if (!(em_ptr->flag & PROJECT_NO_HANGEKI)) { set_target(m_ptr, monster_target_y, monster_target_x); } @@ -654,7 +652,7 @@ static void postprocess_by_effected_pet(PlayerType *player_ptr, EffectMonster *e } const auto &m_caster_ref = *em_ptr->m_caster_ptr; - if ((em_ptr->who > 0) && m_caster_ref.is_pet() && !player_ptr->is_located_at({ m_ptr->target_y, m_ptr->target_x })) { + if (is_monster(em_ptr->src_idx) && m_caster_ref.is_pet() && !player_ptr->is_located_at({ m_ptr->target_y, m_ptr->target_x })) { set_target(m_ptr, m_caster_ref.fy, m_caster_ref.fx); } } @@ -716,7 +714,7 @@ static void exe_affect_monster_postprocess(PlayerType *player_ptr, EffectMonster /*! * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster. * @param player_ptr プレイヤーへの参照ポインタ - * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player") + * @param src_idx 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player") * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball) * @param y 目標y座標 / Target y location (or location to travel "towards") * @param x 目標x座標 / Target x location (or location to travel "towards") @@ -732,10 +730,10 @@ static void exe_affect_monster_postprocess(PlayerType *player_ptr, EffectMonster * 3.ペット及び撮影による事後効果 */ bool affect_monster( - PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg, + PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg, std::optional cap_mon_ptr) { - EffectMonster tmp_effect(player_ptr, who, r, y, x, dam, attribute, flag, see_s_msg); + EffectMonster tmp_effect(player_ptr, src_idx, r, y, x, dam, attribute, flag, see_s_msg); auto *em_ptr = &tmp_effect; auto target_m_idx = em_ptr->g_ptr->m_idx; diff --git a/src/effect/effect-monster.h b/src/effect/effect-monster.h index dc295e26b..28f8f6ffa 100644 --- a/src/effect/effect-monster.h +++ b/src/effect/effect-monster.h @@ -6,4 +6,4 @@ class CapturedMonsterType; class PlayerType; -bool affect_monster(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag, bool see_s_msg, std::optional cap_mon_ptr = std::nullopt); +bool affect_monster(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag, bool see_s_msg, std::optional cap_mon_ptr = std::nullopt); diff --git a/src/effect/effect-player-spirit.cpp b/src/effect/effect-player-spirit.cpp index b228866af..9cd46ee0d 100644 --- a/src/effect/effect-player-spirit.cpp +++ b/src/effect/effect-player-spirit.cpp @@ -3,6 +3,7 @@ #include "core/window-redrawer.h" #include "effect/effect-player.h" #include "mind/mind-mirror-master.h" +#include "monster/monster-util.h" #include "player/player-damage.h" #include "player/player-status-flags.h" #include "status/bad-status-setter.h" @@ -26,7 +27,7 @@ void effect_player_drain_mana(PlayerType *player_ptr, EffectPlayerType *ep_ptr) return; } - if (ep_ptr->who > 0) { + if (is_monster(ep_ptr->src_idx)) { msg_format(_("%s^に精神エネルギーを吸い取られてしまった!", "%s^ draws psychic energy from you!"), ep_ptr->m_name); } else { msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drained!")); @@ -48,7 +49,7 @@ void effect_player_drain_mana(PlayerType *player_ptr, EffectPlayerType *ep_ptr) }; rfu.set_flags(flags); - if ((ep_ptr->who <= 0) || (ep_ptr->m_ptr->hp >= ep_ptr->m_ptr->maxhp)) { + if (!is_monster(ep_ptr->src_idx) || (ep_ptr->m_ptr->hp >= ep_ptr->m_ptr->maxhp)) { ep_ptr->dam = 0; return; } @@ -58,10 +59,10 @@ void effect_player_drain_mana(PlayerType *player_ptr, EffectPlayerType *ep_ptr) ep_ptr->m_ptr->hp = ep_ptr->m_ptr->maxhp; } - if (player_ptr->health_who == ep_ptr->who) { + if (player_ptr->health_who == ep_ptr->src_idx) { rfu.set_flag(MainWindowRedrawingFlag::HEALTH); } - if (player_ptr->riding == ep_ptr->who) { + if (player_ptr->riding == ep_ptr->src_idx) { rfu.set_flag(MainWindowRedrawingFlag::UHEALTH); } diff --git a/src/effect/effect-player.cpp b/src/effect/effect-player.cpp index 45fae6b5a..62eb94ee9 100644 --- a/src/effect/effect-player.cpp +++ b/src/effect/effect-player.cpp @@ -19,6 +19,7 @@ #include "monster-race/monster-race.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" +#include "monster/monster-util.h" #include "player-base/player-class.h" #include "player-info/samurai-data-type.h" #include "player/player-status-flags.h" @@ -42,20 +43,20 @@ /*! * @brief EffectPlayerType構造体を初期化する * @param ep_ptr 初期化前の構造体 - * @param who 魔法を唱えたモンスター (0ならプレイヤー自身) + * @param src_idx 魔法を唱えたモンスター (0ならプレイヤー自身) * @param dam 基本威力 * @param attribute 効果属性 * @param flag 効果フラグ * @param monspell 効果元のモンスター魔法ID * @return 初期化後の構造体ポインタ */ -EffectPlayerType::EffectPlayerType(MONSTER_IDX who, int dam, AttributeType attribute, BIT_FLAGS flag) +EffectPlayerType::EffectPlayerType(MONSTER_IDX src_idx, int dam, AttributeType attribute, BIT_FLAGS flag) : rlev(0) , m_ptr(nullptr) , killer("") , m_name("") , get_damage(0) - , who(who) + , src_idx(src_idx) , dam(dam) , attribute(attribute) , flag(flag) @@ -92,9 +93,9 @@ static bool process_bolt_reflection(PlayerType *player_ptr, EffectPlayerType *ep msg_print(mes); POSITION t_y; POSITION t_x; - if (ep_ptr->who > 0) { + if (is_monster(ep_ptr->src_idx)) { auto *floor_ptr = player_ptr->current_floor_ptr; - auto *m_ptr = &floor_ptr->m_list[ep_ptr->who]; + auto *m_ptr = &floor_ptr->m_list[ep_ptr->src_idx]; do { t_y = m_ptr->fy - 1 + randint1(3); t_x = m_ptr->fx - 1 + randint1(3); @@ -131,13 +132,13 @@ static ProcessResult check_continue_player_effect(PlayerType *player_ptr, Effect auto is_effective = ep_ptr->dam > 0; is_effective &= randint0(55) < (player_ptr->lev * 3 / 5 + 20); - is_effective &= ep_ptr->who > 0; - is_effective &= ep_ptr->who != player_ptr->riding; + is_effective &= is_monster(ep_ptr->src_idx); + is_effective &= ep_ptr->src_idx != player_ptr->riding; if (is_effective && kawarimi(player_ptr, true)) { return ProcessResult::PROCESS_FALSE; } - if ((ep_ptr->who == 0) || (ep_ptr->who == player_ptr->riding)) { + if (is_player(ep_ptr->src_idx) || (ep_ptr->src_idx == player_ptr->riding)) { return ProcessResult::PROCESS_FALSE; } @@ -152,19 +153,19 @@ static ProcessResult check_continue_player_effect(PlayerType *player_ptr, Effect * @brief 魔法を発したモンスター名を記述する * @param player_ptr プレイヤーへの参照ポインタ * @param ep_ptr プレイヤー効果構造体への参照ポインタ - * @param who_name モンスター名 + * @param src_name モンスター名 */ -static void describe_effect_source(PlayerType *player_ptr, EffectPlayerType *ep_ptr, concptr who_name) +static void describe_effect_source(PlayerType *player_ptr, EffectPlayerType *ep_ptr, concptr src_name) { - if (ep_ptr->who > 0) { - ep_ptr->m_ptr = &player_ptr->current_floor_ptr->m_list[ep_ptr->who]; + if (is_monster(ep_ptr->src_idx)) { + ep_ptr->m_ptr = &player_ptr->current_floor_ptr->m_list[ep_ptr->src_idx]; ep_ptr->rlev = ep_ptr->m_ptr->get_monrace().level >= 1 ? ep_ptr->m_ptr->get_monrace().level : 1; angband_strcpy(ep_ptr->m_name, monster_desc(player_ptr, ep_ptr->m_ptr, 0), sizeof(ep_ptr->m_name)); - angband_strcpy(ep_ptr->killer, who_name, sizeof(ep_ptr->killer)); + angband_strcpy(ep_ptr->killer, src_name, sizeof(ep_ptr->killer)); return; } - switch (ep_ptr->who) { + switch (ep_ptr->src_idx) { case PROJECT_WHO_UNCTRL_POWER: strcpy(ep_ptr->killer, _("制御できない力の氾流", "uncontrollable power storm")); break; @@ -181,8 +182,8 @@ static void describe_effect_source(PlayerType *player_ptr, EffectPlayerType *ep_ /*! * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below. - * @param who 魔法を発動したモンスター(0ならばプレイヤー、負値ならば自然発生) / Index of "source" monster (zero for "player") - * @param who_name 効果を起こしたモンスターの名前 + * @param src_idx 魔法を発動したモンスター(0ならばプレイヤー、負値ならば自然発生) / Index of "source" monster (zero for "player") + * @param src_name 効果を起こしたモンスターの名前 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball) * @param y 目標Y座標 / Target y location (or location to travel "towards") * @param x 目標X座標 / Target x location (or location to travel "towards") @@ -192,10 +193,10 @@ static void describe_effect_source(PlayerType *player_ptr, EffectPlayerType *ep_ * @param monspell 効果元のモンスター魔法ID * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE */ -bool affect_player(MONSTER_IDX who, PlayerType *player_ptr, concptr who_name, int r, POSITION y, POSITION x, int dam, AttributeType attribute, +bool affect_player(MONSTER_IDX src_idx, PlayerType *player_ptr, concptr src_name, int r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, project_func project) { - EffectPlayerType tmp_effect(who, dam, attribute, flag); + EffectPlayerType tmp_effect(src_idx, dam, attribute, flag); auto *ep_ptr = &tmp_effect; auto check_result = check_continue_player_effect(player_ptr, ep_ptr, { y, x }, project); if (check_result != ProcessResult::PROCESS_CONTINUE) { @@ -207,11 +208,11 @@ bool affect_player(MONSTER_IDX who, PlayerType *player_ptr, concptr who_name, in } ep_ptr->dam = (ep_ptr->dam + r) / (r + 1); - describe_effect_source(player_ptr, ep_ptr, who_name); + describe_effect_source(player_ptr, ep_ptr, src_name); switch_effects_player(player_ptr, ep_ptr); SpellHex(player_ptr).store_vengeful_damage(ep_ptr->get_damage); - if ((player_ptr->tim_eyeeye || SpellHex(player_ptr).is_spelling_specific(HEX_EYE_FOR_EYE)) && (ep_ptr->get_damage > 0) && !player_ptr->is_dead && (ep_ptr->who > 0)) { + if ((player_ptr->tim_eyeeye || SpellHex(player_ptr).is_spelling_specific(HEX_EYE_FOR_EYE)) && (ep_ptr->get_damage > 0) && !player_ptr->is_dead && is_monster(ep_ptr->src_idx)) { const auto m_name_self = monster_desc(player_ptr, ep_ptr->m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE); msg_print(_(format("攻撃が%s自身を傷つけた!", ep_ptr->m_name), format("The attack of %s has wounded %s!", ep_ptr->m_name, m_name_self.data()))); (*project)(player_ptr, 0, 0, ep_ptr->m_ptr->fy, ep_ptr->m_ptr->fx, ep_ptr->get_damage, AttributeType::MISSILE, PROJECT_KILL, std::nullopt); @@ -225,7 +226,7 @@ bool affect_player(MONSTER_IDX who, PlayerType *player_ptr, concptr who_name, in } disturb(player_ptr, true, true); - if (ep_ptr->dam && ep_ptr->who && (ep_ptr->who != player_ptr->riding)) { + if (ep_ptr->dam && ep_ptr->src_idx && (ep_ptr->src_idx != player_ptr->riding)) { (void)kawarimi(player_ptr, false); } diff --git a/src/effect/effect-player.h b/src/effect/effect-player.h index 1fdaf426e..be5b1338f 100644 --- a/src/effect/effect-player.h +++ b/src/effect/effect-player.h @@ -13,18 +13,18 @@ public: GAME_TEXT m_name[MAX_NLEN]; int get_damage; - MONSTER_IDX who; + MONSTER_IDX src_idx; int dam; AttributeType attribute; BIT_FLAGS flag; - EffectPlayerType(MONSTER_IDX who, int dam, AttributeType attribute, BIT_FLAGS flag); + EffectPlayerType(MONSTER_IDX src_idx, int dam, AttributeType attribute, BIT_FLAGS flag); }; struct ProjectResult; class CapturedMonsterType; class PlayerType; using project_func = ProjectResult (*)( - PlayerType *player_ptr, MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag, std::optional cap_mon_ptr); + PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION rad, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag, std::optional cap_mon_ptr); -bool affect_player(MONSTER_IDX who, PlayerType *player_ptr, concptr who_name, int r, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag, +bool affect_player(MONSTER_IDX src_idx, PlayerType *player_ptr, concptr src_name, int r, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag, project_func project); diff --git a/src/effect/effect-processor.cpp b/src/effect/effect-processor.cpp index 221e4709d..3e8acf621 100644 --- a/src/effect/effect-processor.cpp +++ b/src/effect/effect-processor.cpp @@ -19,11 +19,11 @@ #include "main/sound-definitions-table.h" #include "main/sound-of-music.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags2.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" +#include "monster/monster-util.h" #include "pet/pet-fall-off.h" #include "player/player-status.h" #include "spell-class/spells-mirror-master.h" @@ -44,7 +44,7 @@ /*! * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic * "beam"/"bolt"/"ball" projection routine. - * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" + * @param src_idx 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" * monster (zero for "player") * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion * (0 = beam/bolt, 1 to 9 = ball) @@ -58,7 +58,7 @@ * @todo 似たような処理が山ほど並んでいる、何とかならないものか * @todo 引数にそのまま再代入していてカオスすぎる。直すのは簡単ではない */ -ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX who, POSITION rad, const POSITION target_y, const POSITION target_x, const int dam, +ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX src_idx, POSITION rad, const POSITION target_y, const POSITION target_x, const int dam, const AttributeType typ, BIT_FLAGS flag, std::optional cap_mon_ptr) { POSITION y1; @@ -82,12 +82,12 @@ ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX who, POSITION ra if (any_bits(flag, PROJECT_JUMP)) { x1 = target_x; y1 = target_y; - } else if (who <= 0) { + } else if (!is_monster(src_idx)) { x1 = player_ptr->x; y1 = player_ptr->y; - } else if (who > 0) { - x1 = player_ptr->current_floor_ptr->m_list[who].fx; - y1 = player_ptr->current_floor_ptr->m_list[who].fy; + } else if (is_monster(src_idx)) { + x1 = player_ptr->current_floor_ptr->m_list[src_idx].fx; + y1 = player_ptr->current_floor_ptr->m_list[src_idx].fy; } else { x1 = target_x; y1 = target_y; @@ -306,8 +306,8 @@ ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX who, POSITION ra update_creature(player_ptr); if (flag & PROJECT_KILL) { - see_s_msg = (who > 0) ? is_seen(player_ptr, &player_ptr->current_floor_ptr->m_list[who]) - : (!who ? true : (player_can_see_bold(player_ptr, y1, x1) && projectable(player_ptr, player_ptr->y, player_ptr->x, y1, x1))); + see_s_msg = is_monster(src_idx) ? is_seen(player_ptr, &player_ptr->current_floor_ptr->m_list[src_idx]) + : (is_player(src_idx) ? true : (player_can_see_bold(player_ptr, y1, x1) && projectable(player_ptr, player_ptr->y, player_ptr->x, y1, x1))); } if (flag & (PROJECT_GRID)) { @@ -320,11 +320,11 @@ ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX who, POSITION ra auto x = gx[i]; if (breath) { int d = dist_to_line(y, x, y1, x1, by, bx); - if (affect_feature(player_ptr, who, d, y, x, dam, typ)) { + if (affect_feature(player_ptr, src_idx, d, y, x, dam, typ)) { res.notice = true; } } else { - if (affect_feature(player_ptr, who, dist, y, x, dam, typ)) { + if (affect_feature(player_ptr, src_idx, dist, y, x, dam, typ)) { res.notice = true; } } @@ -343,11 +343,11 @@ ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX who, POSITION ra auto x = gx[i]; if (breath) { int d = dist_to_line(y, x, y1, x1, by, bx); - if (affect_item(player_ptr, who, d, y, x, dam, typ)) { + if (affect_item(player_ptr, src_idx, d, y, x, dam, typ)) { res.notice = true; } } else { - if (affect_item(player_ptr, who, dist, y, x, dam, typ)) { + if (affect_item(player_ptr, src_idx, dist, y, x, dam, typ)) { res.notice = true; } } @@ -370,7 +370,8 @@ ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX who, POSITION ra if (grids <= 1) { auto *m_ptr = &floor.m_list[grid.m_idx]; MonsterRaceInfo *ref_ptr = &m_ptr->get_monrace(); - if ((flag & PROJECT_REFLECTABLE) && grid.m_idx && ref_ptr->misc_flags.has(MonsterMiscType::REFLECTING) && ((grid.m_idx != player_ptr->riding) || !(flag & PROJECT_PLAYER)) && (!who || path_n > 1) && !one_in_(10)) { + if ((flag & PROJECT_REFLECTABLE) && grid.m_idx && ref_ptr->misc_flags.has(MonsterMiscType::REFLECTING) && ((grid.m_idx != player_ptr->riding) || !(flag & PROJECT_PLAYER)) && (!src_idx || path_n > 1) && !one_in_(10)) { + POSITION t_y, t_x; int max_attempts = 10; do { @@ -393,7 +394,7 @@ ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX who, POSITION ra } else { msg_print(_("攻撃は跳ね返った!", "The attack bounces!")); } - } else if (who <= 0) { + } else if (!is_monster(src_idx)) { sound(SOUND_REFLECT); } @@ -474,15 +475,15 @@ ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX who, POSITION ra } } - if (affect_monster(player_ptr, who, effective_dist, pos.y, pos.x, dam, typ, flag, see_s_msg, cap_mon_ptr)) { + if (affect_monster(player_ptr, src_idx, effective_dist, pos.y, pos.x, dam, typ, flag, see_s_msg, cap_mon_ptr)) { res.notice = true; } } /* Player affected one monster (without "jumping") */ - if (!who && (project_m_n == 1) && none_bits(flag, PROJECT_JUMP)) { + if (!src_idx && (project_m_n == 1) && none_bits(flag, PROJECT_JUMP)) { const Pos2D pos_project(project_m_y, project_m_x); const auto &grid = floor.get_grid(pos_project); - if (grid.m_idx > 0) { + if (grid.has_monster()) { auto &monster = floor.m_list[grid.m_idx]; if (monster.ml) { if (!player_ptr->effects()->hallucination()->is_hallucinated()) { @@ -548,11 +549,11 @@ ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX who, POSITION ra } std::string who_name; - if (who > 0) { - who_name = monster_desc(player_ptr, &floor.m_list[who], MD_WRONGDOER_NAME); + if (is_monster(src_idx)) { + who_name = monster_desc(player_ptr, &floor.m_list[src_idx], MD_WRONGDOER_NAME); } - if (affect_player(who, player_ptr, who_name.data(), effective_dist, pos.y, pos.x, dam, typ, flag, project)) { + if (affect_player(src_idx, player_ptr, who_name.data(), effective_dist, pos.y, pos.x, dam, typ, flag, project)) { res.notice = true; res.affected_player = true; } diff --git a/src/effect/effect-processor.h b/src/effect/effect-processor.h index 259baeaff..039eec94a 100644 --- a/src/effect/effect-processor.h +++ b/src/effect/effect-processor.h @@ -15,5 +15,5 @@ class CapturedMonsterType; class EffectPlayerType; class PlayerType; ProjectResult project( - PlayerType *player_ptr, const MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, const int dam, const AttributeType typ, + PlayerType *player_ptr, const MONSTER_IDX src_idx, POSITION rad, POSITION y, POSITION x, const int dam, const AttributeType typ, BIT_FLAGS flag, std::optional cap_mon_ptr = std::nullopt); diff --git a/src/flavor/named-item-describer.cpp b/src/flavor/named-item-describer.cpp index 2fc8b56f7..4079c99d3 100644 --- a/src/flavor/named-item-describer.cpp +++ b/src/flavor/named-item-describer.cpp @@ -18,7 +18,6 @@ #ifdef JP #else #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "object/tval-types.h" #include "system/monster-race-info.h" #endif diff --git a/src/flavor/object-flavor.cpp b/src/flavor/object-flavor.cpp index 910d4a32a..b05ff564b 100644 --- a/src/flavor/object-flavor.cpp +++ b/src/flavor/object-flavor.cpp @@ -23,7 +23,6 @@ #include "mind/mind-sniper.h" #include "mind/mind-weaponsmith.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "object-enchant/object-ego.h" #include "object-enchant/special-object-flags.h" #include "object-enchant/tr-types.h" diff --git a/src/flavor/tval-description-switcher.cpp b/src/flavor/tval-description-switcher.cpp index ab417d062..7bf96a2b6 100644 --- a/src/flavor/tval-description-switcher.cpp +++ b/src/flavor/tval-description-switcher.cpp @@ -18,7 +18,6 @@ #include "util/enum-converter.h" #ifdef JP #else -#include "monster-race/race-flags1.h" #include "player-info/class-info.h" #endif diff --git a/src/floor/fixed-map-generator.cpp b/src/floor/fixed-map-generator.cpp index ee57e0d22..f6f1f36f4 100644 --- a/src/floor/fixed-map-generator.cpp +++ b/src/floor/fixed-map-generator.cpp @@ -16,8 +16,6 @@ #include "monster-floor/monster-generator.h" #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "monster/monster-util.h" #include "monster/smart-learn-types.h" #include "object-enchant/item-apply-magic.h" diff --git a/src/floor/floor-changer.cpp b/src/floor/floor-changer.cpp index 77414add4..1bcfc6c0e 100644 --- a/src/floor/floor-changer.cpp +++ b/src/floor/floor-changer.cpp @@ -21,9 +21,6 @@ #include "monster-floor/monster-remover.h" #include "monster-floor/monster-summon.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-flag-types.h" diff --git a/src/floor/floor-events.cpp b/src/floor/floor-events.cpp index e570d4028..43bb0d2d0 100644 --- a/src/floor/floor-events.cpp +++ b/src/floor/floor-events.cpp @@ -15,7 +15,6 @@ #include "main/sound-of-music.h" #include "mind/mind-ninja.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-info.h" #include "monster/monster-list.h" #include "monster/monster-status.h" diff --git a/src/floor/floor-streams.cpp b/src/floor/floor-streams.cpp index 5fe95d8bf..7c2c1b3cc 100644 --- a/src/floor/floor-streams.cpp +++ b/src/floor/floor-streams.cpp @@ -343,7 +343,7 @@ void build_streamer(PlayerType *player_ptr, FEAT_IDX feat, int chance) } auto *r_ptr = &monraces_info[floor.m_list[grid.m_idx].r_idx]; - if (grid.m_idx && !(streamer.flags.has(TerrainCharacteristics::PLACE) && monster_can_cross_terrain(player_ptr, feat, r_ptr, 0))) { + if (grid.has_monster() && !(streamer.flags.has(TerrainCharacteristics::PLACE) && monster_can_cross_terrain(player_ptr, feat, r_ptr, 0))) { /* Delete the monster (if any) */ delete_monster(player_ptr, pos.y, pos.x); } diff --git a/src/floor/object-allocator.cpp b/src/floor/object-allocator.cpp index 874829449..2839b07bd 100644 --- a/src/floor/object-allocator.cpp +++ b/src/floor/object-allocator.cpp @@ -11,7 +11,6 @@ #include "grid/object-placer.h" #include "grid/trap.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "system/dungeon-info.h" #include "system/floor-type-definition.h" #include "system/grid-type-definition.h" @@ -63,7 +62,7 @@ static bool alloc_stairs_aux(PlayerType *player_ptr, POSITION y, POSITION x, int { auto *floor_ptr = player_ptr->current_floor_ptr; auto *g_ptr = &floor_ptr->grid_array[y][x]; - if (!g_ptr->is_floor() || pattern_tile(floor_ptr, y, x) || !g_ptr->o_idx_list.empty() || (g_ptr->m_idx != 0) || next_to_walls(floor_ptr, y, x) < walls) { + if (!g_ptr->is_floor() || pattern_tile(floor_ptr, y, x) || !g_ptr->o_idx_list.empty() || g_ptr->has_monster() || next_to_walls(floor_ptr, y, x) < walls) { return false; } @@ -195,7 +194,7 @@ void alloc_object(PlayerType *player_ptr, dap_type set, dungeon_allocation_type x = randint0(floor_ptr->width); const Pos2D pos(y, x); const auto &grid = floor_ptr->get_grid(pos); - if (!grid.is_floor() || !grid.o_idx_list.empty() || grid.m_idx) { + if (!grid.is_floor() || !grid.o_idx_list.empty() || grid.has_monster()) { continue; } diff --git a/src/floor/wild.cpp b/src/floor/wild.cpp index fef6bb4e6..59924e54e 100644 --- a/src/floor/wild.cpp +++ b/src/floor/wild.cpp @@ -551,7 +551,7 @@ void wilderness_gen(PlayerType *player_ptr) continue; } - if (grid.m_idx != 0) { + if (grid.has_monster()) { delete_monster_idx(player_ptr, grid.m_idx); } @@ -569,7 +569,7 @@ void wilderness_gen(PlayerType *player_ptr) continue; } - if (grid.m_idx != 0) { + if (grid.has_monster()) { delete_monster_idx(player_ptr, grid.m_idx); } diff --git a/src/grid/feature.cpp b/src/grid/feature.cpp index 589efca66..114c98117 100644 --- a/src/grid/feature.cpp +++ b/src/grid/feature.cpp @@ -234,7 +234,7 @@ void cave_set_feat(PlayerType *player_ptr, POSITION y, POSITION x, FEAT_IDX feat g_ptr->info &= ~(CAVE_MARK); } - if (g_ptr->m_idx) { + if (g_ptr->has_monster()) { update_monster(player_ptr, g_ptr->m_idx, false); } @@ -264,7 +264,7 @@ void cave_set_feat(PlayerType *player_ptr, POSITION y, POSITION x, FEAT_IDX feat auto *cc_ptr = &floor_ptr->grid_array[yy][xx]; cc_ptr->info |= CAVE_GLOW; if (cc_ptr->is_view()) { - if (cc_ptr->m_idx) { + if (cc_ptr->has_monster()) { update_monster(player_ptr, cc_ptr->m_idx, false); } diff --git a/src/grid/grid.cpp b/src/grid/grid.cpp index e863b8fd6..7ee06ef21 100644 --- a/src/grid/grid.cpp +++ b/src/grid/grid.cpp @@ -34,8 +34,6 @@ #include "io/screen-util.h" #include "monster-floor/monster-remover.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" #include "monster/monster-info.h" #include "monster/monster-status.h" #include "monster/monster-update.h" @@ -86,7 +84,7 @@ bool new_player_spot(PlayerType *player_ptr) const auto &grid = player_ptr->current_floor_ptr->get_grid({ y, x }); /* Must be a "naked" floor grid */ - if (grid.m_idx) { + if (grid.has_monster()) { continue; } if (floor.is_in_dungeon()) { @@ -186,7 +184,7 @@ static void update_local_illumination_aux(PlayerType *player_ptr, int y, int x) return; } - if (grid.m_idx > 0) { + if (grid.has_monster()) { update_monster(player_ptr, grid.m_idx, false); } @@ -851,7 +849,7 @@ bool cave_monster_teleportable_bold(PlayerType *player_ptr, MONSTER_IDX m_idx, P return false; } - if (grid.m_idx && (grid.m_idx != m_idx)) { + if (grid.has_monster() && (grid.m_idx != m_idx)) { return false; } if (player_ptr->is_located_at(pos)) { @@ -898,7 +896,7 @@ bool cave_player_teleportable_bold(PlayerType *player_ptr, POSITION y, POSITION return false; } - if (grid.m_idx && (grid.m_idx != player_ptr->riding)) { + if (grid.has_monster() && (grid.m_idx != player_ptr->riding)) { return false; } @@ -1062,7 +1060,7 @@ void place_grid(PlayerType *player_ptr, Grid *g_ptr, grid_bold_type gb_type) return; } - if (g_ptr->m_idx > 0) { + if (g_ptr->has_monster()) { delete_monster_idx(player_ptr, g_ptr->m_idx); } } diff --git a/src/hpmp/hp-mp-processor.cpp b/src/hpmp/hp-mp-processor.cpp index fc465d0db..d9fbd5e9d 100644 --- a/src/hpmp/hp-mp-processor.cpp +++ b/src/hpmp/hp-mp-processor.cpp @@ -11,8 +11,6 @@ #include "main/sound-definitions-table.h" #include "main/sound-of-music.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "object-enchant/object-ego.h" #include "object-enchant/tr-types.h" #include "object-enchant/trc-types.h" diff --git a/src/hpmp/hp-mp-regenerator.cpp b/src/hpmp/hp-mp-regenerator.cpp index e7f9cd24d..df479fd6b 100644 --- a/src/hpmp/hp-mp-regenerator.cpp +++ b/src/hpmp/hp-mp-regenerator.cpp @@ -3,7 +3,6 @@ #include "core/window-redrawer.h" #include "inventory/inventory-slot-types.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags2.h" #include "monster/monster-status.h" #include "player-base/player-class.h" #include "player-info/magic-eater-data-type.h" diff --git a/src/info-reader/race-info-tokens-table.h b/src/info-reader/race-info-tokens-table.h index c3c18eafd..b1e0d7c38 100644 --- a/src/info-reader/race-info-tokens-table.h +++ b/src/info-reader/race-info-tokens-table.h @@ -9,11 +9,6 @@ #include "monster-race/race-drop-flags.h" #include "monster-race/race-feature-flags.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" -#include "monster-race/race-flags8.h" #include "monster-race/race-kind-flags.h" #include "monster-race/race-misc-flags.h" #include "monster-race/race-population-flags.h" diff --git a/src/io-dump/character-dump.cpp b/src/io-dump/character-dump.cpp index c26a5b55f..9446a64b4 100644 --- a/src/io-dump/character-dump.cpp +++ b/src/io-dump/character-dump.cpp @@ -16,7 +16,6 @@ #include "main/angband-headers.h" #include "market/arena-info-table.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" diff --git a/src/io/cursor.cpp b/src/io/cursor.cpp index 01aaba353..80ba10c8d 100644 --- a/src/io/cursor.cpp +++ b/src/io/cursor.cpp @@ -57,7 +57,7 @@ void print_path(PlayerType *player_ptr, POSITION y, POSITION x) TERM_COLOR ta = default_color; auto tc = '*'; - if (g_ptr->m_idx && floor_ptr->m_list[g_ptr->m_idx].ml) { + if (g_ptr->has_monster() && floor_ptr->m_list[g_ptr->m_idx].ml) { map_info(player_ptr, ny, nx, &a, &c, &ta, &tc); if (!is_ascii_graphics(a)) { diff --git a/src/io/files-util.cpp b/src/io/files-util.cpp index 6531e4e7f..8498e9929 100644 --- a/src/io/files-util.cpp +++ b/src/io/files-util.cpp @@ -17,7 +17,6 @@ #include "io/input-key-acceptor.h" #include "io/uid-checker.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "system/angband-exceptions.h" #include "system/monster-race-info.h" #include "system/player-type-definition.h" diff --git a/src/knowledge/knowledge-monsters.cpp b/src/knowledge/knowledge-monsters.cpp index 9aea32085..59b61a24e 100644 --- a/src/knowledge/knowledge-monsters.cpp +++ b/src/knowledge/knowledge-monsters.cpp @@ -17,9 +17,6 @@ #include "locale/english.h" #include "lore/lore-util.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" diff --git a/src/knowledge/knowledge-uniques.cpp b/src/knowledge/knowledge-uniques.cpp index 04b09738a..6308c7f6f 100644 --- a/src/knowledge/knowledge-uniques.cpp +++ b/src/knowledge/knowledge-uniques.cpp @@ -9,7 +9,6 @@ #include "game-option/cheat-options.h" #include "io-dump/dump-util.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "system/monster-race-info.h" #include "system/player-type-definition.h" #include "term/z-form.h" diff --git a/src/load/dungeon-loader.cpp b/src/load/dungeon-loader.cpp index cd34fe98d..172af5439 100644 --- a/src/load/dungeon-loader.cpp +++ b/src/load/dungeon-loader.cpp @@ -8,7 +8,6 @@ #include "load/load-util.h" #include "load/old/load-v1-5-0.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "save/floor-writer.h" #include "system/floor-type-definition.h" #include "system/monster-race-info.h" diff --git a/src/load/lore-loader.cpp b/src/load/lore-loader.cpp index 06528e94d..7096d5048 100644 --- a/src/load/lore-loader.cpp +++ b/src/load/lore-loader.cpp @@ -5,10 +5,6 @@ #include "load/old/load-v1-5-0.h" #include "load/savedata-old-flag-types.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "system/angband.h" #include "system/monster-race-info.h" #include "system/system-variables.h" @@ -17,6 +13,11 @@ static void migrate_old_misc_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_flags1, BIT_FLAGS old_flags2) { + if (!loading_savefile_version_is_older_than(20)) { + rd_FlagGroup(r_ptr->r_misc_flags, rd_byte); + return; + } + constexpr auto SIZE_OF_RF1 = 6; struct flag_list_ver20 { SavedataLoreOlderThan20FlagType old_flag; @@ -60,6 +61,11 @@ static void migrate_old_misc_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_flags1, static void migrate_old_feature_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_flags) { + if (!loading_savefile_version_is_older_than(19)) { + rd_FlagGroup(r_ptr->feature_flags, rd_byte); + return; + } + if (any_bits(old_flags, enum2i(SavedataLoreOlderThan19FlagType::RF2_PASS_WALL))) { r_ptr->r_feature_flags.set(MonsterFeatureType::PASS_WALL); } @@ -68,23 +74,32 @@ static void migrate_old_feature_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_flag } } -static void migrate_old_aura_flags(MonsterRaceInfo *r_ptr) +static void migrate_old_aura_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_flags2, BIT_FLAGS old_flags3) { - if (any_bits(r_ptr->r_flags2, SavedataLoreOlderThan10FlagType::AURA_FIRE_OLD)) { + if (!loading_savefile_version_is_older_than(10)) { + rd_FlagGroup(r_ptr->r_aura_flags, rd_byte); + return; + } + + if (any_bits(old_flags2, SavedataLoreOlderThan10FlagType::AURA_FIRE_OLD)) { r_ptr->r_aura_flags.set(MonsterAuraType::FIRE); } - if (any_bits(r_ptr->r_flags3, SavedataLoreOlderThan10FlagType::AURA_COLD_OLD)) { + if (any_bits(old_flags3, SavedataLoreOlderThan10FlagType::AURA_COLD_OLD)) { r_ptr->r_aura_flags.set(MonsterAuraType::COLD); } - if (any_bits(r_ptr->r_flags2, SavedataLoreOlderThan10FlagType::AURA_ELEC_OLD)) { + if (any_bits(old_flags2, SavedataLoreOlderThan10FlagType::AURA_ELEC_OLD)) { r_ptr->r_aura_flags.set(MonsterAuraType::ELEC); } } static void migrate_old_resistance_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_flags) { + if (!loading_savefile_version_is_older_than(14)) { + return; + } + struct flag_list_ver14 { SavedataLoreOlderThan14FlagType old_flag; MonsterResistanceType flag; @@ -126,6 +141,11 @@ static void migrate_old_resistance_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_f static void migrate_old_drop_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_flags1) { + if (!loading_savefile_version_is_older_than(18)) { + rd_FlagGroup(r_ptr->r_drop_flags, rd_byte); + return; + } + struct flag_list_ver18 { SavedataLoreOlderThan18FlagType old_flag; MonsterDropType flag; @@ -151,8 +171,12 @@ static void migrate_old_drop_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_flags1) } } -static void migrate_old_no_debuff_flags(MonsterRaceInfo *r_ptr) +static void migrate_old_no_debuff_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_flags3) { + if (!loading_savefile_version_is_older_than(19)) { + return; + } + struct flag_list_ver19 { SavedataLoreOlderThan19FlagType_No_Debuff old_flag; MonsterResistanceType flag; @@ -166,23 +190,13 @@ static void migrate_old_no_debuff_flags(MonsterRaceInfo *r_ptr) }; for (const auto &l : flag_list) { - if (any_bits(r_ptr->r_flags3, l.old_flag)) { + if (any_bits(old_flags3, l.old_flag)) { r_ptr->r_resistance_flags.set(l.flag); } } } -static void rd_r_drop_flags(MonsterRaceInfo *r_ptr) -{ - if (loading_savefile_version_is_older_than(18)) { - migrate_old_drop_flags(r_ptr, r_ptr->r_flags1); - return; - } - - rd_FlagGroup(r_ptr->r_drop_flags, rd_byte); -} - -static void rd_r_ability_flags(MonsterRaceInfo *r_ptr, const MonsterRaceId r_idx) +static void migrate_old_resistance_and_ability_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS f3, const MonsterRaceId r_idx) { if (loading_savefile_version_is_older_than(3)) { BIT_FLAGS r_flagsr = 0; @@ -190,7 +204,7 @@ static void rd_r_ability_flags(MonsterRaceInfo *r_ptr, const MonsterRaceId r_idx uint32_t f5 = rd_u32b(); uint32_t f6 = rd_u32b(); if (h_older_than(1, 5, 0, 3)) { - set_old_lore(r_ptr, f4, r_idx); + set_old_lore(r_ptr, f3, f4, r_idx); } else { r_flagsr = rd_u32b(); } @@ -211,132 +225,103 @@ static void rd_r_ability_flags(MonsterRaceInfo *r_ptr, const MonsterRaceId r_idx } } -static void rd_r_aura_flags(MonsterRaceInfo *r_ptr) +static void migrate_old_kind_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_flags1, BIT_FLAGS old_flags2, BIT_FLAGS old_flags3) { - if (loading_savefile_version_is_older_than(10)) { + if (!loading_savefile_version_is_older_than(12)) { + rd_FlagGroup(r_ptr->r_kind_flags, rd_byte); return; } - rd_FlagGroup(r_ptr->r_aura_flags, rd_byte); -} - -static void rd_r_kind_flags(MonsterRaceInfo *r_ptr) -{ - if (loading_savefile_version_is_older_than(12)) { - struct flag_list_ver12 { - BIT_FLAGS check_flag; - MonsterKindType flag; - }; - - const std::vector flag1 = { - { RF1_UNIQUE, MonsterKindType::UNIQUE }, - }; - - const std::vector flag2 = { - { static_cast(RF2_HUMAN), MonsterKindType::HUMAN }, - { static_cast(RF2_QUANTUM), MonsterKindType::QUANTUM }, - }; - - const std::vector flag3 = { - { RF3_ORC, MonsterKindType::ORC }, - { RF3_TROLL, MonsterKindType::TROLL }, - { RF3_GIANT, MonsterKindType::GIANT }, - { RF3_DRAGON, MonsterKindType::DRAGON }, - { RF3_DEMON, MonsterKindType::DEMON }, - { RF3_AMBERITE, MonsterKindType::AMBERITE }, - { RF3_ANGEL, MonsterKindType::ANGEL }, - { RF3_DRAGON, MonsterKindType::DRAGON }, - { RF3_EVIL, MonsterKindType::EVIL }, - { RF3_GOOD, MonsterKindType::GOOD }, - { RF3_ANIMAL, MonsterKindType::ANIMAL }, - { RF3_UNDEAD, MonsterKindType::UNDEAD }, - - }; - - for (const auto &f : flag1) { - if (any_bits(r_ptr->r_flags1, f.check_flag)) { - r_ptr->r_kind_flags.set(f.flag); - } - } + struct flag_list_ver12 { + SavedataLoreOlderThan12FlagType check_flag; + MonsterKindType flag; + }; - for (const auto &f : flag2) { - if (any_bits(r_ptr->r_flags2, f.check_flag)) { - r_ptr->r_kind_flags.set(f.flag); - } - } + const std::vector flag1 = { + { SavedataLoreOlderThan12FlagType::RF1_UNIQUE, MonsterKindType::UNIQUE }, + }; - for (const auto &f : flag3) { - if (any_bits(r_ptr->r_flags3, f.check_flag)) { - r_ptr->r_kind_flags.set(f.flag); - } - } + const std::vector flag2 = { + { SavedataLoreOlderThan12FlagType::RF2_HUMAN, MonsterKindType::HUMAN }, + { SavedataLoreOlderThan12FlagType::RF2_QUANTUM, MonsterKindType::QUANTUM }, + }; - return; - } + const std::vector flag3 = { + { SavedataLoreOlderThan12FlagType::RF3_ORC, MonsterKindType::ORC }, + { SavedataLoreOlderThan12FlagType::RF3_TROLL, MonsterKindType::TROLL }, + { SavedataLoreOlderThan12FlagType::RF3_GIANT, MonsterKindType::GIANT }, + { SavedataLoreOlderThan12FlagType::RF3_DRAGON, MonsterKindType::DRAGON }, + { SavedataLoreOlderThan12FlagType::RF3_DEMON, MonsterKindType::DEMON }, + { SavedataLoreOlderThan12FlagType::RF3_AMBERITE, MonsterKindType::AMBERITE }, + { SavedataLoreOlderThan12FlagType::RF3_ANGEL, MonsterKindType::ANGEL }, + { SavedataLoreOlderThan12FlagType::RF3_DRAGON, MonsterKindType::DRAGON }, + { SavedataLoreOlderThan12FlagType::RF3_EVIL, MonsterKindType::EVIL }, + { SavedataLoreOlderThan12FlagType::RF3_GOOD, MonsterKindType::GOOD }, + { SavedataLoreOlderThan12FlagType::RF3_ANIMAL, MonsterKindType::ANIMAL }, + { SavedataLoreOlderThan12FlagType::RF3_UNDEAD, MonsterKindType::UNDEAD }, - rd_FlagGroup(r_ptr->r_kind_flags, rd_byte); -} + }; -static void rd_r_behavior_flags(MonsterRaceInfo *r_ptr) -{ - if (loading_savefile_version_is_older_than(11)) { - struct flag_list_ver11 { - BIT_FLAGS check_flag; - MonsterBehaviorType flag; - }; - - const std::vector flag1 = { - { RF1_NEVER_BLOW, MonsterBehaviorType::NEVER_BLOW }, - { RF1_NEVER_MOVE, MonsterBehaviorType::NEVER_MOVE }, - { RF1_RAND_25, MonsterBehaviorType::RAND_MOVE_25 }, - { RF1_RAND_50, MonsterBehaviorType::RAND_MOVE_50 }, - }; - - const std::vector flag2 = { - { RF2_OPEN_DOOR, MonsterBehaviorType::OPEN_DOOR }, - { RF2_BASH_DOOR, MonsterBehaviorType::BASH_DOOR }, - { RF2_MOVE_BODY, MonsterBehaviorType::MOVE_BODY }, - { RF2_KILL_BODY, MonsterBehaviorType::KILL_BODY }, - { RF2_TAKE_ITEM, MonsterBehaviorType::TAKE_ITEM }, - { RF2_KILL_ITEM, MonsterBehaviorType::KILL_ITEM }, - { RF2_STUPID, MonsterBehaviorType::STUPID }, - { RF2_SMART, MonsterBehaviorType::SMART }, - }; - - for (const auto &f : flag1) { - if (any_bits(r_ptr->r_flags1, f.check_flag)) { - r_ptr->r_behavior_flags.set(f.flag); - } + for (const auto &f : flag1) { + if (any_bits(old_flags1, f.check_flag)) { + r_ptr->r_kind_flags.set(f.flag); } + } - for (const auto &f : flag2) { - if (any_bits(r_ptr->r_flags2, f.check_flag)) { - r_ptr->r_behavior_flags.set(f.flag); - } + for (const auto &f : flag2) { + if (any_bits(old_flags2, f.check_flag)) { + r_ptr->r_kind_flags.set(f.flag); } - - return; } - rd_FlagGroup(r_ptr->r_behavior_flags, rd_byte); + for (const auto &f : flag3) { + if (any_bits(old_flags3, f.check_flag)) { + r_ptr->r_kind_flags.set(f.flag); + } + } } -static void rd_r_feature_flags(MonsterRaceInfo *r_ptr) +static void migrate_old_behavior_flags(MonsterRaceInfo *r_ptr, BIT_FLAGS old_flags1, BIT_FLAGS old_flags2) { - if (loading_savefile_version_is_older_than(19)) { - migrate_old_feature_flags(r_ptr, r_ptr->r_flags2); + if (!loading_savefile_version_is_older_than(11)) { + rd_FlagGroup(r_ptr->r_behavior_flags, rd_byte); return; } - rd_FlagGroup(r_ptr->r_feature_flags, rd_byte); -} -static void rd_r_misc_flags(MonsterRaceInfo *r_ptr) -{ - if (loading_savefile_version_is_older_than(20)) { - migrate_old_misc_flags(r_ptr, r_ptr->r_flags1, r_ptr->r_flags2); - return; + struct flag_list_ver11 { + SavedataLoreOlderThan11FlagType check_flag; + MonsterBehaviorType flag; + }; + + const std::vector flag1 = { + { SavedataLoreOlderThan11FlagType::RF1_NEVER_BLOW, MonsterBehaviorType::NEVER_BLOW }, + { SavedataLoreOlderThan11FlagType::RF1_NEVER_MOVE, MonsterBehaviorType::NEVER_MOVE }, + { SavedataLoreOlderThan11FlagType::RF1_RAND_25, MonsterBehaviorType::RAND_MOVE_25 }, + { SavedataLoreOlderThan11FlagType::RF1_RAND_50, MonsterBehaviorType::RAND_MOVE_50 }, + }; + + const std::vector flag2 = { + { SavedataLoreOlderThan11FlagType::RF2_OPEN_DOOR, MonsterBehaviorType::OPEN_DOOR }, + { SavedataLoreOlderThan11FlagType::RF2_BASH_DOOR, MonsterBehaviorType::BASH_DOOR }, + { SavedataLoreOlderThan11FlagType::RF2_MOVE_BODY, MonsterBehaviorType::MOVE_BODY }, + { SavedataLoreOlderThan11FlagType::RF2_KILL_BODY, MonsterBehaviorType::KILL_BODY }, + { SavedataLoreOlderThan11FlagType::RF2_TAKE_ITEM, MonsterBehaviorType::TAKE_ITEM }, + { SavedataLoreOlderThan11FlagType::RF2_KILL_ITEM, MonsterBehaviorType::KILL_ITEM }, + { SavedataLoreOlderThan11FlagType::RF2_STUPID, MonsterBehaviorType::STUPID }, + { SavedataLoreOlderThan11FlagType::RF2_SMART, MonsterBehaviorType::SMART }, + }; + + for (const auto &f : flag1) { + if (any_bits(old_flags1, f.check_flag)) { + r_ptr->r_behavior_flags.set(f.flag); + } + } + + for (const auto &f : flag2) { + if (any_bits(old_flags2, f.check_flag)) { + r_ptr->r_behavior_flags.set(f.flag); + } } - rd_FlagGroup(r_ptr->r_misc_flags, rd_byte); } /*! @@ -378,21 +363,34 @@ static void rd_lore(MonsterRaceInfo *r_ptr, const MonsterRaceId r_idx) r_ptr->r_blows[2] = rd_byte(); r_ptr->r_blows[3] = rd_byte(); - r_ptr->r_flags1 = rd_u32b(); - r_ptr->r_flags2 = rd_u32b(); - r_ptr->r_flags3 = rd_u32b(); - migrate_old_no_debuff_flags(r_ptr); - migrate_old_aura_flags(r_ptr); - rd_r_ability_flags(r_ptr, r_idx); - rd_r_aura_flags(r_ptr); - rd_r_behavior_flags(r_ptr); - rd_r_kind_flags(r_ptr); - rd_r_drop_flags(r_ptr); - rd_r_feature_flags(r_ptr); - if (!loading_savefile_version_is_older_than(20)) { - rd_FlagGroup(r_ptr->special_flags, rd_byte); + if (loading_savefile_version_is_older_than(21)) { + auto r_flags1 = rd_u32b(); + auto r_flags2 = rd_u32b(); + auto r_flags3 = rd_u32b(); + + migrate_old_no_debuff_flags(r_ptr, r_flags3); + migrate_old_resistance_and_ability_flags(r_ptr, r_flags3, r_idx); + migrate_old_aura_flags(r_ptr, r_flags2, r_flags3); + migrate_old_behavior_flags(r_ptr, r_flags1, r_flags2); + migrate_old_kind_flags(r_ptr, r_flags1, r_flags2, r_flags3); + migrate_old_drop_flags(r_ptr, r_flags1); + migrate_old_feature_flags(r_ptr, r_flags2); + if (!loading_savefile_version_is_older_than(20)) { + rd_FlagGroup(r_ptr->r_special_flags, rd_byte); + } + migrate_old_misc_flags(r_ptr, r_flags1, r_flags2); + } else { + rd_FlagGroup(r_ptr->r_resistance_flags, rd_byte); + rd_FlagGroup(r_ptr->r_ability_flags, rd_byte); + rd_FlagGroup(r_ptr->r_aura_flags, rd_byte); + rd_FlagGroup(r_ptr->r_behavior_flags, rd_byte); + rd_FlagGroup(r_ptr->r_kind_flags, rd_byte); + rd_FlagGroup(r_ptr->r_drop_flags, rd_byte); + rd_FlagGroup(r_ptr->r_feature_flags, rd_byte); + rd_FlagGroup(r_ptr->r_special_flags, rd_byte); + rd_FlagGroup(r_ptr->r_misc_flags, rd_byte); } - rd_r_misc_flags(r_ptr); + r_ptr->max_num = rd_byte(); r_ptr->floor_id = rd_s16b(); @@ -403,9 +401,6 @@ static void rd_lore(MonsterRaceInfo *r_ptr, const MonsterRaceId r_idx) strip_bytes(1); - r_ptr->r_flags1 &= r_ptr->flags1; - r_ptr->r_flags2 &= r_ptr->flags2; - r_ptr->r_flags3 &= r_ptr->flags3; r_ptr->r_resistance_flags &= r_ptr->resistance_flags; r_ptr->r_ability_flags &= r_ptr->ability_flags; r_ptr->r_aura_flags &= r_ptr->aura_flags; diff --git a/src/load/old/load-v1-5-0.cpp b/src/load/old/load-v1-5-0.cpp index 013a0083e..1eda0d816 100644 --- a/src/load/old/load-v1-5-0.cpp +++ b/src/load/old/load-v1-5-0.cpp @@ -24,8 +24,7 @@ #include "monster-floor/monster-move.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" + #include "monster-race/race-indice-types.h" #include "monster/monster-flag-types.h" #include "monster/monster-info.h" @@ -484,10 +483,9 @@ void rd_monster_old(PlayerType *player_ptr, MonsterEntity *m_ptr) strip_bytes(1); } -static void move_RF3_to_RFR(MonsterRaceInfo *r_ptr, const BIT_FLAGS rf3, const MonsterResistanceType rfr) +static void move_RF3_to_RFR(MonsterRaceInfo *r_ptr, BIT_FLAGS f3, const BIT_FLAGS rf3, const MonsterResistanceType rfr) { - if (r_ptr->r_flags3 & rf3) { - r_ptr->r_flags3 &= ~rf3; + if (f3 & rf3) { r_ptr->resistance_flags.set(rfr); } } @@ -505,21 +503,21 @@ static void move_RF4_BR_to_RFR(MonsterRaceInfo *r_ptr, BIT_FLAGS f4, const BIT_F * @param r_idx モンスター種族ID * @details 本来はr_idxからr_ptrを決定可能だが、互換性を優先するため元コードのままとする */ -void set_old_lore(MonsterRaceInfo *r_ptr, BIT_FLAGS f4, const MonsterRaceId r_idx) +void set_old_lore(MonsterRaceInfo *r_ptr, BIT_FLAGS f3, BIT_FLAGS f4, const MonsterRaceId r_idx) { r_ptr->r_resistance_flags.clear(); - move_RF3_to_RFR(r_ptr, RF3_IM_ACID, MonsterResistanceType::IMMUNE_ACID); - move_RF3_to_RFR(r_ptr, RF3_IM_ELEC, MonsterResistanceType::IMMUNE_ELEC); - move_RF3_to_RFR(r_ptr, RF3_IM_FIRE, MonsterResistanceType::IMMUNE_FIRE); - move_RF3_to_RFR(r_ptr, RF3_IM_COLD, MonsterResistanceType::IMMUNE_COLD); - move_RF3_to_RFR(r_ptr, RF3_IM_POIS, MonsterResistanceType::IMMUNE_POISON); - move_RF3_to_RFR(r_ptr, RF3_RES_TELE, MonsterResistanceType::RESIST_TELEPORT); - move_RF3_to_RFR(r_ptr, RF3_RES_NETH, MonsterResistanceType::RESIST_NETHER); - move_RF3_to_RFR(r_ptr, RF3_RES_WATE, MonsterResistanceType::RESIST_WATER); - move_RF3_to_RFR(r_ptr, RF3_RES_PLAS, MonsterResistanceType::RESIST_PLASMA); - move_RF3_to_RFR(r_ptr, RF3_RES_NEXU, MonsterResistanceType::RESIST_NEXUS); - move_RF3_to_RFR(r_ptr, RF3_RES_DISE, MonsterResistanceType::RESIST_DISENCHANT); - move_RF3_to_RFR(r_ptr, RF3_RES_ALL, MonsterResistanceType::RESIST_ALL); + move_RF3_to_RFR(r_ptr, f3, RF3_IM_ACID, MonsterResistanceType::IMMUNE_ACID); + move_RF3_to_RFR(r_ptr, f3, RF3_IM_ELEC, MonsterResistanceType::IMMUNE_ELEC); + move_RF3_to_RFR(r_ptr, f3, RF3_IM_FIRE, MonsterResistanceType::IMMUNE_FIRE); + move_RF3_to_RFR(r_ptr, f3, RF3_IM_COLD, MonsterResistanceType::IMMUNE_COLD); + move_RF3_to_RFR(r_ptr, f3, RF3_IM_POIS, MonsterResistanceType::IMMUNE_POISON); + move_RF3_to_RFR(r_ptr, f3, RF3_RES_TELE, MonsterResistanceType::RESIST_TELEPORT); + move_RF3_to_RFR(r_ptr, f3, RF3_RES_NETH, MonsterResistanceType::RESIST_NETHER); + move_RF3_to_RFR(r_ptr, f3, RF3_RES_WATE, MonsterResistanceType::RESIST_WATER); + move_RF3_to_RFR(r_ptr, f3, RF3_RES_PLAS, MonsterResistanceType::RESIST_PLASMA); + move_RF3_to_RFR(r_ptr, f3, RF3_RES_NEXU, MonsterResistanceType::RESIST_NEXUS); + move_RF3_to_RFR(r_ptr, f3, RF3_RES_DISE, MonsterResistanceType::RESIST_DISENCHANT); + move_RF3_to_RFR(r_ptr, f3, RF3_RES_ALL, MonsterResistanceType::RESIST_ALL); move_RF4_BR_to_RFR(r_ptr, f4, RF4_BR_LITE, MonsterResistanceType::RESIST_LITE); move_RF4_BR_to_RFR(r_ptr, f4, RF4_BR_DARK, MonsterResistanceType::RESIST_DARK); diff --git a/src/load/old/load-v1-5-0.h b/src/load/old/load-v1-5-0.h index 29b55d419..3da59d3aa 100644 --- a/src/load/old/load-v1-5-0.h +++ b/src/load/old/load-v1-5-0.h @@ -40,5 +40,5 @@ class ItemEntity; class PlayerType; void rd_item_old(ItemEntity *o_ptr); void rd_monster_old(PlayerType *player_ptr, MonsterEntity *m_ptr); -void set_old_lore(MonsterRaceInfo *r_ptr, BIT_FLAGS f4, const MonsterRaceId r_idx); +void set_old_lore(MonsterRaceInfo *r_ptr, BIT_FLAGS f3, BIT_FLAGS f4, const MonsterRaceId r_idx); errr rd_dungeon_old(PlayerType *player_ptr); diff --git a/src/load/quest-loader.cpp b/src/load/quest-loader.cpp index 566b1f6af..cb1b8b970 100644 --- a/src/load/quest-loader.cpp +++ b/src/load/quest-loader.cpp @@ -7,8 +7,6 @@ #include "load/load-zangband.h" #include "load/savedata-old-flag-types.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "object-enchant/trg-types.h" #include "system/angband-exceptions.h" #include "system/artifact-type-definition.h" diff --git a/src/load/savedata-old-flag-types.h b/src/load/savedata-old-flag-types.h index 9725d90da..993667fdf 100644 --- a/src/load/savedata-old-flag-types.h +++ b/src/load/savedata-old-flag-types.h @@ -29,6 +29,41 @@ enum class SavedataLoreOlderThan10FlagType { AURA_ELEC_OLD = 0x00008000, }; +enum class SavedataLoreOlderThan11FlagType : uint32_t { + RF1_NEVER_BLOW = 0x00010000, /*!< モンスター特性: 打撃を一切行わない / Never make physical blow */ + RF1_NEVER_MOVE = 0x00020000, /*!< モンスター特性: 移動を一切行わない / Never make physical move */ + RF1_RAND_25 = 0x00040000, /*!< モンスター特性: ランダムに移動する確率+25%/ Moves randomly (25%) */ + RF1_RAND_50 = 0x00080000, /*!< モンスター特性: ランダムに移動する確率+50%/ Moves randomly (50%) */ + RF2_STUPID = 0x00000001, /*!< モンスター特性: 愚かな行動を取る / Monster is stupid */ + RF2_SMART = 0x00000002, /*!< モンスター特性: 賢い行動を取る / Monster is smart */ + RF2_OPEN_DOOR = 0x00010000, /*!< モンスター特性: ドアを開けることができる / Monster can open doors */ + RF2_BASH_DOOR = 0x00020000, /*!< モンスター特性: ドアを破壊することができる / Monster can bash doors */ + RF2_PASS_WALL = 0x00040000, /*!< モンスター特性: 壁を抜けることができる / Monster can pass walls */ + RF2_KILL_WALL = 0x00080000, /*!< モンスター特性: 壁を破壊して進む / Monster can destroy walls */ + RF2_MOVE_BODY = 0x00100000, /*!< モンスター特性: 道中の弱いモンスターを押しのけることができる / Monster can move monsters */ + RF2_KILL_BODY = 0x00200000, /*!< モンスター特性: 道中の弱いモンスターを殺して進む / Monster can kill monsters */ + RF2_TAKE_ITEM = 0x00400000, /*!< モンスター特性: 道中のアイテムを拾う / Monster can pick up items */ + RF2_KILL_ITEM = 0x00800000, /*!< モンスター特性: 道中のアイテムを破壊する / Monster can crush items */ +}; + +enum class SavedataLoreOlderThan12FlagType : uint32_t { + RF1_UNIQUE = 0x00000001, /*!< モンスター特性: ユニーク / Unique Monster */ + RF1_QUESTOR = 0x00000002, /*!< モンスター特性: クエストモンスター / Quest Monster */ + RF2_HUMAN = 0x40000000, /*!< モンスター特性: 人間 / Human */ + RF2_QUANTUM = 0x80000000, /*!< モンスター特性: 量子的な振る舞いをする / Monster has quantum behavior */ + RF3_ORC = 0x00000001, /*!< モンスター特性: オーク / Orc */ + RF3_TROLL = 0x00000002, /*!< モンスター特性: トロル / Troll */ + RF3_GIANT = 0x00000004, /*!< モンスター特性: 巨人 / Giant */ + RF3_DRAGON = 0x00000008, /*!< モンスター特性: ドラゴン / Dragon */ + RF3_DEMON = 0x00000010, /*!< モンスター特性: 悪魔 / Demon */ + RF3_UNDEAD = 0x00000020, /*!< モンスター特性: アンデッド / Undead */ + RF3_EVIL = 0x00000040, /*!< モンスター特性: 邪悪 / Evil */ + RF3_ANIMAL = 0x00000080, /*!< モンスター特性: 動物 / Animal */ + RF3_AMBERITE = 0x00000100, /*!< モンスター特性: アンバーの血族 / TY: Amberite */ + RF3_GOOD = 0x00000200, /*!< モンスター特性: 善良 / Good */ + RF3_ANGEL = 0x00010000, /*!< モンスター特性: 天使 / ANGEL */ +}; + enum class SavedataLoreOlderThan14FlagType { RFR_IM_ACID = 0x00000001, /* Immunity acid */ RFR_IM_ELEC = 0x00000002, /* Immunity elec */ diff --git a/src/lore/lore-calculator.cpp b/src/lore/lore-calculator.cpp index 2a12099df..4d33fa1c8 100644 --- a/src/lore/lore-calculator.cpp +++ b/src/lore/lore-calculator.cpp @@ -3,7 +3,6 @@ #include "lore/lore-util.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-flags.h" -#include "monster-race/race-flags1.h" #include "mspell/mspell-damage-calculator.h" #include "system/monster-race-info.h" #include "system/player-type-definition.h" @@ -159,9 +158,6 @@ void set_flags_for_full_knowledge(lore_type *lore_ptr) lore_ptr->drop_gold = 0; } - lore_ptr->flags1 = lore_ptr->r_ptr->flags1; - lore_ptr->flags2 = lore_ptr->r_ptr->flags2; - lore_ptr->flags3 = lore_ptr->r_ptr->flags3; lore_ptr->ability_flags = lore_ptr->r_ptr->ability_flags; lore_ptr->aura_flags = lore_ptr->r_ptr->aura_flags; lore_ptr->behavior_flags = lore_ptr->r_ptr->behavior_flags; diff --git a/src/lore/lore-store.cpp b/src/lore/lore-store.cpp index d4421a609..df1008bb0 100644 --- a/src/lore/lore-store.cpp +++ b/src/lore/lore-store.cpp @@ -7,7 +7,6 @@ #include "lore/lore-store.h" #include "core/window-redrawer.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-info.h" #include "system/floor-type-definition.h" #include "system/monster-entity.h" //!< @todo 違和感、m_ptr は外から与えることとしたい. @@ -78,18 +77,6 @@ int lore_do_probe(PlayerType *player_ptr, MonsterRaceId r_idx) } r_ptr->r_cast_spell = MAX_UCHAR; - for (int i = 0; i < 32; i++) { - if (!(r_ptr->r_flags1 & (1UL << i)) && (r_ptr->flags1 & (1UL << i))) { - n++; - } - if (!(r_ptr->r_flags2 & (1UL << i)) && (r_ptr->flags2 & (1UL << i))) { - n++; - } - if (!(r_ptr->r_flags3 & (1UL << i)) && (r_ptr->flags3 & (1UL << i))) { - n++; - } - } - n += count_lore_mflag_group(r_ptr->resistance_flags, r_ptr->r_resistance_flags); n += count_lore_mflag_group(r_ptr->ability_flags, r_ptr->r_ability_flags); n += count_lore_mflag_group(r_ptr->behavior_flags, r_ptr->r_behavior_flags); @@ -98,9 +85,6 @@ int lore_do_probe(PlayerType *player_ptr, MonsterRaceId r_idx) n += count_lore_mflag_group(r_ptr->special_flags, r_ptr->r_special_flags); n += count_lore_mflag_group(r_ptr->misc_flags, r_ptr->r_misc_flags); - r_ptr->r_flags1 = r_ptr->flags1; - r_ptr->r_flags2 = r_ptr->flags2; - r_ptr->r_flags3 = r_ptr->flags3; r_ptr->r_resistance_flags = r_ptr->resistance_flags; r_ptr->r_ability_flags = r_ptr->ability_flags; r_ptr->r_behavior_flags = r_ptr->behavior_flags; diff --git a/src/lore/lore-util.cpp b/src/lore/lore-util.cpp index 2605b561d..20e47ba0d 100644 --- a/src/lore/lore-util.cpp +++ b/src/lore/lore-util.cpp @@ -40,14 +40,10 @@ lore_type::lore_type(MonsterRaceId r_idx, monster_lore_mode mode) this->speed = this->nightmare ? this->r_ptr->speed + 5 : this->r_ptr->speed; this->drop_gold = this->r_ptr->r_drop_gold; this->drop_item = this->r_ptr->r_drop_item; - this->flags1 = (this->r_ptr->flags1 & this->r_ptr->r_flags1); - this->flags2 = (this->r_ptr->flags2 & this->r_ptr->r_flags2); - this->flags3 = (this->r_ptr->flags3 & this->r_ptr->r_flags3); this->ability_flags = (this->r_ptr->ability_flags & this->r_ptr->r_ability_flags); this->aura_flags = (this->r_ptr->aura_flags & this->r_ptr->r_aura_flags); this->behavior_flags = (this->r_ptr->behavior_flags & this->r_ptr->r_behavior_flags); this->drop_flags = (this->r_ptr->drop_flags & this->r_ptr->r_drop_flags); - this->flags7 = (this->r_ptr->flags7 & this->r_ptr->flags7); this->resistance_flags = (this->r_ptr->resistance_flags & this->r_ptr->r_resistance_flags); this->feature_flags = (this->r_ptr->feature_flags & this->r_ptr->r_feature_flags); this->brightness_flags = this->r_ptr->brightness_flags; diff --git a/src/lore/lore-util.h b/src/lore/lore-util.h index 01a168894..a4371828a 100644 --- a/src/lore/lore-util.h +++ b/src/lore/lore-util.h @@ -70,10 +70,6 @@ struct lore_type { byte speed; ITEM_NUMBER drop_gold; ITEM_NUMBER drop_item; - BIT_FLAGS flags1; - BIT_FLAGS flags2; - BIT_FLAGS flags3; - BIT_FLAGS flags7; EnumClassFlagGroup ability_flags; EnumClassFlagGroup aura_flags; EnumClassFlagGroup behavior_flags; diff --git a/src/lore/magic-types-setter.cpp b/src/lore/magic-types-setter.cpp index e453c5e44..90ee776c6 100644 --- a/src/lore/magic-types-setter.cpp +++ b/src/lore/magic-types-setter.cpp @@ -2,8 +2,6 @@ #include "lore/lore-calculator.h" #include "lore/lore-util.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "player-base/player-class.h" #include "system/monster-race-info.h" #include "system/player-type-definition.h" diff --git a/src/lore/monster-lore.cpp b/src/lore/monster-lore.cpp index 78309f666..13e2bace7 100644 --- a/src/lore/monster-lore.cpp +++ b/src/lore/monster-lore.cpp @@ -10,9 +10,6 @@ #include "lore/lore-util.h" #include "lore/magic-types-setter.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster-race/race-indice-types.h" #include "monster-race/race-misc-flags.h" #include "monster-race/race-sex-const.h" diff --git a/src/main/angband-initializer.cpp b/src/main/angband-initializer.cpp index f86af5460..cbbb916bc 100644 --- a/src/main/angband-initializer.cpp +++ b/src/main/angband-initializer.cpp @@ -23,7 +23,6 @@ #include "main/info-initializer.h" #include "market/building-initializer.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags7.h" #include "system/angband-version.h" #include "system/dungeon-info.h" #include "system/monster-race-info.h" diff --git a/src/main/scene-table-monster.cpp b/src/main/scene-table-monster.cpp index da9b70fae..46db83b62 100644 --- a/src/main/scene-table-monster.cpp +++ b/src/main/scene-table-monster.cpp @@ -7,7 +7,6 @@ #include "dungeon/quest.h" #include "main/music-definitions-table.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "system/floor-type-definition.h" #include "system/monster-entity.h" #include "system/monster-race-info.h" diff --git a/src/market/arena.cpp b/src/market/arena.cpp index c1b3d6ab7..b72958ca0 100644 --- a/src/market/arena.cpp +++ b/src/market/arena.cpp @@ -14,8 +14,6 @@ #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "monster/monster-list.h" #include "monster/monster-util.h" #include "player-base/player-class.h" diff --git a/src/market/bounty.cpp b/src/market/bounty.cpp index 58d3bb03d..426d7f766 100644 --- a/src/market/bounty.cpp +++ b/src/market/bounty.cpp @@ -14,9 +14,6 @@ #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-list.h" #include "monster/monster-util.h" diff --git a/src/market/building-monster.cpp b/src/market/building-monster.cpp index af7c84eb0..dfed3e8cf 100644 --- a/src/market/building-monster.cpp +++ b/src/market/building-monster.cpp @@ -6,7 +6,6 @@ #include "lore/lore-store.h" #include "lore/lore-util.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "system/monster-race-info.h" #include "term/gameterm.h" #include "term/screen-processor.h" diff --git a/src/market/building-quest.cpp b/src/market/building-quest.cpp index 6f02fb2cd..65ae7288e 100644 --- a/src/market/building-quest.cpp +++ b/src/market/building-quest.cpp @@ -5,7 +5,6 @@ #include "info-reader/fixed-map-parser.h" #include "market/building-util.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-list.h" #include "system/floor-type-definition.h" #include "system/grid-type-definition.h" diff --git a/src/melee/melee-postprocess.cpp b/src/melee/melee-postprocess.cpp index 10e79c93e..d28e2b811 100644 --- a/src/melee/melee-postprocess.cpp +++ b/src/melee/melee-postprocess.cpp @@ -25,9 +25,6 @@ #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" @@ -50,27 +47,27 @@ // Melee-post-process-type struct mam_pp_type { - mam_pp_type(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX who); + mam_pp_type(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX src_idx); MONSTER_IDX m_idx; MonsterEntity *m_ptr; int dam; bool *dead; bool *fear; std::string note; - MONSTER_IDX who; + MONSTER_IDX src_idx; bool seen; bool known; /* Can the player be aware of this attack? */ std::string m_name; }; -mam_pp_type::mam_pp_type(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX who) +mam_pp_type::mam_pp_type(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX src_idx) : m_idx(m_idx) , m_ptr(&player_ptr->current_floor_ptr->m_list[m_idx]) , dam(dam) , dead(dead) , fear(fear) , note(note) - , who(who) + , src_idx(src_idx) { this->seen = is_seen(player_ptr, this->m_ptr); this->known = this->m_ptr->cdis <= MAX_PLAYER_SIGHT; @@ -201,7 +198,7 @@ static bool check_monster_hp(PlayerType *player_ptr, mam_pp_type *mam_pp_ptr) *(mam_pp_ptr->dead) = true; print_monster_dead_by_monster(player_ptr, mam_pp_ptr); - monster_gain_exp(player_ptr, mam_pp_ptr->who, mam_pp_ptr->m_ptr->r_idx); + monster_gain_exp(player_ptr, mam_pp_ptr->src_idx, mam_pp_ptr->m_ptr->r_idx); monster_death(player_ptr, mam_pp_ptr->m_idx, false, AttributeType::NONE); delete_monster_idx(player_ptr, mam_pp_ptr->m_idx); *(mam_pp_ptr->fear) = false; @@ -276,14 +273,14 @@ static void fall_off_horse_by_melee(PlayerType *player_ptr, mam_pp_type *mam_pp_ * @param dead 目標となったモンスターの死亡状態を返す参照ポインタ * @param fear 目標となったモンスターの恐慌状態を返す参照ポインタ * @param note 目標モンスターが死亡した場合の特別メッセージ(nullptrならば標準表示を行う) - * @param who 打撃を行ったモンスターの参照ID + * @param src_idx 打撃を行ったモンスターの参照ID * @todo 打撃が当たった時の後処理 (爆発持ちのモンスターを爆発させる等)なので、関数名を変更する必要あり */ -void mon_take_hit_mon(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX who) +void mon_take_hit_mon(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX src_idx) { auto *floor_ptr = player_ptr->current_floor_ptr; auto *m_ptr = &floor_ptr->m_list[m_idx]; - mam_pp_type tmp_mam_pp(player_ptr, m_idx, dam, dead, fear, note, who); + mam_pp_type tmp_mam_pp(player_ptr, m_idx, dam, dead, fear, note, src_idx); mam_pp_type *mam_pp_ptr = &tmp_mam_pp; prepare_redraw(player_ptr, mam_pp_ptr); (void)set_monster_csleep(player_ptr, m_idx, 0); @@ -304,8 +301,8 @@ void mon_take_hit_mon(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool * *dead = false; cancel_fear_by_pain(player_ptr, mam_pp_ptr); make_monster_fear(player_ptr, mam_pp_ptr); - if ((dam > 0) && !m_ptr->is_pet() && !m_ptr->is_friendly() && (mam_pp_ptr->who != m_idx)) { - const auto &m_ref = floor_ptr->m_list[who]; + if ((dam > 0) && !m_ptr->is_pet() && !m_ptr->is_friendly() && (mam_pp_ptr->src_idx != m_idx)) { + const auto &m_ref = floor_ptr->m_list[src_idx]; if (m_ref.is_pet() && !player_ptr->is_located_at({ m_ptr->target_y, m_ptr->target_x })) { set_target(m_ptr, m_ref.fy, m_ref.fx); } diff --git a/src/melee/melee-postprocess.h b/src/melee/melee-postprocess.h index b033b43a8..4f25bf274 100644 --- a/src/melee/melee-postprocess.h +++ b/src/melee/melee-postprocess.h @@ -5,4 +5,4 @@ #include class PlayerType; -void mon_take_hit_mon(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX who); +void mon_take_hit_mon(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX src_idx); diff --git a/src/melee/melee-spell-flags-checker.cpp b/src/melee/melee-spell-flags-checker.cpp index 52ad75e1d..aa399ab8f 100644 --- a/src/melee/melee-spell-flags-checker.cpp +++ b/src/melee/melee-spell-flags-checker.cpp @@ -8,9 +8,6 @@ #include "monster-race/monster-race.h" #include "monster-race/race-ability-mask.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-status.h" #include "mspell/mspell-checker.h" diff --git a/src/melee/monster-attack-monster.cpp b/src/melee/monster-attack-monster.cpp index e63835057..7b6a55b15 100644 --- a/src/melee/monster-attack-monster.cpp +++ b/src/melee/monster-attack-monster.cpp @@ -21,9 +21,6 @@ #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" #include "monster/monster-status-setter.h" diff --git a/src/mind/mind-berserker.cpp b/src/mind/mind-berserker.cpp index 3a783900f..a44eedd6d 100644 --- a/src/mind/mind-berserker.cpp +++ b/src/mind/mind-berserker.cpp @@ -42,7 +42,7 @@ bool cast_berserk_spell(PlayerType *player_ptr, MindBerserkerType spell) y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (!player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (!player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); return false; } @@ -54,7 +54,7 @@ bool cast_berserk_spell(PlayerType *player_ptr, MindBerserkerType spell) y += ddy[dir]; x += ddx[dir]; - if (player_can_enter(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat) && !player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_can_enter(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat) && !player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { msg_print(nullptr); (void)move_player_effect(player_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); } diff --git a/src/mind/mind-cavalry.cpp b/src/mind/mind-cavalry.cpp index 99a87ce3b..dd999be43 100644 --- a/src/mind/mind-cavalry.cpp +++ b/src/mind/mind-cavalry.cpp @@ -7,8 +7,6 @@ #include "mind/mind-cavalry.h" #include "cmd-action/cmd-pet.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" #include "monster/monster-status-setter.h" diff --git a/src/mind/mind-elementalist.cpp b/src/mind/mind-elementalist.cpp index e8388dd1d..88f5be01d 100644 --- a/src/mind/mind-elementalist.cpp +++ b/src/mind/mind-elementalist.cpp @@ -34,9 +34,8 @@ #include "monster-race/monster-race.h" #include "monster-race/race-brightness-flags.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster/monster-describer.h" +#include "monster/monster-util.h" #include "player-base/player-class.h" #include "player-info/equipment-info.h" #include "player-status/player-energy.h" @@ -1065,7 +1064,7 @@ ProcessResult effect_monster_elemental_genocide(PlayerType *player_ptr, EffectMo return ProcessResult::PROCESS_TRUE; } - if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, !em_ptr->who, (em_ptr->r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One"))) { + if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, is_player(em_ptr->src_idx), (em_ptr->r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One"))) { if (em_ptr->seen_msg) { msg_format(_("%sは消滅した!", "%s^ disappeared!"), em_ptr->m_name); } diff --git a/src/mind/mind-force-trainer.cpp b/src/mind/mind-force-trainer.cpp index 97488308f..85ccbf4ec 100644 --- a/src/mind/mind-force-trainer.cpp +++ b/src/mind/mind-force-trainer.cpp @@ -14,7 +14,6 @@ #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags7.h" #include "monster/monster-describer.h" #include "monster/monster-status.h" #include "monster/monster-update.h" @@ -212,7 +211,7 @@ bool shock_power(PlayerType *player_ptr) PLAYER_LEVEL plev = player_ptr->lev; int dam = damroll(8 + ((plev - 5) / 4) + boost / 12, 8); fire_beam(player_ptr, AttributeType::MISSILE, dir, dam); - if (!player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (!player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { return true; } diff --git a/src/mind/mind-ninja.cpp b/src/mind/mind-ninja.cpp index 8a8944bda..3ef33ecf5 100644 --- a/src/mind/mind-ninja.cpp +++ b/src/mind/mind-ninja.cpp @@ -179,7 +179,7 @@ bool rush_attack(PlayerType *player_ptr, bool *mdeath) continue; } - if (!grid_new.m_idx) { + if (!grid_new.has_monster()) { if (tm_idx) { msg_print(_("失敗!", "Failed!")); } else { diff --git a/src/mind/mind-samurai.cpp b/src/mind/mind-samurai.cpp index 4ecc04ca7..0a8964983 100644 --- a/src/mind/mind-samurai.cpp +++ b/src/mind/mind-samurai.cpp @@ -15,7 +15,6 @@ #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags3.h" #include "monster-race/race-resistance-mask.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" diff --git a/src/mind/mind-sniper.cpp b/src/mind/mind-sniper.cpp index d95627247..3f247ab83 100644 --- a/src/mind/mind-sniper.cpp +++ b/src/mind/mind-sniper.cpp @@ -22,7 +22,6 @@ #include "mind/snipe-types.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags3.h" #include "object/tval-types.h" #include "player-base/player-class.h" #include "player-info/sniper-data-type.h" diff --git a/src/mind/mind-warrior.cpp b/src/mind/mind-warrior.cpp index a8ef612f5..a7e54ac14 100644 --- a/src/mind/mind-warrior.cpp +++ b/src/mind/mind-warrior.cpp @@ -21,7 +21,7 @@ bool hit_and_away(PlayerType *player_ptr) } POSITION y = player_ptr->y + ddy[dir]; POSITION x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_NONE); if (randint0(player_ptr->skill_dis) < 7) { msg_print(_("うまく逃げられなかった。", "You failed to run away.")); @@ -53,7 +53,7 @@ bool sword_dancing(PlayerType *player_ptr) g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x]; /* Hack -- attack monsters */ - if (g_ptr->m_idx) { + if (g_ptr->has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_NONE); } else { msg_print(_("攻撃が空をきった。", "You attack the empty air.")); diff --git a/src/mind/monk-attack.cpp b/src/mind/monk-attack.cpp index 264f9b50e..def04ea6f 100644 --- a/src/mind/monk-attack.cpp +++ b/src/mind/monk-attack.cpp @@ -16,8 +16,6 @@ #include "main/sound-of-music.h" #include "mind/mind-force-trainer.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" #include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "player-attack/player-attack.h" @@ -274,7 +272,7 @@ bool double_attack(PlayerType *player_ptr) } POSITION y = player_ptr->y + ddy[dir]; POSITION x = player_ptr->x + ddx[dir]; - if (!player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (!player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction")); msg_print(nullptr); return true; @@ -289,7 +287,7 @@ bool double_attack(PlayerType *player_ptr) } do_cmd_attack(player_ptr, y, x, HISSATSU_NONE); - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { handle_stuff(player_ptr); do_cmd_attack(player_ptr, y, x, HISSATSU_NONE); } diff --git a/src/monster-attack/monster-attack-player.cpp b/src/monster-attack/monster-attack-player.cpp index c72ec67ef..38b8a4aa6 100644 --- a/src/monster-attack/monster-attack-player.cpp +++ b/src/monster-attack/monster-attack-player.cpp @@ -25,8 +25,6 @@ #include "monster-attack/monster-attack-switcher.h" #include "monster-attack/monster-attack-table.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" #include "monster/monster-damage.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" diff --git a/src/monster-attack/monster-attack-processor.cpp b/src/monster-attack/monster-attack-processor.cpp index d5ddf1be0..8a3ee1470 100644 --- a/src/monster-attack/monster-attack-processor.cpp +++ b/src/monster-attack/monster-attack-processor.cpp @@ -10,8 +10,6 @@ #include "melee/monster-attack-monster.h" #include "monster-attack/monster-attack-player.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" #include "monster/monster-info.h" #include "monster/monster-processor-util.h" #include "monster/monster-status-setter.h" @@ -124,7 +122,7 @@ static bool exe_monster_attack_to_monster(PlayerType *player_ptr, MONSTER_IDX m_ */ bool process_monster_attack_to_monster(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx, Grid *g_ptr, bool can_cross) { - if (!turn_flags_ptr->do_move || (g_ptr->m_idx == 0)) { + if (!turn_flags_ptr->do_move || !g_ptr->has_monster()) { return false; } diff --git a/src/monster-floor/monster-death-util.cpp b/src/monster-floor/monster-death-util.cpp index cd13cd13b..ae754cc51 100644 --- a/src/monster-floor/monster-death-util.cpp +++ b/src/monster-floor/monster-death-util.cpp @@ -1,6 +1,5 @@ #include "monster-floor/monster-death-util.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster-race/race-indice-types.h" #include "monster/monster-info.h" #include "monster/smart-learn-types.h" diff --git a/src/monster-floor/monster-death.cpp b/src/monster-floor/monster-death.cpp index f8291a01a..326a7e990 100644 --- a/src/monster-floor/monster-death.cpp +++ b/src/monster-floor/monster-death.cpp @@ -19,9 +19,6 @@ #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" diff --git a/src/monster-floor/monster-direction.cpp b/src/monster-floor/monster-direction.cpp index 3d3b01cef..e64628bb4 100644 --- a/src/monster-floor/monster-direction.cpp +++ b/src/monster-floor/monster-direction.cpp @@ -8,8 +8,6 @@ #include "floor/cave.h" #include "monster-floor/monster-sweep-grid.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" #include "monster/monster-info.h" #include "monster/monster-processor-util.h" #include "monster/monster-status.h" diff --git a/src/monster-floor/monster-generator.cpp b/src/monster-floor/monster-generator.cpp index be99b53de..428056294 100644 --- a/src/monster-floor/monster-generator.cpp +++ b/src/monster-floor/monster-generator.cpp @@ -16,9 +16,6 @@ #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" -#include "monster-race/race-flags8.h" #include "monster-race/race-indice-types.h" #include "monster/monster-flag-types.h" #include "monster/monster-info.h" @@ -168,14 +165,14 @@ bool multiply_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, bool clone, BIT /*! * @brief モンスターを目標地点に集団生成する / Attempt to place a "group" of monsters around the given location - * @param who 召喚主のモンスター情報ID + * @param src_idx 召喚主のモンスター情報ID * @param y 中心生成位置y座標 * @param x 中心生成位置x座標 * @param r_idx 生成モンスター種族 * @param mode 生成オプション * @return 成功したらtrue */ -static bool place_monster_group(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode) +static bool place_monster_group(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode) { auto *r_ptr = &monraces_info[r_idx]; auto total = randint1(10); @@ -221,7 +218,7 @@ static bool place_monster_group(PlayerType *player_ptr, MONSTER_IDX who, POSITIO continue; } - if (place_monster_one(player_ptr, who, my, mx, r_idx, mode)) { + if (place_monster_one(player_ptr, src_idx, my, mx, r_idx, mode)) { hack_y[hack_n] = my; hack_x[hack_n] = mx; hack_n++; @@ -283,7 +280,7 @@ static bool place_monster_can_escort(PlayerType *player_ptr, MonsterRaceId r_idx /*! * @brief 特定モンスターを生成する * @param player_ptr プレイヤーへの参照ポインタ - * @param who 召喚主のモンスター情報ID + * @param src_idx 召喚主のモンスター情報ID * @param y 生成地点y座標 * @param x 生成地点x座標 * @param r_idx 生成するモンスターの種族ID @@ -291,7 +288,7 @@ static bool place_monster_can_escort(PlayerType *player_ptr, MonsterRaceId r_idx * @return 生成に成功したらtrue * @details 護衛も一緒に生成する */ -bool place_specific_monster(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode) +bool place_specific_monster(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode) { auto *r_ptr = &monraces_info[r_idx]; @@ -299,7 +296,7 @@ bool place_specific_monster(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, mode |= PM_KAGE; } - if (!place_monster_one(player_ptr, who, y, x, r_idx, mode)) { + if (!place_monster_one(player_ptr, src_idx, y, x, r_idx, mode)) { return false; } if (!(mode & PM_ALLOW_GROUP)) { @@ -331,7 +328,7 @@ bool place_specific_monster(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, } if (r_ptr->misc_flags.has(MonsterMiscType::HAS_FRIENDS)) { - (void)place_monster_group(player_ptr, who, y, x, r_idx, mode); + (void)place_monster_group(player_ptr, src_idx, y, x, r_idx, mode); } if (r_ptr->misc_flags.has_not(MonsterMiscType::ESCORT)) { diff --git a/src/monster-floor/monster-generator.h b/src/monster-floor/monster-generator.h index ed06debe0..240adce3e 100644 --- a/src/monster-floor/monster-generator.h +++ b/src/monster-floor/monster-generator.h @@ -9,7 +9,7 @@ typedef bool (*summon_specific_pf)(PlayerType *, MONSTER_IDX, POSITION, POSITION bool mon_scatter(PlayerType *player_ptr, MonsterRaceId r_idx, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION max_dist); bool multiply_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode); -bool place_specific_monster(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode); +bool place_specific_monster(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode); bool place_random_monster(PlayerType *player_ptr, POSITION y, POSITION x, BIT_FLAGS mode); bool alloc_horde(PlayerType *player_ptr, POSITION y, POSITION x, summon_specific_pf summon_specific); bool alloc_guardian(PlayerType *player_ptr, bool def_val); diff --git a/src/monster-floor/monster-lite.cpp b/src/monster-floor/monster-lite.cpp index e5b40c741..61f991a3c 100644 --- a/src/monster-floor/monster-lite.cpp +++ b/src/monster-floor/monster-lite.cpp @@ -6,7 +6,6 @@ #include "monster-floor/monster-lite-util.h" #include "monster-race/monster-race.h" #include "monster-race/race-brightness-flags.h" -#include "monster-race/race-flags7.h" #include "monster/monster-status.h" #include "player-base/player-class.h" #include "player-info/ninja-data-type.h" diff --git a/src/monster-floor/monster-move.cpp b/src/monster-floor/monster-move.cpp index 3260a11c5..c486fedcb 100644 --- a/src/monster-floor/monster-move.cpp +++ b/src/monster-floor/monster-move.cpp @@ -20,10 +20,6 @@ #include "monster-attack/monster-attack-processor.h" #include "monster-floor/monster-object.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" -#include "monster-race/race-flags8.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-flag-types.h" @@ -70,7 +66,7 @@ static bool process_wall(PlayerType *player_ptr, turn_flags *turn_flags_ptr, con return true; } - if (grid.m_idx > 0) { + if (grid.has_monster()) { turn_flags_ptr->do_move = true; return true; } diff --git a/src/monster-floor/monster-object.cpp b/src/monster-floor/monster-object.cpp index c3f5d7ee5..43f736211 100644 --- a/src/monster-floor/monster-object.cpp +++ b/src/monster-floor/monster-object.cpp @@ -11,8 +11,6 @@ #include "floor/geometry.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster-race/race-resistance-mask.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" diff --git a/src/monster-floor/monster-remover.cpp b/src/monster-floor/monster-remover.cpp index c311853af..33e29f472 100644 --- a/src/monster-floor/monster-remover.cpp +++ b/src/monster-floor/monster-remover.cpp @@ -5,8 +5,6 @@ #include "grid/grid.h" #include "monster-race/monster-race.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-info.h" #include "monster/monster-status-setter.h" @@ -160,7 +158,7 @@ void delete_monster(PlayerType *player_ptr, POSITION y, POSITION x) } g_ptr = &floor_ptr->grid_array[y][x]; - if (g_ptr->m_idx) { + if (g_ptr->has_monster()) { delete_monster_idx(player_ptr, g_ptr->m_idx); } } diff --git a/src/monster-floor/monster-runaway.cpp b/src/monster-floor/monster-runaway.cpp index 35332cd68..a7dd3d4cb 100644 --- a/src/monster-floor/monster-runaway.cpp +++ b/src/monster-floor/monster-runaway.cpp @@ -10,9 +10,6 @@ #include "grid/grid.h" #include "monster-floor/monster-remover.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" diff --git a/src/monster-floor/monster-summon.cpp b/src/monster-floor/monster-summon.cpp index ec17bf22c..c33bd1c95 100644 --- a/src/monster-floor/monster-summon.cpp +++ b/src/monster-floor/monster-summon.cpp @@ -8,8 +8,6 @@ #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-info.h" #include "monster/monster-list.h" @@ -119,7 +117,7 @@ DEPTH get_dungeon_or_wilderness_level(PlayerType *player_ptr) /*! * @brief モンスターを召喚により配置する / Place a monster (of the specified "type") near the given location. Return TRUE if a monster was actually summoned. * @param player_ptr プレイヤーへの参照ポインタ - * @param who 召喚主のモンスター情報ID + * @param src_idx 召喚主のモンスター情報ID * @param y1 目標地点y座標 * @param x1 目標地点x座標 * @param lev 相当生成階 @@ -127,7 +125,7 @@ DEPTH get_dungeon_or_wilderness_level(PlayerType *player_ptr) * @param mode 生成オプション * @return 召喚できたらtrueを返す */ -bool summon_specific(PlayerType *player_ptr, MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, summon_type type, BIT_FLAGS mode) +bool summon_specific(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y1, POSITION x1, DEPTH lev, summon_type type, BIT_FLAGS mode) { auto *floor_ptr = player_ptr->current_floor_ptr; if (floor_ptr->inside_arena) { @@ -139,7 +137,7 @@ bool summon_specific(PlayerType *player_ptr, MONSTER_IDX who, POSITION y1, POSIT return false; } - summon_specific_who = who; + summon_specific_who = src_idx; summon_specific_type = type; summon_unique_okay = (mode & PM_ALLOW_UNIQUE) != 0; get_mon_num_prep(player_ptr, summon_specific_okay, get_monster_hook2(player_ptr, y, x)); @@ -155,7 +153,7 @@ bool summon_specific(PlayerType *player_ptr, MONSTER_IDX who, POSITION y1, POSIT mode |= PM_NO_KAGE; } - if (!place_specific_monster(player_ptr, who, y, x, r_idx, mode)) { + if (!place_specific_monster(player_ptr, src_idx, y, x, r_idx, mode)) { summon_specific_type = SUMMON_NONE; return false; } @@ -163,10 +161,10 @@ bool summon_specific(PlayerType *player_ptr, MONSTER_IDX who, POSITION y1, POSIT summon_specific_type = SUMMON_NONE; bool notice = false; - if (who <= 0) { + if (!is_monster(src_idx)) { notice = true; } else { - auto *m_ptr = &player_ptr->current_floor_ptr->m_list[who]; + auto *m_ptr = &player_ptr->current_floor_ptr->m_list[src_idx]; if (m_ptr->is_pet()) { notice = true; } else if (is_seen(player_ptr, m_ptr)) { @@ -186,14 +184,14 @@ bool summon_specific(PlayerType *player_ptr, MONSTER_IDX who, POSITION y1, POSIT /*! * @brief 特定モンスター種族を召喚により生成する / A "dangerous" function, creates a pet of the specified type * @param player_ptr プレイヤーへの参照ポインタ - * @param who 召喚主のモンスター情報ID + * @param src_idx 召喚主のモンスター情報ID * @param oy 目標地点y座標 * @param ox 目標地点x座標 * @param r_idx 生成するモンスター種族ID * @param mode 生成オプション * @return 召喚できたらtrueを返す */ -bool summon_named_creature(PlayerType *player_ptr, MONSTER_IDX who, POSITION oy, POSITION ox, MonsterRaceId r_idx, BIT_FLAGS mode) +bool summon_named_creature(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION oy, POSITION ox, MonsterRaceId r_idx, BIT_FLAGS mode) { if (!MonsterRace(r_idx).is_valid() || (r_idx >= static_cast(monraces_info.size()))) { return false; @@ -204,5 +202,5 @@ bool summon_named_creature(PlayerType *player_ptr, MONSTER_IDX who, POSITION oy, return false; } - return place_specific_monster(player_ptr, who, y, x, r_idx, (mode | PM_NO_KAGE)); + return place_specific_monster(player_ptr, src_idx, y, x, r_idx, (mode | PM_NO_KAGE)); } diff --git a/src/monster-floor/monster-summon.h b/src/monster-floor/monster-summon.h index 8577ef9c0..9039dcb0f 100644 --- a/src/monster-floor/monster-summon.h +++ b/src/monster-floor/monster-summon.h @@ -8,5 +8,5 @@ extern bool summon_unique_okay; enum summon_type : int; enum class MonsterRaceId : int16_t; class PlayerType; -bool summon_specific(PlayerType *player_ptr, MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, summon_type type, BIT_FLAGS mode); -bool summon_named_creature(PlayerType *player_ptr, MONSTER_IDX who, POSITION oy, POSITION ox, MonsterRaceId r_idx, BIT_FLAGS mode); +bool summon_specific(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y1, POSITION x1, DEPTH lev, summon_type type, BIT_FLAGS mode); +bool summon_named_creature(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION oy, POSITION ox, MonsterRaceId r_idx, BIT_FLAGS mode); diff --git a/src/monster-floor/monster-sweep-grid.cpp b/src/monster-floor/monster-sweep-grid.cpp index 5d136e38f..12665ebfb 100644 --- a/src/monster-floor/monster-sweep-grid.cpp +++ b/src/monster-floor/monster-sweep-grid.cpp @@ -13,9 +13,6 @@ #include "monster-floor/monster-safety-hiding.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-mask.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster/monster-flag-types.h" #include "monster/monster-info.h" #include "monster/monster-processor-util.h" diff --git a/src/monster-floor/one-monster-placer.cpp b/src/monster-floor/one-monster-placer.cpp index 7696fb935..dffaffacf 100644 --- a/src/monster-floor/one-monster-placer.cpp +++ b/src/monster-floor/one-monster-placer.cpp @@ -24,10 +24,6 @@ #include "monster-race/monster-kind-mask.h" #include "monster-race/monster-race.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster-race/race-misc-flags.h" #include "monster/monster-flag-types.h" @@ -173,7 +169,7 @@ static bool check_quest_placeable(const FloorType &floor, MonsterRaceId r_idx) int number_mon = 0; for (int i2 = 0; i2 < floor.width; ++i2) { for (int j2 = 0; j2 < floor.height; j2++) { - auto quest_monster = (floor.grid_array[j2][i2].m_idx > 0); + auto quest_monster = floor.grid_array[j2][i2].has_monster(); quest_monster &= (floor.m_list[floor.grid_array[j2][i2].m_idx].r_idx == q_ptr->r_idx); if (quest_monster) { number_mon++; @@ -256,14 +252,14 @@ static void warn_unique_generation(PlayerType *player_ptr, MonsterRaceId r_idx) /*! * @brief モンスターを一体生成する / Attempt to place a monster of the given race at the given location. * @param player_ptr プレイヤーへの参照ポインタ - * @param who 召喚を行ったモンスターID + * @param src_idx 召喚を行ったモンスターID * @param y 生成位置y座標 * @param x 生成位置x座標 * @param r_idx 生成モンスター種族 * @param mode 生成オプション * @return 成功したらtrue */ -bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode) +bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode) { auto &floor = *player_ptr->current_floor_ptr; auto *g_ptr = &floor.grid_array[y][x]; @@ -289,7 +285,7 @@ bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSI g_ptr->m_idx = m_pop(&floor); hack_m_idx_ii = g_ptr->m_idx; - if (!g_ptr->m_idx) { + if (!g_ptr->has_monster()) { return false; } @@ -300,15 +296,15 @@ bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSI m_ptr->mflag.clear(); m_ptr->mflag2.clear(); - if (any_bits(mode, PM_MULTIPLY) && (who > 0) && !floor.m_list[who].is_original_ap()) { - m_ptr->ap_r_idx = floor.m_list[who].ap_r_idx; - if (floor.m_list[who].mflag2.has(MonsterConstantFlagType::KAGE)) { + if (any_bits(mode, PM_MULTIPLY) && is_monster(src_idx) && !floor.m_list[src_idx].is_original_ap()) { + m_ptr->ap_r_idx = floor.m_list[src_idx].ap_r_idx; + if (floor.m_list[src_idx].mflag2.has(MonsterConstantFlagType::KAGE)) { m_ptr->mflag2.set(MonsterConstantFlagType::KAGE); } } - if ((who > 0) && r_ptr->kind_flags.has_none_of(alignment_mask)) { - m_ptr->sub_align = floor.m_list[who].sub_align; + if (is_monster(src_idx) && r_ptr->kind_flags.has_none_of(alignment_mask)) { + m_ptr->sub_align = floor.m_list[src_idx].sub_align; } else { m_ptr->sub_align = SUB_ALIGN_NEUTRAL; if (r_ptr->kind_flags.has(MonsterKindType::EVIL)) { @@ -332,9 +328,9 @@ bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSI m_ptr->nickname.clear(); m_ptr->exp = 0; - if (who > 0 && floor.m_list[who].is_pet()) { + if (is_monster(src_idx) && floor.m_list[src_idx].is_pet()) { set_bits(mode, PM_FORCE_PET); - m_ptr->parent_m_idx = who; + m_ptr->parent_m_idx = src_idx; } else { m_ptr->parent_m_idx = 0; } @@ -343,7 +339,7 @@ bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSI choose_new_monster(player_ptr, g_ptr->m_idx, true, MonsterRace::empty_id()); r_ptr = &m_ptr->get_monrace(); m_ptr->mflag2.set(MonsterConstantFlagType::CHAMELEON); - if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (who <= 0)) { + if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (!is_monster(src_idx))) { m_ptr->sub_align = SUB_ALIGN_NEUTRAL; } } else if (any_bits(mode, PM_KAGE) && none_bits(mode, PM_FORCE_PET)) { @@ -362,7 +358,7 @@ bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSI m_ptr->ml = false; if (any_bits(mode, PM_FORCE_PET)) { set_pet(player_ptr, m_ptr); - } else if (((who == 0) && r_ptr->behavior_flags.has(MonsterBehaviorType::FRIENDLY)) || is_friendly_idx(player_ptr, who) || any_bits(mode, PM_FORCE_FRIENDLY)) { + } else if ((is_player(src_idx) && r_ptr->behavior_flags.has(MonsterBehaviorType::FRIENDLY)) || is_friendly_idx(player_ptr, src_idx) || any_bits(mode, PM_FORCE_FRIENDLY)) { if (!monster_has_hostile_align(player_ptr, nullptr, 0, -1, r_ptr) && !player_ptr->current_floor_ptr->inside_arena) { set_friendly(m_ptr); } diff --git a/src/monster-floor/one-monster-placer.h b/src/monster-floor/one-monster-placer.h index 2293dcc0e..b7f68d79d 100644 --- a/src/monster-floor/one-monster-placer.h +++ b/src/monster-floor/one-monster-placer.h @@ -4,4 +4,4 @@ enum class MonsterRaceId : int16_t; class PlayerType; -bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode); +bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode); diff --git a/src/monster-floor/quantum-effect.cpp b/src/monster-floor/quantum-effect.cpp index 2894eeff0..394f647f0 100644 --- a/src/monster-floor/quantum-effect.cpp +++ b/src/monster-floor/quantum-effect.cpp @@ -4,8 +4,6 @@ #include "monster-floor/monster-death.h" #include "monster-floor/monster-remover.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" diff --git a/src/monster-race/monster-race-hook.cpp b/src/monster-race/monster-race-hook.cpp index d904bd4b1..6c90f9d0a 100644 --- a/src/monster-race/monster-race-hook.cpp +++ b/src/monster-race/monster-race-hook.cpp @@ -6,11 +6,6 @@ #include "monster-race/monster-race.h" #include "monster-race/race-ability-mask.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" -#include "monster-race/race-flags8.h" #include "monster-race/race-indice-types.h" #include "monster-race/race-misc-flags.h" #include "monster/monster-list.h" diff --git a/src/monster-race/monster-race.cpp b/src/monster-race/monster-race.cpp index a32a1547a..fadd072b3 100644 --- a/src/monster-race/monster-race.cpp +++ b/src/monster-race/monster-race.cpp @@ -1,6 +1,5 @@ #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" #include "monster-race/race-indice-types.h" #include "monster-race/race-resistance-mask.h" #include "system/monster-race-info.h" diff --git a/src/monster-race/race-flags1.h b/src/monster-race/race-flags1.h deleted file mode 100644 index fb8ae0d18..000000000 --- a/src/monster-race/race-flags1.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -enum race_flags1 { - RF1_UNIQUE = 0x00000001, /*!< モンスター特性: ユニーク / Unique Monster */ - RF1_QUESTOR = 0x00000002, /*!< モンスター特性: クエストモンスター / Quest Monster */ - RF1_MALE = 0x00000004, /*!< モンスター特性: 男性 / Male gender */ - RF1_FEMALE = 0x00000008, /*!< モンスター特性: 女性 / Female gender */ - RF1_CHAR_CLEAR = 0x00000010, /*!< モンスター特性: シンボルが完全に透明 / Absorbs symbol */ - RF1_SHAPECHANGER = 0x00000020, /*!< モンスター特性: シンボルアルファベットがランダムになる / TY: shapechanger */ - RF1_ATTR_CLEAR = 0x00000040, /*!< モンスター特性: シンボルカラーが透明色になる(地形と同じ色になる) / Absorbs color */ - RF1_ATTR_MULTI = 0x00000080, /*!< モンスター特性: シンボルカラーがランダムに変化する(基本7色) / Changes color */ - RF1_FORCE_DEPTH = 0x00000100, /*!< モンスター特性: 指定階未満では生成されない / Start at "correct" depth */ - RF1_FORCE_MAXHP = 0x00000200, /*!< モンスター特性: 通常生成時必ずHPがダイス最大値になる / Start with max hitpoints */ - RF1_PREVENT_SUDDEN_MAGIC = 0x00000400, /*!< モンスター特性: 生成直後に魔法を使用しない / Start with no-magic */ - RF1_FORCE_EXTRA = 0x00000800, /*!< モンスター特性: (未使用) / Start out something */ - RF1_ATTR_SEMIRAND = 0x00001000, /*!< モンスター特性: シンボルカラーがランダムに変化する(15色) / Color is determined semi-randomly */ - RF1_FRIENDS = 0x00002000, /*!< モンスター特性: 同種の友軍を用意している / Arrive with some friends */ - RF1_ESCORT = 0x00004000, /*!< モンスター特性: 護衛を用意している/ Arrive with an escort */ - RF1_ESCORTS = 0x00008000, /*!< モンスター特性: さらに大量の護衛を用意している / Arrive with some escorts */ - RF1_NEVER_BLOW = 0x00010000, /*!< モンスター特性: 打撃を一切行わない / Never make physical blow */ - RF1_NEVER_MOVE = 0x00020000, /*!< モンスター特性: 移動を一切行わない / Never make physical move */ - RF1_RAND_25 = 0x00040000, /*!< モンスター特性: ランダムに移動する確率+25%/ Moves randomly (25%) */ - RF1_RAND_50 = 0x00080000, /*!< モンスター特性: ランダムに移動する確率+50%/ Moves randomly (50%) */ - RF1_ONLY_GOLD = 0x00100000, /*!< モンスター特性: 財宝しか落とさない / Drop only gold */ - RF1_ONLY_ITEM = 0x00200000, /*!< モンスター特性: アイテムしか落とさない / Drop only items */ - RF1_DROP_60 = 0x00400000, /*!< モンスター特性: 落とすアイテム数60%で+1/ Drop an item/gold (60%) */ - RF1_DROP_90 = 0x00800000, /*!< モンスター特性: 落とすアイテム数90%で+1 / Drop an item/gold (90%) */ - RF1_DROP_1D2 = 0x01000000, /*!< モンスター特性: 落とすアイテム数+1d2 / Drop 1d2 items/gold */ - RF1_DROP_2D2 = 0x02000000, /*!< モンスター特性: 落とすアイテム数+2d2 / Drop 2d2 items/gold */ - RF1_DROP_3D2 = 0x04000000, /*!< モンスター特性: 落とすアイテム数+3d2 / Drop 3d2 items/gold */ - RF1_DROP_4D2 = 0x08000000, /*!< モンスター特性: 落とすアイテム数+4d2 / Drop 4d2 items/gold */ - RF1_DROP_GOOD = 0x10000000, /*!< モンスター特性: 必ず上質品をドロップする / Drop good items */ - RF1_DROP_GREAT = 0x20000000, /*!< モンスター特性: 必ず高級品をドロップする / Drop great items */ - RF1_XXX2 = 0x40000000, /*!< モンスター特性: 未使用 / XXX */ - RF1_XXX3 = 0x80000000, /*!< モンスター特性: 未使用 / XXX */ -}; diff --git a/src/monster-race/race-flags2.h b/src/monster-race/race-flags2.h deleted file mode 100644 index 08d0ac7e3..000000000 --- a/src/monster-race/race-flags2.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -enum race_flags2 { - RF2_STUPID = 0x00000001, /*!< モンスター特性: 愚かな行動を取る / Monster is stupid */ - RF2_SMART = 0x00000002, /*!< モンスター特性: 賢い行動を取る / Monster is smart */ - RF2_CAN_SPEAK = 0x00000004, /*!< モンスター特性: 台詞をしゃべる / TY: can speak */ - RF2_REFLECTING = 0x00000008, /*!< モンスター特性: 矢やボルト魔法を反射する / Reflects bolts */ - RF2_INVISIBLE = 0x00000010, /*!< モンスター特性: 透明視力がないと見えない / Monster avoids vision */ - RF2_COLD_BLOOD = 0x00000020, /*!< モンスター特性: 冷血動物である / Monster avoids infra */ - RF2_EMPTY_MIND = 0x00000040, /*!< モンスター特性: 知性を持たない(テレパシー回避) / Monster avoids telepathy */ - RF2_WEIRD_MIND = 0x00000080, /*!< モンスター特性: 異質な知性(テレパシーで感知づらい) / Monster avoids telepathy? */ - RF2_MULTIPLY = 0x00000100, /*!< モンスター特性: 増殖する / Monster reproduces */ - RF2_REGENERATE = 0x00000200, /*!< モンスター特性: 急激に回復する / Monster regenerates */ - RF2_CHAR_MULTI = 0x00000400, /*!< モンスター特性: 未使用 / (Not implemented) */ - RF2_ATTR_ANY = 0x00000800, /*!< モンスター特性: ATTR_MULTIの色数が増える / TY: Attr_any */ - RF2_POWERFUL = 0x00001000, /*!< モンスター特性: 強力に魔法をあやつる / Monster has strong breath */ - RF2_ELDRITCH_HORROR = 0x00002000, /*!< モンスター特性: 狂気を呼び起こす / Sanity-blasting horror */ - RF2_XX14 = 0x00004000, /*!< 予約領域。元火炎オーラ */ - RF2_XX15 = 0x00008000, /*!< 予約領域。元電撃オーラ */ - RF2_OPEN_DOOR = 0x00010000, /*!< モンスター特性: ドアを開けることができる / Monster can open doors */ - RF2_BASH_DOOR = 0x00020000, /*!< モンスター特性: ドアを破壊することができる / Monster can bash doors */ - RF2_PASS_WALL = 0x00040000, /*!< モンスター特性: 壁を抜けることができる / Monster can pass walls */ - RF2_KILL_WALL = 0x00080000, /*!< モンスター特性: 壁を破壊して進む / Monster can destroy walls */ - RF2_MOVE_BODY = 0x00100000, /*!< モンスター特性: 道中の弱いモンスターを押しのけることができる / Monster can move monsters */ - RF2_KILL_BODY = 0x00200000, /*!< モンスター特性: 道中の弱いモンスターを殺して進む / Monster can kill monsters */ - RF2_TAKE_ITEM = 0x00400000, /*!< モンスター特性: 道中のアイテムを拾う / Monster can pick up items */ - RF2_KILL_ITEM = 0x00800000, /*!< モンスター特性: 道中のアイテムを破壊する / Monster can crush items */ - RF2_XXX1 = 0x01000000, /*!< モンスター特性: 未使用 / XXX */ - RF2_XXX2 = 0x02000000, /*!< モンスター特性: 未使用 / XXX */ - RF2_XXX3 = 0x04000000, /*!< モンスター特性: 未使用 / XXX */ - RF2_XXX4 = 0x08000000, /*!< モンスター特性: 未使用 / XXX */ - RF2_XXX5 = 0x10000000, /*!< モンスター特性: 未使用 / XXX */ - RF2_XXX6 = 0x20000000, /*!< モンスター特性: 未使用 / XXX */ - RF2_HUMAN = 0x40000000, /*!< モンスター特性: 人間 / Human */ - RF2_QUANTUM = 0x80000000, /*!< モンスター特性: 量子的な振る舞いをする / Monster has quantum behavior */ -}; diff --git a/src/monster-race/race-flags3.h b/src/monster-race/race-flags3.h deleted file mode 100644 index bb46891ad..000000000 --- a/src/monster-race/race-flags3.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -enum race_flags3 { - RF3_ORC = 0x00000001, /*!< モンスター特性: オーク / Orc */ - RF3_TROLL = 0x00000002, /*!< モンスター特性: トロル / Troll */ - RF3_GIANT = 0x00000004, /*!< モンスター特性: 巨人 / Giant */ - RF3_DRAGON = 0x00000008, /*!< モンスター特性: ドラゴン / Dragon */ - RF3_DEMON = 0x00000010, /*!< モンスター特性: 悪魔 / Demon */ - RF3_UNDEAD = 0x00000020, /*!< モンスター特性: アンデッド / Undead */ - RF3_EVIL = 0x00000040, /*!< モンスター特性: 邪悪 / Evil */ - RF3_ANIMAL = 0x00000080, /*!< モンスター特性: 動物 / Animal */ - RF3_AMBERITE = 0x00000100, /*!< モンスター特性: アンバーの血族 / TY: Amberite */ - RF3_GOOD = 0x00000200, /*!< モンスター特性: 善良 / Good */ - RF3_XX10 = 0x00000400, /*!< 予約領域。元冷気オーラ */ - RF3_NONLIVING = 0x00000800, /*!< モンスター特性: 無生物 / TY: Non-Living (?) */ - RF3_HURT_LITE = 0x00001000, /*!< モンスター特性: 通常の光(GF_WEAK_LITE)でダメージを受ける / Hurt by lite */ - RF3_HURT_ROCK = 0x00002000, /*!< モンスター特性: 岩石溶解(KILL_WALL)でダメージを受ける / Hurt by rock remover */ - RF3_HURT_FIRE = 0x00004000, /*!< モンスター特性: 火炎が弱点 / Hurt badly by fire */ - RF3_HURT_COLD = 0x00008000, /*!< モンスター特性: 冷気が弱点 / Hurt badly by cold */ - RF3_ANGEL = 0x00010000, /*!< モンスター特性: 天使 / ANGEL */ - RF3_XXX17 = 0x00020000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX18 = 0x00040000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX19 = 0x00080000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX20 = 0x00100000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX21 = 0x00200000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX22 = 0x00400000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX23 = 0x00800000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX24 = 0x01000000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX25 = 0x02000000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX26 = 0x04000000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX27 = 0x08000000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX28 = 0x10000000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX29 = 0x20000000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX30 = 0x40000000, /*!< モンスター特性: 未使用 / XXX */ - RF3_XXX31 = 0x80000000, /*!< モンスター特性: 未使用 / XXX */ -}; diff --git a/src/monster-race/race-flags7.h b/src/monster-race/race-flags7.h deleted file mode 100644 index 795af3b62..000000000 --- a/src/monster-race/race-flags7.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -enum race_flags7 { - RF7_AQUATIC = 0x00000001, /* Aquatic monster */ - RF7_CAN_SWIM = 0x00000002, /* Monster can swim */ - RF7_CAN_FLY = 0x00000004, /* Monster can fly */ - RF7_FRIENDLY = 0x00000008, /* Monster is friendly */ - RF7_NAZGUL = 0x00000010, /* Is a "Nazgul" unique */ - RF7_UNIQUE2 = 0x00000020, /* Fake unique */ - RF7_RIDING = 0x00000040, /* Good for riding */ - RF7_KAGE = 0x00000080, /* Is kage */ - RF7_HAS_LITE_1 = 0x00000100, /* Monster carries light */ - RF7_SELF_LITE_1 = 0x00000200, /* Monster lights itself */ - RF7_HAS_LITE_2 = 0x00000400, /* Monster carries light */ - RF7_SELF_LITE_2 = 0x00000800, /* Monster lights itself */ - RF7_GUARDIAN = 0x00001000, /* Guardian of a dungeon */ - RF7_CHAMELEON = 0x00002000, /* Chameleon can change */ - RF7_XXXX4XXX = 0x00004000, /* Now Empty */ - RF7_TANUKI = 0x00008000, /* Tanuki disguise */ - RF7_HAS_DARK_1 = 0x00010000, /* Monster carries darkness */ - RF7_SELF_DARK_1 = 0x00020000, /* Monster darkens itself */ - RF7_HAS_DARK_2 = 0x00040000, /* Monster carries darkness */ - RF7_SELF_DARK_2 = 0x00080000, /* Monster darkens itself */ -}; - -#define RF7_LITE_MASK (RF7_HAS_LITE_1 | RF7_SELF_LITE_1 | RF7_HAS_LITE_2 | RF7_SELF_LITE_2) -#define RF7_DARK_MASK (RF7_HAS_DARK_1 | RF7_SELF_DARK_1 | RF7_HAS_DARK_2 | RF7_SELF_DARK_2) -#define RF7_HAS_LD_MASK (RF7_HAS_LITE_1 | RF7_HAS_LITE_2 | RF7_HAS_DARK_1 | RF7_HAS_DARK_2) -#define RF7_SELF_LD_MASK (RF7_SELF_LITE_1 | RF7_SELF_LITE_2 | RF7_SELF_DARK_1 | RF7_SELF_DARK_2) diff --git a/src/monster-race/race-flags8.h b/src/monster-race/race-flags8.h deleted file mode 100644 index 6cf37f132..000000000 --- a/src/monster-race/race-flags8.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -enum race_flags8 : uint32_t { - RF8_WILD_ONLY = 0x00000001, - RF8_WILD_TOWN = 0x00000002, - RF8_NO_QUEST = 0x00000004, - RF8_WILD_SHORE = 0x00000008, - RF8_WILD_OCEAN = 0x00000010, - RF8_WILD_WASTE = 0x00000020, - RF8_WILD_WOOD = 0x00000040, - RF8_WILD_VOLCANO = 0x00000080, - RF8_XXX8X08 = 0x00000100, - RF8_WILD_MOUNTAIN = 0x00000200, - RF8_WILD_GRASS = 0x00000400, - RF8_WILD_SWAMP = 0x00000800, //!< 沼地に生息(未使用) - RF8_WILD_ALL = 0x80000000, -}; diff --git a/src/monster/monster-compaction.cpp b/src/monster/monster-compaction.cpp index 7a53dd2bb..9a30a9cc2 100644 --- a/src/monster/monster-compaction.cpp +++ b/src/monster/monster-compaction.cpp @@ -4,7 +4,6 @@ #include "io/write-diary.h" #include "monster-floor/monster-remover.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" diff --git a/src/monster/monster-damage.cpp b/src/monster/monster-damage.cpp index a6f4ad27c..b181a8507 100644 --- a/src/monster/monster-damage.cpp +++ b/src/monster/monster-damage.cpp @@ -22,11 +22,6 @@ #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" -#include "monster-race/race-flags8.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" diff --git a/src/monster/monster-describer.cpp b/src/monster/monster-describer.cpp index 0ecfbe01d..0c56e594f 100644 --- a/src/monster/monster-describer.cpp +++ b/src/monster/monster-describer.cpp @@ -2,7 +2,6 @@ #include "io/files-util.h" #include "locale/english.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster-race/race-sex-const.h" #include "monster/monster-description-types.h" #include "monster/monster-flag-types.h" diff --git a/src/monster/monster-info.cpp b/src/monster/monster-info.cpp index e882f7d85..17b69a292 100644 --- a/src/monster/monster-info.cpp +++ b/src/monster/monster-info.cpp @@ -14,11 +14,6 @@ #include "floor/wild.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" -#include "monster-race/race-flags8.h" #include "monster-race/race-indice-types.h" #include "monster-race/race-resistance-mask.h" #include "monster/monster-describer.h" @@ -152,7 +147,7 @@ bool monster_can_enter(PlayerType *player_ptr, POSITION y, POSITION x, MonsterRa if (player_ptr->is_located_at(pos)) { return false; } - if (grid.m_idx) { + if (grid.has_monster()) { return false; } diff --git a/src/monster/monster-list.cpp b/src/monster/monster-list.cpp index 7f1563b18..052a4da6d 100644 --- a/src/monster/monster-list.cpp +++ b/src/monster/monster-list.cpp @@ -24,10 +24,6 @@ #include "monster-race/monster-kind-mask.h" #include "monster-race/monster-race.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" @@ -453,7 +449,7 @@ int get_monster_crowd_number(FloorType *floor_ptr, MONSTER_IDX m_idx) if (!in_bounds(floor_ptr, ay, ax)) { continue; } - if (floor_ptr->grid_array[ay][ax].m_idx > 0) { + if (floor_ptr->grid_array[ay][ax].has_monster()) { count++; } } diff --git a/src/monster/monster-processor-util.cpp b/src/monster/monster-processor-util.cpp index 47cbdc5d0..3aacda9bd 100644 --- a/src/monster/monster-processor-util.cpp +++ b/src/monster/monster-processor-util.cpp @@ -266,9 +266,6 @@ old_race_flags::old_race_flags(MonsterRaceId monrace_id) const auto &monrace = monraces_info[monrace_id]; - this->old_r_flags1 = monrace.r_flags1; - this->old_r_flags2 = monrace.r_flags2; - this->old_r_flags3 = monrace.r_flags3; this->old_r_ability_flags = monrace.r_ability_flags; this->old_r_behavior_flags = monrace.r_behavior_flags; this->old_r_kind_flags = monrace.r_kind_flags; diff --git a/src/monster/monster-processor-util.h b/src/monster/monster-processor-util.h index 8ef8c0ed0..b31d41a7f 100644 --- a/src/monster/monster-processor-util.h +++ b/src/monster/monster-processor-util.h @@ -41,10 +41,6 @@ struct turn_flags { struct old_race_flags { old_race_flags(MonsterRaceId monrace_id); - BIT_FLAGS old_r_flags1 = 0; - BIT_FLAGS old_r_flags2 = 0; - BIT_FLAGS old_r_flags3 = 0; - BIT_FLAGS old_r_flagsr = 0; EnumClassFlagGroup old_r_ability_flags{}; EnumClassFlagGroup old_r_behavior_flags{}; EnumClassFlagGroup old_r_kind_flags{}; diff --git a/src/monster/monster-processor.cpp b/src/monster/monster-processor.cpp index 8da9e15c9..4af97be64 100644 --- a/src/monster/monster-processor.cpp +++ b/src/monster/monster-processor.cpp @@ -33,9 +33,6 @@ #include "monster-floor/quantum-effect.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" @@ -455,7 +452,7 @@ bool decide_monster_multiplication(PlayerType *player_ptr, MONSTER_IDX m_idx, PO continue; } - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { k++; } } diff --git a/src/monster/monster-status-setter.cpp b/src/monster/monster-status-setter.cpp index d698ac594..a39fe6421 100644 --- a/src/monster/monster-status-setter.cpp +++ b/src/monster/monster-status-setter.cpp @@ -9,8 +9,6 @@ #include "monster-race/monster-kind-mask.h" #include "monster-race/monster-race.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-processor.h" @@ -362,12 +360,12 @@ bool set_monster_invulner(PlayerType *player_ptr, MONSTER_IDX m_idx, int v, bool * @brief モンスターの時間停止処理 * @param player_ptr プレイヤーへの参照ポインタ * @param num 時間停止を行った敵が行動できる回数 - * @param who 時間停止を行う敵の種族番号 + * @param src_idx 時間停止を行う敵の種族番号 * @param vs_player TRUEならば時間停止開始処理を行う * @return 時間停止が行われている状態ならばTRUEを返す * @details monster_desc() は視認外のモンスターについて「何か」と返してくるので、この関数ではLOSや透明視等を判定する必要はない */ -bool set_monster_timewalk(PlayerType *player_ptr, int num, MonsterRaceId who, bool vs_player) +bool set_monster_timewalk(PlayerType *player_ptr, int num, MonsterRaceId src_idx, bool vs_player) { auto &floor = *player_ptr->current_floor_ptr; auto *m_ptr = &floor.m_list[hack_m_idx]; @@ -378,7 +376,7 @@ bool set_monster_timewalk(PlayerType *player_ptr, int num, MonsterRaceId who, bo if (vs_player) { const auto m_name = monster_desc(player_ptr, m_ptr, 0); std::string mes; - switch (who) { + switch (src_idx) { case MonsterRaceId::DIO: mes = _("「『ザ・ワールド』! 時は止まった!」", format("%s yells 'The World! Time has stopped!'", m_name.data())); break; @@ -428,7 +426,7 @@ bool set_monster_timewalk(PlayerType *player_ptr, int num, MonsterRaceId who, bo should_output_message &= projectable(player_ptr, player_ptr->y, player_ptr->x, m_ptr->fy, m_ptr->fx); if (vs_player || should_output_message) { std::string mes; - switch (who) { + switch (src_idx) { case MonsterRaceId::DIAVOLO: mes = _("これが我が『キング・クリムゾン』の能力! 『時間を消し去って』飛び越えさせた…!!", "This is the ability of my 'King Crimson'! 'Erase the time' and let it jump over... !!"); diff --git a/src/monster/monster-status.cpp b/src/monster/monster-status.cpp index a283621e7..d28f3530c 100644 --- a/src/monster/monster-status.cpp +++ b/src/monster/monster-status.cpp @@ -8,9 +8,6 @@ #include "monster-race/monster-kind-mask.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster-race/race-special-flags.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" diff --git a/src/monster/monster-update.cpp b/src/monster/monster-update.cpp index bea13c2bd..0831bbc1d 100644 --- a/src/monster/monster-update.cpp +++ b/src/monster/monster-update.cpp @@ -16,10 +16,6 @@ #include "monster-race/monster-race.h" #include "monster-race/race-brightness-flags.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-flag-types.h" #include "monster/monster-info.h" @@ -81,7 +77,7 @@ bool update_riding_monster(PlayerType *player_ptr, turn_flags *turn_flags_ptr, M } player_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = g_ptr->m_idx; - if (g_ptr->m_idx) { + if (g_ptr->has_monster()) { y_ptr->fy = oy; y_ptr->fx = ox; update_monster(player_ptr, g_ptr->m_idx, true); @@ -183,8 +179,7 @@ void update_player_window(PlayerType *player_ptr, old_race_flags *old_race_flags { MonsterRaceInfo *r_ptr; r_ptr = &monraces_info[player_ptr->monster_race_idx]; - if ((old_race_flags_ptr->old_r_flags1 != r_ptr->r_flags1) || (old_race_flags_ptr->old_r_flags2 != r_ptr->r_flags2) || - (old_race_flags_ptr->old_r_flags3 != r_ptr->r_flags3) || (old_race_flags_ptr->old_r_ability_flags != r_ptr->r_ability_flags) || + if ((old_race_flags_ptr->old_r_ability_flags != r_ptr->r_ability_flags) || (old_race_flags_ptr->old_r_resistance_flags != r_ptr->r_resistance_flags) || (old_race_flags_ptr->old_r_blows0 != r_ptr->r_blows[0]) || (old_race_flags_ptr->old_r_blows1 != r_ptr->r_blows[1]) || (old_race_flags_ptr->old_r_blows2 != r_ptr->r_blows[2]) || (old_race_flags_ptr->old_r_blows3 != r_ptr->r_blows[3]) || (old_race_flags_ptr->old_r_cast_spell != r_ptr->r_cast_spell) || diff --git a/src/monster/monster-util.cpp b/src/monster/monster-util.cpp index 26906c4e1..7e1bb9ff7 100644 --- a/src/monster/monster-util.cpp +++ b/src/monster/monster-util.cpp @@ -7,8 +7,6 @@ #include "monster-race/monster-race.h" #include "monster-race/race-ability-mask.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster-race/race-misc-flags.h" #include "spell/summon-types.h" @@ -124,11 +122,6 @@ static bool restrict_monster_to_dungeon(const FloorType *floor_ptr, MonsterRaceI case DUNGEON_MODE_AND: case DUNGEON_MODE_NAND: { std::vector is_possible = { - all_bits(r_ptr->flags1, d_ptr->mflags1), - all_bits(r_ptr->flags2, d_ptr->mflags2), - all_bits(r_ptr->flags3, d_ptr->mflags3), - all_bits(r_ptr->flags7, d_ptr->mflags7), - all_bits(r_ptr->flags8, d_ptr->mflags8), is_possible_monster_and(r_ptr->ability_flags, d_ptr->mon_ability_flags), is_possible_monster_and(r_ptr->behavior_flags, d_ptr->mon_behavior_flags), is_possible_monster_and(r_ptr->resistance_flags, d_ptr->mon_resistance_flags), @@ -151,11 +144,6 @@ static bool restrict_monster_to_dungeon(const FloorType *floor_ptr, MonsterRaceI case DUNGEON_MODE_OR: case DUNGEON_MODE_NOR: { std::vector is_possible = { - any_bits(r_ptr->flags1, d_ptr->mflags1), - any_bits(r_ptr->flags2, d_ptr->mflags2), - any_bits(r_ptr->flags3, d_ptr->mflags3), - any_bits(r_ptr->flags7, d_ptr->mflags7), - any_bits(r_ptr->flags8, d_ptr->mflags8), is_possible_monster_or(r_ptr->ability_flags, d_ptr->mon_ability_flags), is_possible_monster_or(r_ptr->behavior_flags, d_ptr->mon_behavior_flags), is_possible_monster_or(r_ptr->resistance_flags, d_ptr->mon_resistance_flags), @@ -373,3 +361,13 @@ errr get_mon_num_prep_bounty(PlayerType *player_ptr) { return do_get_mon_num_prep(player_ptr, nullptr, nullptr, false); } + +bool is_player(MONSTER_IDX m_idx) +{ + return m_idx == 0; +} + +bool is_monster(MONSTER_IDX m_idx) +{ + return m_idx > 0; +} diff --git a/src/monster/monster-util.h b/src/monster/monster-util.h index e2459a2dd..ccb7a2ede 100644 --- a/src/monster/monster-util.h +++ b/src/monster/monster-util.h @@ -16,3 +16,5 @@ monsterrace_hook_type get_monster_hook(PlayerType *player_ptr); monsterrace_hook_type get_monster_hook2(PlayerType *player_ptr, POSITION y, POSITION x); errr get_mon_num_prep(PlayerType *player_ptr, monsterrace_hook_type hook1, monsterrace_hook_type hook2); errr get_mon_num_prep_bounty(PlayerType *player_ptr); +bool is_player(MONSTER_IDX m_idx); +bool is_monster(MONSTER_IDX m_idx); diff --git a/src/mspell/improper-mspell-remover.cpp b/src/mspell/improper-mspell-remover.cpp index dad14dcf3..b882e2828 100644 --- a/src/mspell/improper-mspell-remover.cpp +++ b/src/mspell/improper-mspell-remover.cpp @@ -1,7 +1,6 @@ #include "mspell/improper-mspell-remover.h" #include "game-option/birth-options.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags2.h" #include "monster/smart-learn-types.h" #include "mspell/element-resistance-checker.h" #include "mspell/high-resistance-checker.h" diff --git a/src/mspell/mspell-attack.cpp b/src/mspell/mspell-attack.cpp index 489887c9b..d6157edcb 100644 --- a/src/mspell/mspell-attack.cpp +++ b/src/mspell/mspell-attack.cpp @@ -7,7 +7,6 @@ #include "monster-floor/monster-move.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-mask.h" -#include "monster-race/race-flags2.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-flag-types.h" diff --git a/src/mspell/mspell-checker.cpp b/src/mspell/mspell-checker.cpp index d79a64cd8..de3f72841 100644 --- a/src/mspell/mspell-checker.cpp +++ b/src/mspell/mspell-checker.cpp @@ -23,15 +23,13 @@ #include "monster-floor/monster-move.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-mask.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-flag-types.h" #include "monster/monster-info.h" #include "monster/monster-status.h" +#include "monster/monster-util.h" #include "mspell/assign-monster-spell.h" #include "mspell/improper-mspell-remover.h" #include "mspell/mspell-judgement.h" @@ -169,7 +167,7 @@ bool clean_shot(PlayerType *player_ptr, POSITION y1, POSITION x1, POSITION y2, P for (const auto &[y, x] : grid_g) { const Pos2D pos(y, x); const auto &grid = floor_ptr->get_grid(pos); - if ((grid.m_idx > 0) && (y != y2 || x != x2)) { + if (grid.has_monster() && (y != y2 || x != x2)) { auto *m_ptr = &floor_ptr->m_list[grid.m_idx]; if (is_friend == m_ptr->is_pet()) { return false; diff --git a/src/mspell/mspell-damage-calculator.cpp b/src/mspell/mspell-damage-calculator.cpp index 7f848e3ff..5886067ed 100644 --- a/src/mspell/mspell-damage-calculator.cpp +++ b/src/mspell/mspell-damage-calculator.cpp @@ -3,7 +3,6 @@ #include "inventory/inventory-slot-types.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-flags.h" -#include "monster-race/race-flags2.h" #include "monster/monster-status.h" #include "player-info/equipment-info.h" #include "system/floor-type-definition.h" diff --git a/src/mspell/mspell-floor.cpp b/src/mspell/mspell-floor.cpp index 2abb58f95..d18b210ed 100644 --- a/src/mspell/mspell-floor.cpp +++ b/src/mspell/mspell-floor.cpp @@ -15,9 +15,6 @@ #include "monster-race/race-ability-flags.h" #include "monster-race/race-brightness-mask.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster-race/race-resistance-mask.h" #include "monster/monster-info.h" diff --git a/src/mspell/mspell-judgement.cpp b/src/mspell/mspell-judgement.cpp index 623c91af2..71ba860aa 100644 --- a/src/mspell/mspell-judgement.cpp +++ b/src/mspell/mspell-judgement.cpp @@ -65,7 +65,7 @@ bool direct_beam(PlayerType *player_ptr, POSITION y1, POSITION x1, POSITION y2, const auto &grid = floor.get_grid(pos); if (y == y2 && x == x2) { hit2 = true; - } else if (is_friend && grid.m_idx > 0 && !m_ptr->is_hostile_to_melee(floor.m_list[grid.m_idx])) { + } else if (is_friend && grid.has_monster() && !m_ptr->is_hostile_to_melee(floor.m_list[grid.m_idx])) { return false; } diff --git a/src/mspell/mspell-lite.cpp b/src/mspell/mspell-lite.cpp index 264406c0b..d548ac0a1 100644 --- a/src/mspell/mspell-lite.cpp +++ b/src/mspell/mspell-lite.cpp @@ -12,9 +12,6 @@ #include "monster-race/monster-race.h" #include "monster-race/race-ability-mask.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "mspell/mspell-attack-util.h" #include "mspell/mspell-judgement.h" #include "player-base/player-class.h" diff --git a/src/mspell/mspell-selector.cpp b/src/mspell/mspell-selector.cpp index ffce4d2a6..ba7808a0b 100644 --- a/src/mspell/mspell-selector.cpp +++ b/src/mspell/mspell-selector.cpp @@ -9,7 +9,6 @@ #include "floor/geometry.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-mask.h" -#include "monster-race/race-flags2.h" #include "monster-race/race-indice-types.h" #include "monster/monster-status.h" #include "mspell/mspell-attack-util.h" @@ -243,7 +242,7 @@ MonsterAbilityType choose_attack_spell(PlayerType *player_ptr, msa_type *msa_ptr auto *m_ptr = &player_ptr->current_floor_ptr->m_list[msa_ptr->m_idx]; auto *r_ptr = &m_ptr->get_monrace(); - if (r_ptr->flags2 & RF2_STUPID) { + if (r_ptr->behavior_flags.has(MonsterBehaviorType::STUPID)) { return rand_choice(msa_ptr->mspells); } diff --git a/src/mspell/mspell-special.cpp b/src/mspell/mspell-special.cpp index a7c40ec1c..11b0cad01 100644 --- a/src/mspell/mspell-special.cpp +++ b/src/mspell/mspell-special.cpp @@ -17,7 +17,6 @@ #include "monster-floor/monster-remover.h" #include "monster-floor/monster-summon.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" diff --git a/src/mspell/mspell-status.cpp b/src/mspell/mspell-status.cpp index 51da8c777..b9ebd195e 100644 --- a/src/mspell/mspell-status.cpp +++ b/src/mspell/mspell-status.cpp @@ -13,8 +13,6 @@ #include "mind/drs-types.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-flags.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" diff --git a/src/mspell/mspell-summon.cpp b/src/mspell/mspell-summon.cpp index 0ec5aa4c2..1f40dc362 100644 --- a/src/mspell/mspell-summon.cpp +++ b/src/mspell/mspell-summon.cpp @@ -8,7 +8,6 @@ #include "monster-floor/monster-summon.h" #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster-race/race-indice-types.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" diff --git a/src/mspell/smart-mspell-util.cpp b/src/mspell/smart-mspell-util.cpp index 7d7f46c76..e5fa509cf 100644 --- a/src/mspell/smart-mspell-util.cpp +++ b/src/mspell/smart-mspell-util.cpp @@ -1,7 +1,6 @@ #include "mspell/smart-mspell-util.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-flags.h" -#include "monster-race/race-flags2.h" #include "monster/smart-learn-types.h" #include "system/floor-type-definition.h" #include "system/monster-entity.h" diff --git a/src/mspell/summon-checker.cpp b/src/mspell/summon-checker.cpp index df3f42501..53ac271c4 100644 --- a/src/mspell/summon-checker.cpp +++ b/src/mspell/summon-checker.cpp @@ -2,11 +2,6 @@ #include "monster-attack/monster-attack-table.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" -#include "monster-race/race-flags8.h" #include "monster-race/race-indice-types.h" #include "monster/monster-util.h" #include "player-base/player-race.h" diff --git a/src/mutation/mutation-techniques.cpp b/src/mutation/mutation-techniques.cpp index b3f916b15..2064b806a 100644 --- a/src/mutation/mutation-techniques.cpp +++ b/src/mutation/mutation-techniques.cpp @@ -43,7 +43,7 @@ bool eat_rock(PlayerType *player_ptr) msg_print(_("この地形は食べられない。", "You cannot eat this feature.")); } else if (terrain.flags.has(TerrainCharacteristics::PERMANENT)) { msg_format(_("いてっ!この%sはあなたの歯より硬い!", "Ouch! This %s is harder than your teeth!"), terrain_mimic.name.data()); - } else if (grid.m_idx) { + } else if (grid.has_monster()) { const auto &monster = player_ptr->current_floor_ptr->m_list[grid.m_idx]; msg_print(_("何かが邪魔しています!", "There's something in the way!")); if (!monster.ml || !monster.is_pet()) { diff --git a/src/object-activation/activation-others.cpp b/src/object-activation/activation-others.cpp index 98ab5d0f2..0d3aa3cdf 100644 --- a/src/object-activation/activation-others.cpp +++ b/src/object-activation/activation-others.cpp @@ -16,7 +16,6 @@ #include "hpmp/hp-mp-processor.h" #include "mind/mind-archer.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster-race/race-indice-types.h" #include "monster/monster-status.h" #include "player-attack/player-attack.h" diff --git a/src/object-use/throw-execution.cpp b/src/object-use/throw-execution.cpp index f813ef2c6..1b1a0bc12 100644 --- a/src/object-use/throw-execution.cpp +++ b/src/object-use/throw-execution.cpp @@ -263,7 +263,7 @@ void ObjectThrowEntity::display_potion_throw() auto *floor_ptr = this->player_ptr->current_floor_ptr; auto *angry_m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[this->y][this->x].m_idx]; - if ((floor_ptr->grid_array[this->y][this->x].m_idx == 0) || !angry_m_ptr->is_friendly() || angry_m_ptr->is_invulnerable()) { + if (!floor_ptr->grid_array[this->y][this->x].has_monster() || !angry_m_ptr->is_friendly() || angry_m_ptr->is_invulnerable()) { this->do_drop = false; return; } diff --git a/src/object/object-broken.cpp b/src/object/object-broken.cpp index 7a2708799..b4b5609ad 100644 --- a/src/object/object-broken.cpp +++ b/src/object/object-broken.cpp @@ -201,7 +201,7 @@ bool ObjectBreaker::can_destroy(ItemEntity *o_ptr) const * o_ptr --- pointer to the potion object. * */ -bool potion_smash_effect(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, short bi_id) +bool potion_smash_effect(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, short bi_id) { int radius = 2; AttributeType dt = AttributeType::NONE; @@ -335,7 +335,7 @@ bool potion_smash_effect(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, PO break; } - (void)project(player_ptr, who, radius, y, x, dam, dt, (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL)); + (void)project(player_ptr, src_idx, radius, y, x, dam, dt, (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL)); return angry; } diff --git a/src/object/object-broken.h b/src/object/object-broken.h index 3e5a7d048..360bcb7d5 100644 --- a/src/object/object-broken.h +++ b/src/object/object-broken.h @@ -6,7 +6,7 @@ class ItemEntity; class PlayerType; -bool potion_smash_effect(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, short bi_id); +bool potion_smash_effect(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, short bi_id); PERCENTAGE breakage_chance(PlayerType *player_ptr, ItemEntity *o_ptr, bool has_archer_bonus, SPELL_IDX snipe_type); class ObjectBreaker { diff --git a/src/object/warning.cpp b/src/object/warning.cpp index 78dba081c..3f6180598 100644 --- a/src/object/warning.cpp +++ b/src/object/warning.cpp @@ -14,7 +14,6 @@ #include "monster-attack/monster-attack-table.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-flags.h" -#include "monster-race/race-flags1.h" #include "monster-race/race-indice-types.h" #include "monster/monster-info.h" #include "monster/monster-status.h" @@ -367,7 +366,7 @@ bool process_warning(PlayerType *player_ptr, POSITION xx, POSITION yy) const auto *g_ptr = &floor.grid_array[my][mx]; - if (!g_ptr->m_idx) { + if (!g_ptr->has_monster()) { continue; } diff --git a/src/perception/identification.cpp b/src/perception/identification.cpp index b57eae252..ad6b1f451 100644 --- a/src/perception/identification.cpp +++ b/src/perception/identification.cpp @@ -5,7 +5,6 @@ #include "game-option/special-options.h" #include "io/input-key-acceptor.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags2.h" #include "monster-race/race-indice-types.h" #include "object-enchant/object-ego.h" #include "object-enchant/tr-types.h" diff --git a/src/pet/pet-fall-off.cpp b/src/pet/pet-fall-off.cpp index ce0be87af..e3486aea1 100644 --- a/src/pet/pet-fall-off.cpp +++ b/src/pet/pet-fall-off.cpp @@ -111,7 +111,7 @@ bool process_fall_off_horse(PlayerType *player_ptr, int dam, bool force) Grid *g_ptr; g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x]; - if (g_ptr->m_idx) { + if (g_ptr->has_monster()) { continue; } diff --git a/src/pet/pet-util.cpp b/src/pet/pet-util.cpp index 8e331cce1..5fba06119 100644 --- a/src/pet/pet-util.cpp +++ b/src/pet/pet-util.cpp @@ -2,8 +2,6 @@ #include "core/stuff-handler.h" #include "grid/grid.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "monster/monster-info.h" #include "monster/monster-status.h" #include "player-info/class-info.h" diff --git a/src/player-attack/attack-chaos-effect.cpp b/src/player-attack/attack-chaos-effect.cpp index d1109f669..5a825d738 100644 --- a/src/player-attack/attack-chaos-effect.cpp +++ b/src/player-attack/attack-chaos-effect.cpp @@ -16,8 +16,6 @@ #include "monster-race//race-ability-mask.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" #include "monster-race/race-resistance-mask.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" diff --git a/src/player-attack/player-attack.cpp b/src/player-attack/player-attack.cpp index 7b6338b80..3a5b448a7 100644 --- a/src/player-attack/player-attack.cpp +++ b/src/player-attack/player-attack.cpp @@ -24,11 +24,11 @@ #include "mind/monk-attack.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags3.h" #include "monster/monster-damage.h" #include "monster/monster-describer.h" #include "monster/monster-status-setter.h" #include "monster/monster-status.h" +#include "monster/monster-util.h" #include "object-enchant/tr-types.h" #include "object-enchant/vorpal-weapon.h" #include "object-hook/hook-weapon.h" @@ -520,7 +520,7 @@ static void cause_earthquake(PlayerType *player_ptr, player_attack_type *pa_ptr, } earthquake(player_ptr, player_ptr->y, player_ptr->x, 10, 0); - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx == 0) { + if (!player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { *(pa_ptr->mdeath) = true; } } @@ -613,7 +613,7 @@ void massacre(PlayerType *player_ptr) POSITION x = player_ptr->x + ddx_ddd[dir]; g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x]; m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; - if (g_ptr->m_idx && (m_ptr->ml || cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::PROJECT))) { + if (g_ptr->has_monster() && (m_ptr->ml || cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::PROJECT))) { do_cmd_attack(player_ptr, y, x, HISSATSU_NONE); } } diff --git a/src/player-info/alignment.cpp b/src/player-info/alignment.cpp index 4511d4586..4e2766711 100644 --- a/src/player-info/alignment.cpp +++ b/src/player-info/alignment.cpp @@ -4,7 +4,6 @@ #include "game-option/text-display-options.h" #include "inventory/inventory-slot-types.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags3.h" #include "monster/monster-info.h" #include "monster/monster-status.h" #include "player-info/equipment-info.h" diff --git a/src/player/eldritch-horror.cpp b/src/player/eldritch-horror.cpp index 6b33b5eca..d49d5fb04 100644 --- a/src/player/eldritch-horror.cpp +++ b/src/player/eldritch-horror.cpp @@ -10,9 +10,6 @@ #include "monster-floor/place-monster-types.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster/horror-descriptions.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" diff --git a/src/player/player-damage.cpp b/src/player/player-damage.cpp index 13cab81b9..fd8b37164 100644 --- a/src/player/player-damage.cpp +++ b/src/player/player-damage.cpp @@ -29,8 +29,6 @@ #include "market/arena-info-table.h" #include "mind/mind-mirror-master.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" diff --git a/src/player/player-status-flags.cpp b/src/player/player-status-flags.cpp index 1ae2b98c8..f37988a8c 100644 --- a/src/player/player-status-flags.cpp +++ b/src/player/player-status-flags.cpp @@ -3,8 +3,6 @@ #include "inventory/inventory-slot-types.h" #include "mind/mind-elementalist.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" #include "mutation/mutation-flag-types.h" #include "object-enchant/object-ego.h" #include "object-enchant/tr-types.h" diff --git a/src/player/player-status-resist.cpp b/src/player/player-status-resist.cpp index 30d5099f0..8261ae53e 100644 --- a/src/player/player-status-resist.cpp +++ b/src/player/player-status-resist.cpp @@ -3,8 +3,6 @@ #include "grid/grid.h" #include "inventory/inventory-slot-types.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" #include "mutation/mutation-flag-types.h" #include "object-enchant/object-ego.h" #include "object-enchant/tr-types.h" diff --git a/src/player/player-status.cpp b/src/player/player-status.cpp index 0d45a15d7..7e760d0a7 100644 --- a/src/player/player-status.cpp +++ b/src/player/player-status.cpp @@ -33,9 +33,6 @@ #include "monster-floor/monster-remover.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags7.h" #include "monster/monster-update.h" #include "monster/smart-learn-types.h" #include "mutation/mutation-calculator.h" @@ -176,7 +173,7 @@ static void delayed_visual_update(PlayerType *player_ptr) } lite_spot(player_ptr, y, x); - if (g_ptr->m_idx) { + if (g_ptr->has_monster()) { update_monster(player_ptr, g_ptr->m_idx, false); } @@ -2819,7 +2816,7 @@ bool player_has_no_spellbooks(PlayerType *player_ptr) */ bool player_place(PlayerType *player_ptr, POSITION y, POSITION x) { - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { return false; } diff --git a/src/racial/racial-vampire.cpp b/src/racial/racial-vampire.cpp index 9c1974a89..b5d5a4a59 100644 --- a/src/racial/racial-vampire.cpp +++ b/src/racial/racial-vampire.cpp @@ -29,7 +29,7 @@ bool vampirism(PlayerType *player_ptr) POSITION x = player_ptr->x + ddx[dir]; const auto *g_ptr = &floor.grid_array[y][x]; stop_mouth(player_ptr); - if (!(g_ptr->m_idx)) { + if (!g_ptr->has_monster()) { msg_print(_("何もない場所に噛みついた!", "You bite into thin air!")); return false; } diff --git a/src/realm/realm-hex.cpp b/src/realm/realm-hex.cpp index 18a3351c0..7fa992a10 100644 --- a/src/realm/realm-hex.cpp +++ b/src/realm/realm-hex.cpp @@ -841,7 +841,7 @@ std::optional do_hex_spell(PlayerType *player_ptr, spell_hex_type s if (dir == 5) { continue; } - if (floor_ptr->grid_array[dy][dx].m_idx) { + if (floor_ptr->grid_array[dy][dx].has_monster()) { flag = true; } } diff --git a/src/realm/realm-hissatsu.cpp b/src/realm/realm-hissatsu.cpp index f8860b432..753503a37 100644 --- a/src/realm/realm-hissatsu.cpp +++ b/src/realm/realm-hissatsu.cpp @@ -23,7 +23,6 @@ #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags7.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" #include "monster/monster-update.h" @@ -123,7 +122,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy_cdd[cdir]; x = player_ptr->x + ddx_cdd[cdir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_NONE); } else { msg_print(_("攻撃は空を切った。", "You attack the empty air.")); @@ -131,7 +130,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy_cdd[(cdir + 7) % 8]; x = player_ptr->x + ddx_cdd[(cdir + 7) % 8]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_NONE); } else { msg_print(_("攻撃は空を切った。", "You attack the empty air.")); @@ -139,7 +138,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy_cdd[(cdir + 1) % 8]; x = player_ptr->x + ddx_cdd[(cdir + 1) % 8]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_NONE); } else { msg_print(_("攻撃は空を切った。", "You attack the empty air.")); @@ -184,7 +183,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_FIRE); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -227,7 +226,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_MINEUCHI); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -284,7 +283,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s const auto *floor_ptr = player_ptr->current_floor_ptr; const auto &grid = floor_ptr->grid_array[y][x]; - if (!grid.m_idx) { + if (!grid.has_monster()) { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); return std::nullopt; } @@ -325,7 +324,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_POISON); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -356,7 +355,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_ZANMA); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -387,7 +386,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s x = player_ptr->x + ddx[dir]; const auto &floor = *player_ptr->current_floor_ptr; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_NONE); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -396,7 +395,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s if (floor.get_dungeon_definition().flags.has(DungeonFeatureType::NO_MELEE)) { return ""; } - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { int i; POSITION ty = y, tx = x; POSITION oy = y, ox = x; @@ -476,7 +475,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_HAGAN); } @@ -512,7 +511,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_COLD); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -543,7 +542,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_KYUSHO); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -573,7 +572,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_MAJIN); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -604,7 +603,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_SUTEMI); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -635,7 +634,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_ELEC); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -679,7 +678,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s x = player_ptr->x + ddx_ddd[dir]; auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x]; auto *m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; - if ((g_ptr->m_idx == 0) || (!m_ptr->ml && !cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::PROJECT))) { + if (!g_ptr->has_monster() || (!m_ptr->ml && !cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::PROJECT))) { continue; } @@ -715,7 +714,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_QUAKE); } else { earthquake(player_ptr, player_ptr->y, player_ptr->x, 10, 0); @@ -815,7 +814,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s x = player_ptr->x + ddx[dir]; g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x]; - if (g_ptr->m_idx) { + if (g_ptr->has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_3DAN); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -827,7 +826,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s } /* Monster is dead? */ - if (!g_ptr->m_idx) { + if (!g_ptr->has_monster()) { break; } @@ -897,7 +896,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_DRAIN); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); @@ -1013,9 +1012,9 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_NONE); - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { handle_stuff(player_ptr); do_cmd_attack(player_ptr, y, x, HISSATSU_NONE); } @@ -1108,7 +1107,7 @@ std::optional do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX s y = player_ptr->y + ddy[dir]; x = player_ptr->x + ddx[dir]; - if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) { + if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) { do_cmd_attack(player_ptr, y, x, HISSATSU_UNDEAD); } else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); diff --git a/src/room/rooms-pit-nest.cpp b/src/room/rooms-pit-nest.cpp index 9c0c4ffb0..dbf84609e 100644 --- a/src/room/rooms-pit-nest.cpp +++ b/src/room/rooms-pit-nest.cpp @@ -10,10 +10,6 @@ #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster/monster-info.h" #include "monster/monster-list.h" #include "monster/monster-util.h" diff --git a/src/room/vault-builder.cpp b/src/room/vault-builder.cpp index 546b08185..0b4c2567b 100644 --- a/src/room/vault-builder.cpp +++ b/src/room/vault-builder.cpp @@ -27,7 +27,7 @@ static bool player_grid(PlayerType *player_ptr, Grid *g_ptr) static bool is_cave_empty_grid(PlayerType *player_ptr, Grid *g_ptr) { bool is_empty_grid = g_ptr->cave_has_flag(TerrainCharacteristics::PLACE); - is_empty_grid &= g_ptr->m_idx == 0; + is_empty_grid &= !g_ptr->has_monster(); is_empty_grid &= !player_grid(player_ptr, g_ptr); return is_empty_grid; } @@ -139,7 +139,7 @@ static void vault_trap_aux(FloorType *floor_ptr, POSITION y, POSITION x, POSITIO } g_ptr = &floor_ptr->grid_array[y1][x1]; - if (!g_ptr->is_floor() || !g_ptr->o_idx_list.empty() || g_ptr->m_idx) { + if (!g_ptr->is_floor() || !g_ptr->o_idx_list.empty() || g_ptr->has_monster()) { continue; } diff --git a/src/save/monster-writer.cpp b/src/save/monster-writer.cpp index 38f137244..94454862f 100644 --- a/src/save/monster-writer.cpp +++ b/src/save/monster-writer.cpp @@ -204,9 +204,6 @@ void wr_lore(MonsterRaceId r_idx) wr_byte(r_ptr->r_blows[2]); wr_byte(r_ptr->r_blows[3]); - wr_u32b(r_ptr->r_flags1); - wr_u32b(r_ptr->r_flags2); - wr_u32b(r_ptr->r_flags3); wr_FlagGroup(r_ptr->r_resistance_flags, wr_byte); wr_FlagGroup(r_ptr->r_ability_flags, wr_byte); wr_FlagGroup(r_ptr->r_aura_flags, wr_byte); diff --git a/src/spell-class/spells-mirror-master.cpp b/src/spell-class/spells-mirror-master.cpp index cfd39204b..dd13908dd 100644 --- a/src/spell-class/spells-mirror-master.cpp +++ b/src/spell-class/spells-mirror-master.cpp @@ -62,7 +62,7 @@ void SpellsMirrorMaster::remove_mirror(int y, int x) reset_bits(g_ptr->info, CAVE_MARK); } - if (g_ptr->m_idx) { + if (g_ptr->has_monster()) { update_monster(this->player_ptr, g_ptr->m_idx, false); } @@ -196,7 +196,7 @@ void SpellsMirrorMaster::seal_of_mirror(const int dam) continue; } - if (g_ref.m_idx == 0) { + if (!g_ref.has_monster()) { this->remove_mirror(y, x); } } @@ -334,7 +334,7 @@ void SpellsMirrorMaster::project_seeker_ray(int target_x, int target_y, int dam) } const auto &grid = floor.grid_array[project_m_y][project_m_x]; const auto &monster = floor.m_list[grid.m_idx]; - if (project_m_n == 1 && grid.m_idx > 0 && monster.ml) { + if (project_m_n == 1 && grid.has_monster() && monster.ml) { if (!this->player_ptr->effects()->hallucination()->is_hallucinated()) { monster_race_track(this->player_ptr, monster.ap_r_idx); } @@ -431,7 +431,7 @@ static bool activate_super_ray_effect(PlayerType *player_ptr, int y, int x, int const auto *floor_ptr = player_ptr->current_floor_ptr; const auto *g_ptr = &floor_ptr->grid_array[project_m_y][project_m_x]; const auto *m_ptr = &floor_ptr->m_list[g_ptr->m_idx]; - if (project_m_n == 1 && g_ptr->m_idx > 0 && m_ptr->ml) { + if (project_m_n == 1 && g_ptr->has_monster() && m_ptr->ml) { if (!player_ptr->effects()->hallucination()->is_hallucinated()) { monster_race_track(player_ptr, m_ptr->ap_r_idx); } diff --git a/src/spell-kind/earthquake.cpp b/src/spell-kind/earthquake.cpp index 2c8ebdda8..e9ec609a5 100644 --- a/src/spell-kind/earthquake.cpp +++ b/src/spell-kind/earthquake.cpp @@ -15,8 +15,6 @@ #include "mind/mind-ninja.h" #include "monster-floor/monster-lite.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" @@ -112,7 +110,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO continue; } - if (floor_ptr->grid_array[y][x].m_idx) { + if (floor_ptr->grid_array[y][x].has_monster()) { continue; } @@ -180,7 +178,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO continue; } - if (!grid.m_idx) { + if (!grid.has_monster()) { continue; } @@ -220,7 +218,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO continue; } - if (grid_neighbor.m_idx) { + if (grid_neighbor.has_monster()) { continue; } @@ -251,7 +249,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO msg_format(_("%s^は岩石に埋もれてしまった!", "%s^ is embedded in the rock!"), m_name.data()); } - if (grid.m_idx) { + if (grid.has_monster()) { const auto &m_ref = floor_ptr->m_list[grid.m_idx]; if (record_named_pet && m_ref.is_named_pet()) { const auto m2_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE); diff --git a/src/spell-kind/spells-detection.cpp b/src/spell-kind/spells-detection.cpp index 49db38b6c..e907700da 100644 --- a/src/spell-kind/spells-detection.cpp +++ b/src/spell-kind/spells-detection.cpp @@ -8,8 +8,6 @@ #include "grid/trap.h" #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" #include "monster/monster-flag-types.h" #include "monster/monster-info.h" #include "monster/monster-status.h" diff --git a/src/spell-kind/spells-fetcher.cpp b/src/spell-kind/spells-fetcher.cpp index 0164686b6..b642e9fae 100644 --- a/src/spell-kind/spells-fetcher.cpp +++ b/src/spell-kind/spells-fetcher.cpp @@ -8,7 +8,6 @@ #include "grid/grid.h" #include "monster-race/monster-race.h" #include "monster-race/race-brightness-mask.h" -#include "monster-race/race-flags7.h" #include "monster/monster-describer.h" #include "monster/monster-status-setter.h" #include "monster/monster-update.h" diff --git a/src/spell-kind/spells-floor.cpp b/src/spell-kind/spells-floor.cpp index 218582636..e49f19f82 100644 --- a/src/spell-kind/spells-floor.cpp +++ b/src/spell-kind/spells-floor.cpp @@ -29,7 +29,6 @@ #include "mind/mind-ninja.h" #include "monster-floor/monster-lite.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" @@ -336,7 +335,7 @@ bool destroy_area(PlayerType *player_ptr, const POSITION y1, const POSITION x1, continue; } - if (grid.m_idx) { + if (grid.has_monster()) { auto &monster = floor.m_list[grid.m_idx]; auto &monrace = monster.get_monrace(); diff --git a/src/spell-kind/spells-genocide.cpp b/src/spell-kind/spells-genocide.cpp index db35f37c0..82febca4e 100644 --- a/src/spell-kind/spells-genocide.cpp +++ b/src/spell-kind/spells-genocide.cpp @@ -14,9 +14,6 @@ #include "monster-floor/monster-remover.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-flag-types.h" diff --git a/src/spell-kind/spells-launcher.cpp b/src/spell-kind/spells-launcher.cpp index 790535921..fe4d1fae8 100644 --- a/src/spell-kind/spells-launcher.cpp +++ b/src/spell-kind/spells-launcher.cpp @@ -131,7 +131,7 @@ bool fire_ball_hide(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, in /*! * @brief メテオ系スペルの発動 / Cast a meteor spell * @param player_ptr プレイヤーへの参照ポインタ - * @param who スぺル詠唱者のモンスターID(0=プレイヤー) + * @param src_idx スぺル詠唱者のモンスターID(0=プレイヤー) * @param typ 効果属性 * @param dam 威力 * @param rad 半径 @@ -147,10 +147,10 @@ bool fire_ball_hide(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, in * Option to hurt the player. * */ -bool fire_meteor(PlayerType *player_ptr, MONSTER_IDX who, AttributeType typ, POSITION y, POSITION x, int dam, POSITION rad) +bool fire_meteor(PlayerType *player_ptr, MONSTER_IDX src_idx, AttributeType typ, POSITION y, POSITION x, int dam, POSITION rad) { BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL; - return project(player_ptr, who, rad, y, x, dam, typ, flg).notice; + return project(player_ptr, src_idx, rad, y, x, dam, typ, flg).notice; } /*! diff --git a/src/spell-kind/spells-launcher.h b/src/spell-kind/spells-launcher.h index 11c8b32f6..61ccf6edb 100644 --- a/src/spell-kind/spells-launcher.h +++ b/src/spell-kind/spells-launcher.h @@ -10,7 +10,7 @@ bool fire_ball(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, int dam bool fire_breath(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, int dam, POSITION rad); bool fire_rocket(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, int dam, POSITION rad); bool fire_ball_hide(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, int dam, POSITION rad); -bool fire_meteor(PlayerType *player_ptr, MONSTER_IDX who, AttributeType typ, POSITION x, POSITION y, int dam, POSITION rad); +bool fire_meteor(PlayerType *player_ptr, MONSTER_IDX src_idx, AttributeType typ, POSITION x, POSITION y, int dam, POSITION rad); bool fire_bolt(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, int dam); bool fire_blast(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev); bool fire_beam(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, int dam); diff --git a/src/spell-kind/spells-lite.cpp b/src/spell-kind/spells-lite.cpp index b4a7c90e6..66ce8a968 100644 --- a/src/spell-kind/spells-lite.cpp +++ b/src/spell-kind/spells-lite.cpp @@ -10,7 +10,6 @@ #include "grid/grid.h" #include "mind/mind-ninja.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags2.h" #include "monster/monster-describer.h" #include "monster/monster-status-setter.h" #include "monster/monster-status.h" @@ -63,7 +62,7 @@ static void cave_temp_room_lite(PlayerType *player_ptr, const std::vector auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x]; g_ptr->info &= ~(CAVE_TEMP); g_ptr->info |= (CAVE_GLOW); - if (g_ptr->m_idx) { + if (g_ptr->has_monster()) { PERCENTAGE chance = 25; auto *m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; auto *r_ptr = &m_ptr->get_monrace(); @@ -133,7 +132,7 @@ static void cave_temp_room_unlite(PlayerType *player_ptr, const std::vectorcurrent_floor_ptr->grid_array[ty][tx]; - if (!g_ptr->m_idx || (g_ptr->m_idx == player_ptr->riding)) { + if (!g_ptr->has_monster() || (g_ptr->m_idx == player_ptr->riding)) { msg_print(_("それとは場所を交換できません。", "You can't trade places with that!")); return false; } @@ -515,7 +514,7 @@ void teleport_player_to(PlayerType *player_ptr, POSITION ny, POSITION nx, telepo bool is_anywhere = w_ptr->wizard; is_anywhere &= (mode & TELEPORT_PASSIVE) == 0; - is_anywhere &= (player_ptr->current_floor_ptr->grid_array[y][x].m_idx > 0) || player_ptr->current_floor_ptr->grid_array[y][x].m_idx == player_ptr->riding; + is_anywhere &= player_ptr->current_floor_ptr->grid_array[y][x].has_monster() || player_ptr->current_floor_ptr->grid_array[y][x].m_idx == player_ptr->riding; if (is_anywhere) { break; } diff --git a/src/spell-kind/spells-world.cpp b/src/spell-kind/spells-world.cpp index b86e9199b..2577f3a1d 100644 --- a/src/spell-kind/spells-world.cpp +++ b/src/spell-kind/spells-world.cpp @@ -22,7 +22,6 @@ #include "market/building-util.h" #include "monster-floor/monster-remover.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "system/angband-system.h" diff --git a/src/spell-realm/spells-chaos.cpp b/src/spell-realm/spells-chaos.cpp index 72984ac53..aa490948b 100644 --- a/src/spell-realm/spells-chaos.cpp +++ b/src/spell-realm/spells-chaos.cpp @@ -162,7 +162,7 @@ bool vanish_dungeon(PlayerType *player_ptr) const auto &terrrain = grid.get_terrain(); grid.info &= ~(CAVE_ROOM | CAVE_ICKY); const auto &monster = floor.m_list[grid.m_idx]; - if (grid.m_idx && monster.is_asleep()) { + if (grid.has_monster() && monster.is_asleep()) { (void)set_monster_csleep(player_ptr, grid.m_idx, 0); if (monster.ml) { const auto m_name = monster_desc(player_ptr, &monster, 0); diff --git a/src/spell-realm/spells-craft.cpp b/src/spell-realm/spells-craft.cpp index 9cf7e9e21..e4d5a7948 100644 --- a/src/spell-realm/spells-craft.cpp +++ b/src/spell-realm/spells-craft.cpp @@ -141,19 +141,19 @@ bool set_ele_immune(PlayerType *player_ptr, uint32_t immune_type, TIME_EFFECT v) player_ptr->ele_immune = v; std::string element; switch (immune_type) { - case ATTACK_ACID: + case DEFENSE_ACID: element = _("酸", "acid!"); break; - case ATTACK_ELEC: + case DEFENSE_ELEC: element = _("電撃", "electricity!"); break; - case ATTACK_FIRE: + case DEFENSE_FIRE: element = _("火炎", "fire!"); break; - case ATTACK_COLD: + case DEFENSE_COLD: element = _("冷気", "cold!"); break; - case ATTACK_POIS: + case DEFENSE_POIS: element = _("毒", "poison!"); break; default: // @todo 本来はruntime_error を飛ばすべきだが、既存コードと同じように動くことを優先した. diff --git a/src/spell-realm/spells-crusade.cpp b/src/spell-realm/spells-crusade.cpp index b91a5ff9d..9ac9f117b 100644 --- a/src/spell-realm/spells-crusade.cpp +++ b/src/spell-realm/spells-crusade.cpp @@ -61,7 +61,7 @@ bool cast_wrath_of_the_god(PlayerType *player_ptr, int dam, POSITION rad) if (!cave_has_flag_bold(&floor, pos_to.y, pos_to.x, TerrainCharacteristics::PROJECT)) { break; } - if ((dir != 5) && floor.get_grid(pos_to).m_idx != 0) { + if ((dir != 5) && floor.get_grid(pos_to).has_monster()) { break; } diff --git a/src/spell/spells-diceroll.cpp b/src/spell/spells-diceroll.cpp index f6ac99311..65c307900 100644 --- a/src/spell/spells-diceroll.cpp +++ b/src/spell/spells-diceroll.cpp @@ -2,9 +2,6 @@ #include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster/monster-flag-types.h" #include "monster/monster-info.h" #include "player-base/player-class.h" diff --git a/src/spell/spells-object.cpp b/src/spell/spells-object.cpp index 15d068c71..e9fe2179d 100644 --- a/src/spell/spells-object.cpp +++ b/src/spell/spells-object.cpp @@ -14,7 +14,6 @@ #include "game-option/disturbance-options.h" #include "inventory/inventory-slot-types.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "object-enchant/item-apply-magic.h" #include "object-enchant/item-feeling.h" #include "object-enchant/item-magic-applier.h" diff --git a/src/spell/spells-status.cpp b/src/spell/spells-status.cpp index 5a5c84f7b..2d5341efa 100644 --- a/src/spell/spells-status.cpp +++ b/src/spell/spells-status.cpp @@ -546,7 +546,7 @@ bool fishing(PlayerType *player_ptr) return false; } - if (floor_ptr->grid_array[y][x].m_idx) { + if (floor_ptr->grid_array[y][x].has_monster()) { const auto m_name = monster_desc(player_ptr, &floor_ptr->m_list[floor_ptr->grid_array[y][x].m_idx], 0); msg_format(_("%sが邪魔だ!", "%s^ is standing in your way."), m_name.data()); PlayerEnergy(player_ptr).reset_player_turn(); diff --git a/src/spell/spells-summon.cpp b/src/spell/spells-summon.cpp index 33e1317f2..121ea9c85 100644 --- a/src/spell/spells-summon.cpp +++ b/src/spell/spells-summon.cpp @@ -12,6 +12,7 @@ #include "monster-race/race-indice-types.h" #include "monster/monster-info.h" #include "monster/monster-status.h" +#include "monster/monster-util.h" #include "monster/smart-learn-types.h" #include "object/item-tester-hooker.h" #include "object/item-use-flags.h" @@ -55,7 +56,7 @@ bool trump_summoning(PlayerType *player_ptr, int num, bool pet, POSITION y, POSI lev = plev * 2 / 3 + randint1(plev / 2); } - MONSTER_IDX who; + MONSTER_IDX src_idx; if (pet) { /* Become pet */ mode |= PM_FORCE_PET; @@ -69,18 +70,18 @@ bool trump_summoning(PlayerType *player_ptr, int num, bool pet, POSITION y, POSI } /* Player is who summons */ - who = -1; + src_idx = -1; } else { /* Prevent taming, allow unique monster */ mode |= PM_NO_PET; /* Behave as if they appear by themselfs */ - who = 0; + src_idx = 0; } bool success = false; for (int i = 0; i < num; i++) { - if (summon_specific(player_ptr, who, y, x, lev, type, mode)) { + if (summon_specific(player_ptr, src_idx, y, x, lev, type, mode)) { success = true; } } @@ -260,18 +261,18 @@ bool summon_kin_player(PlayerType *player_ptr, DEPTH level, POSITION y, POSITION /*! * @brief サイバーデーモンの召喚 * @param player_ptr プレイヤーへの参照ポインタ - * @param who 召喚主のモンスターID(0ならばプレイヤー) + * @param src_idx 召喚主のモンスターID(0ならばプレイヤー) * @param y 召喚位置Y座標 * @param x 召喚位置X座標 * @return 作用が実際にあった場合TRUEを返す */ -int summon_cyber(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x) +int summon_cyber(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x) { /* Summoned by a monster */ BIT_FLAGS mode = PM_ALLOW_GROUP; auto *floor_ptr = player_ptr->current_floor_ptr; - if (who > 0) { - auto *m_ptr = &floor_ptr->m_list[who]; + if (is_monster(src_idx)) { + auto *m_ptr = &floor_ptr->m_list[src_idx]; if (m_ptr->is_pet()) { mode |= PM_FORCE_PET; } @@ -284,7 +285,7 @@ int summon_cyber(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x int count = 0; for (int i = 0; i < max_cyber; i++) { - count += summon_specific(player_ptr, who, y, x, 100, SUMMON_CYBER, mode); + count += summon_specific(player_ptr, src_idx, y, x, 100, SUMMON_CYBER, mode); } return count; diff --git a/src/spell/spells-summon.h b/src/spell/spells-summon.h index c5ac9fc56..971560a87 100644 --- a/src/spell/spells-summon.h +++ b/src/spell/spells-summon.h @@ -15,6 +15,6 @@ bool cast_summon_octopus(PlayerType *player_ptr); bool cast_summon_greater_demon(PlayerType *player_ptr); bool summon_kin_player(PlayerType *player_ptr, DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode); void mitokohmon(PlayerType *player_ptr); -int summon_cyber(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x); +int summon_cyber(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x); int activate_hi_summon(PlayerType *player_ptr, POSITION y, POSITION x, bool can_pet); void cast_invoke_spirits(PlayerType *player_ptr, DIRECTION dir); diff --git a/src/store/service-checker.cpp b/src/store/service-checker.cpp index 3d771e3bf..e3d52f619 100644 --- a/src/store/service-checker.cpp +++ b/src/store/service-checker.cpp @@ -1,6 +1,5 @@ #include "store/service-checker.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags3.h" #include "object-enchant/tr-types.h" #include "object/object-value.h" #include "object/tval-types.h" diff --git a/src/system/angband-version.h b/src/system/angband-version.h index 9cbcccc9d..2c763d170 100644 --- a/src/system/angband-version.h +++ b/src/system/angband-version.h @@ -23,12 +23,12 @@ constexpr std::string_view ROOT_VARIANT_NAME("Hengband"); #define H_VER_MAJOR 3 //!< ゲームのバージョン定義(メジャー番号) #define H_VER_MINOR 0 //!< ゲームのバージョン定義(マイナー番号) #define H_VER_PATCH 1 //!< ゲームのバージョン定義(パッチ番号) -#define H_VER_EXTRA 6 //!< ゲームのバージョン定義(エクストラ番号) +#define H_VER_EXTRA 7 //!< ゲームのバージョン定義(エクストラ番号) /*! * @brief セーブファイルのバージョン(3.0.0から導入) */ -constexpr uint32_t SAVEFILE_VERSION = 20; +constexpr uint32_t SAVEFILE_VERSION = 21; /*! * @brief バージョンが開発版が安定版かを返す(廃止予定) diff --git a/src/system/dungeon-info.h b/src/system/dungeon-info.h index b090617bf..375ff7b27 100644 --- a/src/system/dungeon-info.h +++ b/src/system/dungeon-info.h @@ -83,12 +83,6 @@ struct dungeon_type { EnumClassFlagGroup flags{}; /* Dungeon Flags */ - BIT_FLAGS mflags1{}; /* The monster flags that are allowed */ - BIT_FLAGS mflags2{}; - BIT_FLAGS mflags3{}; - BIT_FLAGS mflags7{}; - BIT_FLAGS mflags8{}; - EnumClassFlagGroup mon_ability_flags; EnumClassFlagGroup mon_behavior_flags; EnumClassFlagGroup mon_visual_flags; diff --git a/src/system/grid-type-definition.cpp b/src/system/grid-type-definition.cpp index 1a6e9604e..78753a2a1 100644 --- a/src/system/grid-type-definition.cpp +++ b/src/system/grid-type-definition.cpp @@ -1,5 +1,5 @@ #include "system/grid-type-definition.h" -#include "monster-race/race-flags7.h" +#include "monster/monster-util.h" #include "system/angband-system.h" #include "system/monster-race-info.h" #include "system/terrain-type-definition.h" @@ -92,6 +92,11 @@ bool Grid::is_rune_explosion() const return this->is_object() && TerrainList::get_instance()[this->mimic].flags.has(TerrainCharacteristics::RUNE_EXPLOSION); } +bool Grid::has_monster() const +{ + return is_monster(this->m_idx); +} + byte Grid::get_cost(const MonsterRaceInfo *r_ptr) const { return this->costs[get_grid_flow_type(r_ptr)]; diff --git a/src/system/grid-type-definition.h b/src/system/grid-type-definition.h index ed4510438..d716cb870 100644 --- a/src/system/grid-type-definition.h +++ b/src/system/grid-type-definition.h @@ -83,6 +83,7 @@ public: bool is_mirror() const; bool is_rune_protection() const; bool is_rune_explosion() const; + bool has_monster() const; byte get_cost(const MonsterRaceInfo *r_ptr) const; byte get_distance(const MonsterRaceInfo *r_ptr) const; FEAT_IDX get_feat_mimic() const; diff --git a/src/system/monster-race-info.h b/src/system/monster-race-info.h index 8b3ecbdb1..2b5cb15f9 100644 --- a/src/system/monster-race-info.h +++ b/src/system/monster-race-info.h @@ -79,11 +79,6 @@ public: EXP mexp{}; //!< 殺害時基本経験値 / Exp value for kill RARITY freq_spell{}; //!< 魔法&特殊能力仕様頻度(1/n) / Spell frequency MonsterSex sex{}; //!< 性別 / Sex - BIT_FLAGS flags1{}; //!< Flags 1 (general) - BIT_FLAGS flags2{}; //!< Flags 2 (abilities) - BIT_FLAGS flags3{}; //!< Flags 3 (race/resist) - BIT_FLAGS flags7{}; //!< Flags 7 (movement related abilities) - BIT_FLAGS flags8{}; //!< Flags 8 (wilderness info) EnumClassFlagGroup ability_flags; //!< 能力フラグ(魔法/ブレス) / Ability Flags EnumClassFlagGroup aura_flags; //!< オーラフラグ / Aura Flags EnumClassFlagGroup behavior_flags; //!< 能力フラグ(習性) @@ -130,9 +125,6 @@ public: ITEM_NUMBER r_drop_item{}; //!< これまでに撃破時に落としたアイテムの数 / Max number of item dropped at once byte r_cast_spell{}; //!< 使った魔法/ブレスの種類数 / Max unique number of spells seen byte r_blows[MAX_NUM_BLOWS]{}; //!< 受けた打撃 / Number of times each blow type was seen - uint32_t r_flags1{}; //!< Observed racial flags - uint32_t r_flags2{}; //!< Observed racial flags - uint32_t r_flags3{}; //!< Observed racial flags EnumClassFlagGroup r_ability_flags; //!< 見た能力フラグ(魔法/ブレス) / Observed racial ability flags EnumClassFlagGroup r_aura_flags; //!< 見た能力フラグ(オーラ) / Observed aura flags EnumClassFlagGroup r_behavior_flags; //!< 見た能力フラグ(習性) / Observed racial attr flags diff --git a/src/target/projection-path-calculator.cpp b/src/target/projection-path-calculator.cpp index b406800da..0a0ac940b 100644 --- a/src/target/projection-path-calculator.cpp +++ b/src/target/projection-path-calculator.cpp @@ -123,7 +123,7 @@ static bool project_stop(PlayerType *player_ptr, projection_path_type *pp_ptr) } } - if (any_bits(pp_ptr->flag, PROJECT_STOP) && !pp_ptr->position->empty() && (player_ptr->is_located_at(pos) || grid.m_idx != 0)) { + if (any_bits(pp_ptr->flag, PROJECT_STOP) && !pp_ptr->position->empty() && (player_ptr->is_located_at(pos) || grid.has_monster())) { return true; } diff --git a/src/target/target-describer.cpp b/src/target/target-describer.cpp index bb3bd28bd..61323a493 100644 --- a/src/target/target-describer.cpp +++ b/src/target/target-describer.cpp @@ -17,7 +17,6 @@ #include "locale/english.h" #include "lore/lore-util.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-flag-types.h" @@ -271,7 +270,7 @@ static bool within_char_util(const short input) static short describe_grid(PlayerType *player_ptr, GridExamination *ge_ptr) { - if ((ge_ptr->g_ptr->m_idx == 0) || !player_ptr->current_floor_ptr->m_list[ge_ptr->g_ptr->m_idx].ml) { + if (!ge_ptr->g_ptr->has_monster() || !player_ptr->current_floor_ptr->m_list[ge_ptr->g_ptr->m_idx].ml) { return CONTINUOUS_DESCRIPTION; } diff --git a/src/target/target-getter.cpp b/src/target/target-getter.cpp index fd3e1c3e2..ded601482 100644 --- a/src/target/target-getter.cpp +++ b/src/target/target-getter.cpp @@ -7,7 +7,6 @@ #include "io/input-key-requester.h" #include "main/sound-of-music.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-describer.h" #include "monster/monster-status.h" #include "system/floor-type-definition.h" diff --git a/src/target/target-preparation.cpp b/src/target/target-preparation.cpp index 467c23e79..f1bf38cfe 100644 --- a/src/target/target-preparation.cpp +++ b/src/target/target-preparation.cpp @@ -3,7 +3,6 @@ #include "game-option/input-options.h" #include "grid/grid.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-flag-types.h" #include "monster/monster-info.h" #include "monster/monster-status.h" @@ -87,7 +86,7 @@ static bool target_set_accept(PlayerType *player_ptr, const Pos2D &pos) } const auto &grid = floor.get_grid(pos); - if (grid.m_idx) { + if (grid.has_monster()) { auto &monster = floor.m_list[grid.m_idx]; if (monster.ml) { return true; diff --git a/src/util/sort.cpp b/src/util/sort.cpp index c1d366867..0b39b02b9 100644 --- a/src/util/sort.cpp +++ b/src/util/sort.cpp @@ -3,7 +3,6 @@ #include "dungeon/quest.h" #include "grid/grid.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "monster/monster-flag-types.h" #include "system/artifact-type-definition.h" #include "system/floor-type-definition.h" @@ -138,14 +137,14 @@ bool ang_sort_comp_importance(PlayerType *player_ptr, vptr u, vptr v, int a, int /* Extract monster race */ MonsterRaceInfo *ap_r_ptr_a; - if (grid_a.m_idx && monster_a.ml) { + if (grid_a.has_monster() && monster_a.ml) { ap_r_ptr_a = &monster_a.get_appearance_monrace(); } else { ap_r_ptr_a = nullptr; } MonsterRaceInfo *ap_r_ptr_b; - if (grid_b.m_idx && monster_b.ml) { + if (grid_b.has_monster() && monster_b.ml) { ap_r_ptr_b = &monster_b.get_appearance_monrace(); } else { ap_r_ptr_b = nullptr; diff --git a/src/view/display-lore-attacks.cpp b/src/view/display-lore-attacks.cpp index 2cefd41fa..473fbfc50 100644 --- a/src/view/display-lore-attacks.cpp +++ b/src/view/display-lore-attacks.cpp @@ -4,7 +4,6 @@ #include "lore/lore-calculator.h" #include "lore/lore-util.h" #include "monster-attack/monster-attack-table.h" -#include "monster-race/race-flags1.h" #include "system/monster-race-info.h" #include "term/term-color-types.h" diff --git a/src/view/display-lore-drops.cpp b/src/view/display-lore-drops.cpp index f38112498..54c2caa18 100644 --- a/src/view/display-lore-drops.cpp +++ b/src/view/display-lore-drops.cpp @@ -1,6 +1,5 @@ #include "view/display-lore-drops.h" #include "lore/lore-util.h" -#include "monster-race/race-flags1.h" #include "util/bit-flags-calculator.h" void display_monster_drop_quantity(lore_type *lore_ptr) diff --git a/src/view/display-lore-magics.cpp b/src/view/display-lore-magics.cpp index d4bc6c9c1..a76c7ab5a 100644 --- a/src/view/display-lore-magics.cpp +++ b/src/view/display-lore-magics.cpp @@ -1,6 +1,5 @@ #include "view/display-lore-magics.h" #include "lore/lore-util.h" -#include "monster-race/race-flags2.h" #include "system/monster-race-info.h" #include "term/term-color-types.h" diff --git a/src/view/display-lore-status.cpp b/src/view/display-lore-status.cpp index 05597fb4b..c9a3c8f0e 100644 --- a/src/view/display-lore-status.cpp +++ b/src/view/display-lore-status.cpp @@ -5,10 +5,6 @@ #include "monster-race/monster-race.h" #include "monster-race/race-brightness-flags.h" #include "monster-race/race-flags-resistance.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "system/monster-entity.h" #include "system/monster-race-info.h" #include "term/term-color-types.h" diff --git a/src/view/display-lore.cpp b/src/view/display-lore.cpp index 7c3ebbdb7..8763a5a1f 100644 --- a/src/view/display-lore.cpp +++ b/src/view/display-lore.cpp @@ -15,10 +15,6 @@ #include "monster-attack/monster-attack-table.h" #include "monster-race/monster-race.h" #include "monster-race/race-ability-flags.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" -#include "monster-race/race-flags3.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "system/monster-race-info.h" #include "system/player-type-definition.h" diff --git a/src/view/display-map.cpp b/src/view/display-map.cpp index 79ced0c8e..da76b16bd 100644 --- a/src/view/display-map.cpp +++ b/src/view/display-map.cpp @@ -9,8 +9,6 @@ #include "grid/feature.h" #include "grid/grid.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags2.h" #include "object/object-info.h" #include "object/object-mark-types.h" #include "system/baseitem-info.h" @@ -303,7 +301,7 @@ void map_info(PlayerType *player_ptr, POSITION y, POSITION x, TERM_COLOR *ap, ch break; } - if (grid.m_idx && display_autopick != 0) { + if (grid.has_monster() && display_autopick != 0) { set_term_color(player_ptr, y, x, ap, cp); return; } diff --git a/src/window/display-sub-windows.cpp b/src/window/display-sub-windows.cpp index 5d544a040..b0c301c02 100644 --- a/src/window/display-sub-windows.cpp +++ b/src/window/display-sub-windows.cpp @@ -527,7 +527,7 @@ void fix_object(PlayerType *player_ptr) */ static const MonsterEntity *monster_on_floor_items(FloorType *floor_ptr, const Grid *g_ptr) { - if (g_ptr->m_idx == 0) { + if (!g_ptr->has_monster()) { return nullptr; } diff --git a/src/wizard/monster-info-spoiler.cpp b/src/wizard/monster-info-spoiler.cpp index 76739b83a..d57b91e63 100644 --- a/src/wizard/monster-info-spoiler.cpp +++ b/src/wizard/monster-info-spoiler.cpp @@ -1,9 +1,6 @@ #include "wizard/monster-info-spoiler.h" #include "io/files-util.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" -#include "monster-race/race-flags8.h" #include "system/angband-version.h" #include "system/monster-race-info.h" #include "term/term-color-types.h" diff --git a/src/wizard/wizard-game-modifier.cpp b/src/wizard/wizard-game-modifier.cpp index 47feb6aa0..a737c79a6 100644 --- a/src/wizard/wizard-game-modifier.cpp +++ b/src/wizard/wizard-game-modifier.cpp @@ -10,8 +10,6 @@ #include "io/input-key-requester.h" #include "market/arena.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" -#include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "player-info/self-info.h" #include "system/floor-type-definition.h" diff --git a/src/wizard/wizard-spoiler.cpp b/src/wizard/wizard-spoiler.cpp index 2af7ae1c0..82752741d 100644 --- a/src/wizard/wizard-spoiler.cpp +++ b/src/wizard/wizard-spoiler.cpp @@ -17,8 +17,6 @@ #include "io/input-key-acceptor.h" #include "main/sound-of-music.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags7.h" -#include "monster-race/race-flags8.h" #include "object/object-kind-hook.h" #include "player-info/class-info.h" #include "realm/realm-names-table.h" diff --git a/src/world/world-movement-processor.cpp b/src/world/world-movement-processor.cpp index 0c511fdcf..7c432bc36 100644 --- a/src/world/world-movement-processor.cpp +++ b/src/world/world-movement-processor.cpp @@ -10,7 +10,6 @@ #include "main/sound-definitions-table.h" #include "main/sound-of-music.h" #include "monster-race/monster-race.h" -#include "monster-race/race-flags1.h" #include "system/angband-system.h" #include "system/dungeon-info.h" #include "system/floor-type-definition.h" diff --git a/src/world/world-turn-processor.cpp b/src/world/world-turn-processor.cpp index 3ea111def..21ad9c86f 100644 --- a/src/world/world-turn-processor.cpp +++ b/src/world/world-turn-processor.cpp @@ -146,7 +146,7 @@ void WorldTurnProcessor::process_monster_arena() for (auto x = 0; x < floor_ptr->width; ++x) { for (auto y = 0; y < floor_ptr->height; y++) { auto *g_ptr = &floor_ptr->grid_array[y][x]; - if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != this->player_ptr->riding)) { + if (g_ptr->has_monster() && (g_ptr->m_idx != this->player_ptr->riding)) { number_mon++; win_m_idx = g_ptr->m_idx; }