OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / cmd1.c
index a799de9..f420d21 100644 (file)
@@ -370,8 +370,7 @@ static void discover_hidden_things(POSITION y, POSITION x)
 
                msg_print(_("トラップを発見した。", "You have found a trap."));
 
-               /* Disturb */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
        }
 
        /* Secret door */
@@ -382,8 +381,7 @@ static void discover_hidden_things(POSITION y, POSITION x)
                /* Disclose */
                disclose_grid(y, x);
 
-               /* Disturb */
-               disturb(0, 0);
+               disturb(FALSE, FALSE);
        }
 
        /* Scan all objects in the grid */
@@ -412,7 +410,7 @@ static void discover_hidden_things(POSITION y, POSITION x)
                        object_known(o_ptr);
 
                        /* Notice it */
-                       disturb(0, 0);
+                       disturb(FALSE, FALSE);
                }
        }
 }
@@ -477,7 +475,6 @@ void py_pickup_aux(OBJECT_IDX o_idx)
        o_ptr = &o_list[o_idx];
 
 #ifdef JP
-       /* Describe the object */
        object_desc(old_name, o_ptr, OD_NAME_ONLY);
        object_desc_kosuu(kazu_str, o_ptr);
        hirottakazu = o_ptr->number;
@@ -488,7 +485,6 @@ void py_pickup_aux(OBJECT_IDX o_idx)
        /* Get the object again */
        o_ptr = &inventory[slot];
 
-       /* Delete the object */
        delete_object_idx(o_idx);
 
        if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
@@ -502,7 +498,6 @@ void py_pickup_aux(OBJECT_IDX o_idx)
                if (o_ptr->marked & OM_AUTODESTROY) return;
        }
 
-       /* Describe the object */
        object_desc(o_name, o_ptr, 0);
 
 #ifdef JP
@@ -565,7 +560,6 @@ void carry(bool pickup)
        /* Redraw map */
        p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
        p_ptr->window |= (PW_OVERHEAD);
 
        /* Handle stuff */
@@ -574,17 +568,12 @@ void carry(bool pickup)
        /* Automatically pickup/destroy/inscribe items */
        autopick_pickup_items(c_ptr);
 
-
-#ifdef ALLOW_EASY_FLOOR
-
        if (easy_floor)
        {
                py_pickup_floor(pickup);
                return;
        }
 
-#endif /* ALLOW_EASY_FLOOR */
-
        /* Scan the pile of objects */
        for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
@@ -604,14 +593,13 @@ void carry(bool pickup)
 
 #endif /* ALLOW_EASY_SENSE -- TNB */
 
-               /* Describe the object */
                object_desc(o_name, o_ptr, 0);
 
                /* Acquire next object */
                next_o_idx = o_ptr->next_o_idx;
 
                /* Hack -- disturb */
-               disturb(0, 0);
+               disturb(FALSE, FALSE);
 
                /* Pick up gold */
                if (o_ptr->tval == TV_GOLD)
@@ -632,7 +620,6 @@ void carry(bool pickup)
                        /* Redraw gold */
                        p_ptr->redraw |= (PR_GOLD);
 
-                       /* Window stuff */
                        p_ptr->window |= (PW_PLAYER);
                }
 
@@ -645,7 +632,6 @@ void carry(bool pickup)
                                /* Clear the flag. */
                                o_ptr->marked &= ~OM_NOMSG;
                        }
-                       /* Describe the object */
                        else if (!pickup)
                        {
                                msg_format(_("%sがある。", "You see %s."), o_name);
@@ -910,7 +896,6 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
 
                p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE);
 
-               /* Window stuff */
                p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
                /* Remove "unsafe" flag */
