OSDN Git Service

[Refactor] enum classの型名変更 DF -> DungeonFeatureType
[hengbandforosx/hengbandosx.git] / src / monster / monster-util.cpp
index 134c97f..e52ff23 100644 (file)
@@ -57,34 +57,34 @@ static bool restrict_monster_to_dungeon(player_type *player_ptr, MONRACE_IDX r_i
     dungeon_type *d_ptr = &d_info[d_idx];
     monster_race *r_ptr = &r_info[r_idx];
 
-    if (d_ptr->flags.has(DF::CHAMELEON)) {
+    if (d_ptr->flags.has(DungeonFeatureType::CHAMELEON)) {
         if (chameleon_change_m_idx)
             return true;
     }
 
-    if (d_ptr->flags.has(DF::NO_MAGIC)) {
+    if (d_ptr->flags.has(DungeonFeatureType::NO_MAGIC)) {
         if (r_idx != MON_CHAMELEON && r_ptr->freq_spell && r_ptr->ability_flags.has_none_of(RF_ABILITY_NOMAGIC_MASK))
             return false;
     }
 
-    if (d_ptr->flags.has(DF::NO_MELEE)) {
+    if (d_ptr->flags.has(DungeonFeatureType::NO_MELEE)) {
         if (r_idx == MON_CHAMELEON)
             return true;
         if (r_ptr->ability_flags.has_none_of(RF_ABILITY_BOLT_MASK | RF_ABILITY_BEAM_MASK | RF_ABILITY_BALL_MASK)
             && r_ptr->ability_flags.has_none_of(
-                { RF_ABILITY::CAUSE_1, RF_ABILITY::CAUSE_2, RF_ABILITY::CAUSE_3, RF_ABILITY::CAUSE_4, RF_ABILITY::MIND_BLAST, RF_ABILITY::BRAIN_SMASH }))
+                { MonsterAbilityType::CAUSE_1, MonsterAbilityType::CAUSE_2, MonsterAbilityType::CAUSE_3, MonsterAbilityType::CAUSE_4, MonsterAbilityType::MIND_BLAST, MonsterAbilityType::BRAIN_SMASH }))
             return false;
     }
 
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    if (d_ptr->flags.has(DF::BEGINNER)) {
+    if (d_ptr->flags.has(DungeonFeatureType::BEGINNER)) {
         if (r_ptr->level > floor_ptr->dun_level)
             return false;
     }
 
     if (d_ptr->special_div >= 64)
         return true;
-    if (summon_specific_type && d_ptr->flags.has_not(DF::CHAMELEON))
+    if (summon_specific_type && d_ptr->flags.has_not(DungeonFeatureType::CHAMELEON))
         return true;
 
     byte a;
@@ -307,7 +307,7 @@ static errr do_get_mon_num_prep(player_type *player_ptr, const monsterrace_hook_
     int prob2_total = 0; // 重みの総和
 
     // モンスター生成テーブルの各要素について重みを修正する。
-    for (int i = 0; i < alloc_race_size; i++) {
+    for (auto i = 0U; i < alloc_race_table.size(); i++) {
         alloc_entry *const entry = &alloc_race_table[i];
         const monster_race *const r_ptr = &r_info[entry->index];
 
@@ -352,7 +352,7 @@ static errr do_get_mon_num_prep(player_type *player_ptr, const monsterrace_hook_
             //   * フェイズアウト状態でない
             //   * 1階かそれより深いところにいる
             //   * ランダムクエスト中でない
-            const bool in_random_quest = floor_ptr->inside_quest && !is_fixed_quest_idx(floor_ptr->inside_quest);
+            const bool in_random_quest = floor_ptr->inside_quest && !quest_type::is_fixed(floor_ptr->inside_quest);
             const bool cond = !player_ptr->phase_out && floor_ptr->dun_level > 0 && !in_random_quest;
 
             if (cond && !restrict_monster_to_dungeon(player_ptr, entry->index)) {