OSDN Git Service

Merge branch 'For2.2.2-Refactoring' into For2.2.2-Fix-Hourier
authorHourier <hourier@users.sourceforge.jp>
Sun, 9 Feb 2020 13:44:05 +0000 (22:44 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 9 Feb 2020 13:44:05 +0000 (22:44 +0900)
src/autopick.c
src/combat/melee1.c
src/floor-generate.c
src/floor.c
src/monster-process.c
src/monster1.c
src/spells3.c
src/wild.c

index ae99a83..b47cc5a 100644 (file)
@@ -1930,7 +1930,7 @@ void autopick_pickup_items(player_type* player_ptr, grid_type *g_ptr)
                int idx = is_autopick(player_ptr, o_ptr);
                auto_inscribe_item(player_ptr, o_ptr, idx);
                bool is_auto_pickup = idx >= 0;
-               is_auto_pickup &= autopick_list[idx].action & (DO_AUTOPICK | DO_QUERY_AUTOPICK);
+               is_auto_pickup &= (autopick_list[idx].action & (DO_AUTOPICK | DO_QUERY_AUTOPICK)) != 0;
                if (!is_auto_pickup)
                {
                        auto_destroy_item(player_ptr, o_ptr, idx);
@@ -3956,7 +3956,8 @@ static void draw_text_editor(player_type *player_ptr, text_body_type *tb)
                Term_erase(0, i + 1, tb->wid);
        }
 
-       bool is_updated = tb->old_cy != tb->cy || (tb->dirty_flags & (DIRTY_ALL | DIRTY_NOT_FOUND | DIRTY_NO_SEARCH)) || tb->dirty_line == tb->cy;
+       bool is_dirty_diary = (tb->dirty_flags & (DIRTY_ALL | DIRTY_NOT_FOUND | DIRTY_NO_SEARCH)) != 0;
+       bool is_updated = tb->old_cy != tb->cy || is_dirty_diary || tb->dirty_line == tb->cy;
        if (is_updated) return;
 
        autopick_type an_entry, *entry = &an_entry;
index a04bc45..110fdd1 100644 (file)
@@ -1212,7 +1212,7 @@ static void natural_attack(player_type *attacker_ptr, MONSTER_IDX m_idx, int att
        int bonus = attacker_ptr->to_h_m + (attacker_ptr->lev * 6 / 5);
        int chance = (attacker_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
 
-       bool is_hit = !(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2);
+       bool is_hit = ((r_ptr->flags2 & RF2_QUANTUM) == 0) || !randint0(2);
        is_hit &= test_hit_norm(attacker_ptr, chance, r_ptr->ac, m_ptr->ml);
        if (!is_hit)
        {
index e8ed74f..fc017e5 100644 (file)
@@ -1021,7 +1021,7 @@ static bool cave_gen(player_type *player_ptr, concptr *why)
 
        bool is_empty_or_dark = dun->empty_level;
        is_empty_or_dark &= !one_in_(DARK_EMPTY) || (randint1(100) > floor_ptr->dun_level);
-       is_empty_or_dark &= !(dungeon_ptr->flags1 & DF1_DARKNESS);
+       is_empty_or_dark &= (dungeon_ptr->flags1 & DF1_DARKNESS) == 0;
        if (!is_empty_or_dark) return TRUE;
 
        /* Lite the floor_ptr->grid_array */
index 6d667d9..ac22a16 100644 (file)
@@ -994,7 +994,7 @@ void try_door(player_type *player_ptr, POSITION y, POSITION x)
 
        bool can_place_door = randint0(100) < dun_tun_jct;
        can_place_door &= possible_doorway(floor_ptr, y, x);
-       can_place_door &= !(d_info[player_ptr->dungeon_idx].flags1 & DF1_NO_DOORS);
+       can_place_door &= (d_info[player_ptr->dungeon_idx].flags1 & DF1_NO_DOORS) == 0;
        if (can_place_door)
        {
                place_random_door(player_ptr, y, x, FALSE);
index e332835..106284a 100644 (file)
@@ -2187,8 +2187,10 @@ void process_monster(player_type *target_ptr, MONSTER_IDX m_idx)
 
                /* Take or Kill objects on the floor */
                bool is_takable_or_killable = g_ptr->o_idx > 0;
-               is_takable_or_killable &= (r_ptr->flags2 & (RF2_TAKE_ITEM | RF2_KILL_ITEM));
-               is_takable_or_killable &= !is_pet(m_ptr) || ((target_ptr->pet_extra_flags & PF_PICKUP_ITEMS) && (r_ptr->flags2 & RF2_TAKE_ITEM));
+               is_takable_or_killable &= (r_ptr->flags2 & (RF2_TAKE_ITEM | RF2_KILL_ITEM)) != 0;
+               bool is_pickup_items = (target_ptr->pet_extra_flags & PF_PICKUP_ITEMS) != 0;
+               is_pickup_items &= (r_ptr->flags2 & RF2_TAKE_ITEM) != 0;
+               is_takable_or_killable &= !is_pet(m_ptr) || is_pickup_items;
                if (!is_takable_or_killable)
                {
                        if (do_turn) break;
index f7fbf5d..5641b79 100644 (file)
@@ -2711,7 +2711,7 @@ void monster_death(player_type *player_ptr, MONSTER_IDX m_idx, bool drop_item)
 
        floor_ptr->object_level = floor_ptr->base_level;
        coin_type = 0;
-       bool visible = (m_ptr->ml && !player_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE);
+       bool visible = (m_ptr->ml && !player_ptr->image) || ((r_ptr->flags1 & RF1_UNIQUE) != 0);
        if (visible && (dump_item || dump_gold))
        {
                lore_treasure(player_ptr, m_idx, dump_item, dump_gold);
index 511a000..0978907 100644 (file)
@@ -428,7 +428,7 @@ void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
                }
 
                bool is_anywhere = current_world_ptr->wizard;
-               is_anywhere &= !(mode & TELEPORT_PASSIVE);
+               is_anywhere &= (mode & TELEPORT_PASSIVE) == 0;
                is_anywhere &= (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx > 0) ||
                        creature_ptr->current_floor_ptr->grid_array[y][x].m_idx == creature_ptr->riding;
                if (is_anywhere) break;
@@ -459,7 +459,7 @@ void teleport_away_followable(player_type *tracer_ptr, MONSTER_IDX m_idx)
 
        bool is_followable = old_ml;
        is_followable &= old_cdis <= MAX_SIGHT;
-       is_followable &= !current_world_ptr->timewalk_m_idx;
+       is_followable &= !current_world_ptr->timewalk_m_idx > 0;
        is_followable &= !tracer_ptr->phase_out;
        is_followable &= los(tracer_ptr, tracer_ptr->y, tracer_ptr->x, oldfy, oldfx);
        if (!is_followable) return;
index 726f7b1..81654d5 100644 (file)
@@ -428,9 +428,14 @@ static void generate_area(player_type *player_ptr, POSITION y, POSITION x, bool
                }
        }
 
-       bool is_winner = wilderness[y][x].entrance;
-       is_winner &= !wilderness[y][x].town;
-       is_winner &= (current_world_ptr->total_winner || !(d_info[wilderness[y][x].entrance].flags1 & DF1_WINNER));
+       /*
+        * 本来は '> 0'で良いと思われるがエンバグするのも怖いので'!= 0'と記載する
+        * 問題なければ'> 0'へ置き換えること
+        */
+       bool is_winner = wilderness[y][x].entrance != 0;
+       is_winner &= !wilderness[y][x].town != 0;
+       bool is_wild_winner = (d_info[wilderness[y][x].entrance].flags1 & DF1_WINNER) == 0;
+       is_winner &= ((current_world_ptr->total_winner != 0) || is_wild_winner);
        if (!is_winner) return;
 
        /* Hack -- Backup the RNG state */