@@ -969,8 +954,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
        /* Handle "store doors" */
        if (have_flag(f_ptr->flags, FF_STORE))
        {
-               /* Disturb */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
                p_ptr->energy_use = 0;
                /* Hack -- Enter store */
@@ -980,8 +964,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
        /* Handle "building doors" -KMW- */
        else if (have_flag(f_ptr->flags, FF_BLDG))
        {
-               /* Disturb */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
                p_ptr->energy_use = 0;
                /* Hack -- Enter building */
@@ -991,8 +974,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
        /* Handle quest areas -KMW- */
        else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
        {
-               /* Disturb */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
                p_ptr->energy_use = 0;
                /* Hack -- Enter quest level */
@@ -1019,8 +1001,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
        /* Set off a trap */
        else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING))
        {
-               /* Disturb */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
                /* Hidden trap */
                if (c_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
@@ -1052,7 +1033,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
                                msg_print(_("* 注意:この先はトラップの感知範囲外です! *", "*Leaving trap detect region!*"));
                        }
 
-                       if (disturb_trap_detect) disturb(0, 1);
+                       if (disturb_trap_detect) disturb(FALSE, TRUE);
                }
        }
 
@@ -1064,7 +1045,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
  * @param feat 地形ID
  * @return トラップが自動的に無効ならばTRUEを返す
  */
-bool trap_can_be_ignored(int feat)
+bool trap_can_be_ignored(FEAT_IDX feat)
 {
        feature_type *f_ptr = &f_info[feat];
 
@@ -1314,7 +1295,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        msg_print(_("動けない!", "Can't move!"));
                        p_ptr->energy_use = 0;
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
                else if (MON_MONFEAR(riding_m_ptr))
                {
@@ -1326,12 +1307,12 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        /* Dump a message */
                        msg_format(_("%sが恐怖していて制御できない。", "%^s is too scared to control."), steed_name);
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
                else if (p_ptr->riding_ryoute)
                {
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
                else if (have_flag(f_ptr->flags, FF_CAN_FLY) && (riding_r_ptr->flags7 & RF7_CAN_FLY))
                {
@@ -1348,21 +1329,21 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        msg_format(_("%sの上に行けない。", "Can't swim."), f_name + f_info[get_feat_mimic(c_ptr)].name);
                        p_ptr->energy_use = 0;
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
                else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
                {
                        msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name);
                        p_ptr->energy_use = 0;
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
                else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
                {
                        msg_format(_("%sの上に行けない。", "Too hot to go through."), f_name + f_info[get_feat_mimic(c_ptr)].name);
                        p_ptr->energy_use = 0;
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
 
                if (oktomove && MON_STUNNED(riding_m_ptr) && one_in_(2))
@@ -1371,7 +1352,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        monster_desc(steed_name, riding_m_ptr, 0);
                        msg_format(_("%sが朦朧としていてうまく動けない!", "You cannot control stunned %s!"), steed_name);
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
        }
 
@@ -1397,7 +1378,6 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation && (!p_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) p_ptr->energy_use *= 2;
        }
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
 
        /* Disarm a visible trap */
        else if ((do_pickup != easy_disarm) && have_flag(f_ptr->flags, FF_DISARM) && !c_ptr->mimic)
@@ -1409,7 +1389,6 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                }
        }
 
-#endif /* ALLOW_EASY_DISARM -- TNB */
 
        /* Player can not walk through "walls" unless in wraith form...*/
        else if (!p_can_enter && !p_can_kill_walls)
@@ -1459,10 +1438,8 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        /* Wall (or secret door) */
                        else
                        {
-#ifdef ALLOW_EASY_OPEN
                                /* Closed doors */
                                if (easy_open && is_closed_door(feat) && easy_open_door(y, x)) return;
-#endif /* ALLOW_EASY_OPEN */
 
 #ifdef JP
                                msg_format("%sが行く手をはばんでいる。", name);
@@ -1481,8 +1458,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        }
                }
 
-               /* Disturb the player */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
                if (!boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) sound(SOUND_HITWALL);
        }
@@ -1496,7 +1472,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                }
 
                /* To avoid a loop with running */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
                oktomove = FALSE;
        }
@@ -1541,16 +1517,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
 
                /* sound(SOUND_WALK); */
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
                if (do_pickup != always_pickup) mpe_mode |= MPE_DO_PICKUP;
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-               if (do_pickup) mpe_mode |= MPE_DO_PICKUP;
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
-
                if (break_trap) mpe_mode |= MPE_BREAK_TRAP;
 
                /* Move the player */
@@ -1634,21 +1601,15 @@ static bool see_nothing(DIRECTION dir, POSITION y, POSITION x)
 }
 
 
-
-
-
-
 /*
  * Hack -- allow quick "cycling" through the legal directions
  */
-static byte cycle[] =
-{ 1, 2, 3, 6, 9, 8, 7, 4, 1, 2, 3, 6, 9, 8, 7, 4, 1 };
+static byte cycle[] = { 1, 2, 3, 6, 9, 8, 7, 4, 1, 2, 3, 6, 9, 8, 7, 4, 1 };
 
 /*
  * Hack -- map each direction into the "middle" of the "cycle[]" array
  */
-static byte chome[] =
-{ 0, 8, 9, 10, 7, 0, 11, 6, 5, 4 };
+static byte chome[] = { 0, 8, 9, 10, 7, 0, 11, 6, 5, 4 };
 
 /*
  * The direction we are running
@@ -1671,8 +1632,6 @@ static bool find_openarea;
 static bool find_breakright;
 static bool find_breakleft;
 
-
-
 /*!
  * @brief ダッシュ処理の導入 /
  * Initialize the running algorithm for a new direction.
@@ -1691,9 +1650,8 @@ static bool find_breakleft;
  */
 static void run_init(DIRECTION dir)
 {
-       int             row, col, deepleft, deepright;
-       int             i, shortleft, shortright;
-
+       int row, col, deepleft, deepright;
+       int i, shortleft, shortright;
 
        /* Save the direction */
        find_current = dir;
@@ -1791,11 +1749,11 @@ static void run_init(DIRECTION dir)
  */
 static bool run_test(void)
 {
-       int         prev_dir, new_dir, check_dir = 0;
-       int         row, col;
-       int         i, max, inv;
-       int         option = 0, option2 = 0;
-       cave_type   *c_ptr;
+       DIRECTION prev_dir, new_dir, check_dir = 0;
+       int row, col;
+       int i, max, inv;
+       int option = 0, option2 = 0;
+       cave_type *c_ptr;
        FEAT_IDX feat;
        feature_type *f_ptr;
 
@@ -2141,13 +2099,11 @@ void run_step(DIRECTION dir)
 
                        msg_print(_("その方向には走れません。", "You cannot run in that direction."));
 
-                       /* Disturb */
-                       disturb(0, 0);
+                       disturb(FALSE, FALSE);
 
                        return;
                }
 
-               /* Initialize */
                run_init(dir);
        }
 
@@ -2157,8 +2113,7 @@ void run_step(DIRECTION dir)
                /* Update run */
                if (run_test())
                {
-                       /* Disturb */
-                       disturb(0, 0);
+                       disturb(FALSE, FALSE);
 
                        return;
                }
@@ -2171,21 +2126,13 @@ void run_step(DIRECTION dir)
        p_ptr->energy_use = 100;
 
        /* Move the player, using the "pickup" flag */
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
        move_player(find_current, FALSE, FALSE);
 
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-       move_player(find_current, always_pickup, FALSE);
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
-
        if (player_bold(p_ptr->run_py, p_ptr->run_px))
        {
                p_ptr->run_py = 0;
                p_ptr->run_px = 0;
-               disturb(0, 0);
+               disturb(FALSE, FALSE);
        }
 }
 
@@ -2200,7 +2147,7 @@ void run_step(DIRECTION dir)
  */
 static DIRECTION travel_test(DIRECTION prev_dir)
 {
-       int new_dir = 0;
+       DIRECTION new_dir = 0;
        int i, max;
        const cave_type *c_ptr;
        int cost;
@@ -2245,8 +2192,8 @@ static DIRECTION travel_test(DIRECTION prev_dir)
                DIRECTION dir = cycle[chome[prev_dir] + i];
 
                /* New location */
-               int row = p_ptr->y + ddy[dir];
-               int col = p_ptr->x + ddx[dir];
+               POSITION row = p_ptr->y + ddy[dir];
+               POSITION col = p_ptr->x + ddx[dir];
 
                /* Access grid */
                c_ptr = &cave[row][col];
@@ -2302,7 +2249,6 @@ void travel_step(void)
        /* Get travel direction */
        travel.dir = travel_test(travel.dir);
 
-       /* disturb */
        if (!travel.dir)
        {
                if (travel.run == 255)
@@ -2310,7 +2256,7 @@ void travel_step(void)
                        msg_print(_("道筋が見つかりません!", "No route is found!"));
                        travel.y = travel.x = 0;
                }
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
                return;
        }