OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / cmd2.c
index afbede3..bafddf7 100644 (file)
@@ -401,19 +401,14 @@ void do_cmd_search(void)
 static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
 {
        cave_type *c_ptr = &cave[y][x];
-
        OBJECT_IDX this_o_idx, next_o_idx = 0;
 
-
        /* Scan all objects in the grid */
        for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
 
-               /* Acquire object */
                o_ptr = &o_list[this_o_idx];
-
-               /* Acquire next object */
                next_o_idx = o_ptr->next_o_idx;
 
                /* Skip unknown chests XXX XXX */
@@ -427,8 +422,6 @@ static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
                        return (this_o_idx);
                }
        }
-
-       /* No chest */
        return (0);
 }
 
@@ -498,14 +491,9 @@ static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
                /* Let the Chest drop items */
                chest_death(FALSE, y, x, o_idx);
        }
-
-       /* Result */
        return (more);
 }
 
-
-#if defined(ALLOW_EASY_OPEN) || defined(ALLOW_EASY_DISARM) /* TNB */
-
 /*!
  * @brief 地形は開くものであって、かつ開かれているかを返す /
  * Attempt to open the given chest at the given location
@@ -648,9 +636,6 @@ static DIRECTION coords_to_dir(POSITION y, POSITION x)
        return d[dx + 1][dy + 1];
 }
 
-#endif /* defined(ALLOW_EASY_OPEN) || defined(ALLOW_EASY_DISARM) -- TNB */
-
-
 /*!
  * @brief 「開ける」動作コマンドのサブルーチン /
  * Perform the basic "open" command on doors
@@ -695,7 +680,7 @@ static bool do_cmd_open_aux(POSITION y, POSITION x)
                /* Extract the lock power */
                j = f_ptr->power;
 
-               /* Extract the difficulty XXX XXX XXX */
+               /* Extract the difficulty */
                j = i - (j * 4);
 
                /* Always have a small chance of success */
@@ -736,8 +721,6 @@ static bool do_cmd_open_aux(POSITION y, POSITION x)
 
                sound(SOUND_OPENDOOR);
        }
-
-       /* Result */
        return (more);
 }
 
@@ -761,8 +744,6 @@ void do_cmd_open(void)
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
        /* Option: Pick a direction */
        if (easy_open)
        {
@@ -783,8 +764,6 @@ void do_cmd_open(void)
                }
        }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
        /* Allow repeated command */
        if (command_arg)
        {
@@ -850,7 +829,7 @@ void do_cmd_open(void)
        }
 
        /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -904,8 +883,6 @@ static bool do_cmd_close_aux(POSITION y, POSITION x)
                        }
                }
        }
-
-       /* Result */
        return (more);
 }
 
@@ -929,8 +906,6 @@ void do_cmd_close(void)
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
        /* Option: Pick a direction */
        if (easy_open)
        {
@@ -941,8 +916,6 @@ void do_cmd_close(void)
                }
        }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
        /* Allow repeated command */
        if (command_arg)
        {
@@ -957,7 +930,7 @@ void do_cmd_close(void)
        }
 
        /* Get a "repeated" direction */
-       if (get_rep_dir(&dir,FALSE))
+       if (get_rep_dir(&dir, FALSE))
        {
                cave_type *c_ptr;
                FEAT_IDX feat;
@@ -998,7 +971,7 @@ void do_cmd_close(void)
        }
 
        /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -1018,7 +991,6 @@ static bool do_cmd_tunnel_test(POSITION y, POSITION x)
        {
                msg_print(_("そこには何も見当たらない。", "You see nothing there."));
 
-               /* Nope */
                return (FALSE);
        }
 
@@ -1027,11 +999,9 @@ static bool do_cmd_tunnel_test(POSITION y, POSITION x)
        {
                msg_print(_("そこには掘るものが見当たらない。", "You see nothing there to tunnel."));
 
-               /* Nope */
                return (FALSE);
        }
 
-       /* Okay */
        return (TRUE);
 }
 
@@ -1158,8 +1128,6 @@ static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
                /* Occasional Search XXX XXX */
                if (randint0(100) < 25) search();
        }
-
-       /* Result */
        return more;
 }
 
@@ -1250,12 +1218,9 @@ void do_cmd_tunnel(void)
        }
 
        /* Cancel repetition unless we can continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
-
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
 /*!
  * @brief 移動処理による簡易な「開く」処理 /
  * easy_open_door --
@@ -1280,7 +1245,6 @@ bool easy_open_door(POSITION y, POSITION x)
        /* Must be a closed door */
        if (!is_closed_door(c_ptr->feat))
        {
-               /* Nope */
                return (FALSE);
        }
 
@@ -1305,7 +1269,7 @@ bool easy_open_door(POSITION y, POSITION x)
                /* Extract the lock power */
                j = f_ptr->power;
 
-               /* Extract the difficulty XXX XXX XXX */
+               /* Extract the difficulty */
                j = i - (j * 4);
 
                /* Always have a small chance of success */
@@ -1344,14 +1308,9 @@ bool easy_open_door(POSITION y, POSITION x)
 
                sound(SOUND_OPENDOOR);
        }
-
-       /* Result */
        return (TRUE);
 }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
-
 /*!
  * @brief 箱のトラップを解除するコマンドのメインルーチン /
  * Perform the basic "disarm" command
@@ -1430,8 +1389,6 @@ static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
                sound(SOUND_FAIL);
                chest_trap(y, x, o_idx);
        }
-
-       /* Result */
        return (more);
 }
 
@@ -1450,15 +1407,8 @@ static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
  * Returns TRUE if repeated commands may continue
  * </pre>
  */
-#ifdef ALLOW_EASY_DISARM /* TNB */
 
 bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-static bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
 {
        /* Get grid and contents */
        cave_type *c_ptr = &cave[y][x];
@@ -1500,17 +1450,8 @@ static bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
                /* Remove the trap */
                cave_alter_feat(y, x, FF_DISARM);
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
                /* Move the player onto the trap */
                move_player(dir, easy_disarm, FALSE);
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-               /* move the player onto the trap grid */
-               move_player(dir, FALSE, FALSE);
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
        }
 
        /* Failure -- Keep trying */
@@ -1529,21 +1470,9 @@ static bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
        else
        {
                msg_format(_("%sを作動させてしまった!", "You set off the %s!"), name);
-
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
                /* Move the player onto the trap */
                move_player(dir, easy_disarm, FALSE);
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-               /* Move the player onto the trap */
-               move_player(dir, FALSE, FALSE);
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
        }
-
-       /* Result */
        return (more);
 }
 
@@ -1566,7 +1495,6 @@ void do_cmd_disarm(void)
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
 
        /* Option: Pick a direction */
        if (easy_disarm)
@@ -1587,7 +1515,6 @@ void do_cmd_disarm(void)
                }
        }
 
-#endif /* ALLOW_EASY_DISARM -- TNB */
 
        /* Allow repeated command */
        if (command_arg)
@@ -1652,7 +1579,7 @@ void do_cmd_disarm(void)
        }
 
        /* Cancel repeat unless told not to */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -1693,7 +1620,7 @@ static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
 
        msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
 
-       /* Compare bash power to door power XXX XXX XXX */
+       /* Compare bash power to door power */
        temp = (bash - (temp * 10));
 
        if (p_ptr->pclass == CLASS_BERSERKER) temp *= 2;
@@ -1742,8 +1669,6 @@ static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
                /* Hack -- Lose balance ala paralysis */
                (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(2));
        }
-
-       /* Result */
        return (more);
 }
 
@@ -1834,7 +1759,7 @@ void do_cmd_bash(void)
        }
 
        /* Unless valid action taken, cancel bash */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -1847,7 +1772,7 @@ void do_cmd_bash(void)
  *
  * Attack monsters, tunnel through walls, disarm traps, open doors.
  *
- * Consider confusion XXX XXX XXX
+ * Consider confusion 
  *
  * This command must always take a turn, to prevent free detection
  * of invisible monsters.
@@ -1943,7 +1868,7 @@ void do_cmd_alter(void)
        }
 
        /* Cancel repetition unless we can continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -1955,7 +1880,7 @@ void do_cmd_alter(void)
  * @return オブジェクトがある場合TRUEを返す
  * @details
  * <pre>
- * XXX XXX XXX Let user choose a pile of spikes, perhaps?
+ * Let user choose a pile of spikes, perhaps?
  * </pre>
  */
 static bool get_spike(INVENTORY_IDX *ip)
@@ -2135,7 +2060,7 @@ void do_cmd_walk(bool pickup)
        }
 
        /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -2262,7 +2187,7 @@ void do_cmd_rest(void)
 
        if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
 
-       /* Take a turn XXX XXX XXX (?) */
+       /* Take a turn (?) */
        p_ptr->energy_use = 100;
 
        /* The sin of sloth */
@@ -2289,8 +2214,6 @@ void do_cmd_rest(void)
 
        /* Redraw the state */
        p_ptr->redraw |= (PR_STATE);
-
-       /* Handle stuff */
        handle_stuff();
 
        /* Refresh */
@@ -2804,7 +2727,6 @@ void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr)
        /* Sniper - Cannot shot a single arrow twice */
        if ((snipe_type == SP_DOUBLE) && (o_ptr->number < 2)) snipe_type = SP_NONE;
 
-       /* Describe the object */
        object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
 
        /* Use the proper number of shots */
@@ -2900,8 +2822,6 @@ void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr)
        /* Start at the player */
        y = p_ptr->y;
        x = p_ptr->x;
-
-       /* Get local object */
        q_ptr = &forge;
 
        /* Obtain a local object */
@@ -2926,8 +2846,6 @@ void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr)
        }
 
        sound(SOUND_SHOOT);
-
-       /* Hack -- Handle stuff */
        handle_stuff();
 
        /* Save the old location */
@@ -2982,10 +2900,8 @@ void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr)
                {
                        cave[ny][nx].info |= (CAVE_GLOW);
 
-                       /* Notice */
                        note_spot(ny, nx);
 
-                       /* Redraw */
                        lite_spot(ny, nx);
                }
 
@@ -3023,10 +2939,8 @@ void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr)
                {
                        cave[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK);
 
-                       /* Notice */
                        note_spot(ny, nx);
 
-                       /* Redraw */
                        lite_spot(ny, nx);
                }
 
@@ -3138,7 +3052,7 @@ void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr)
                                }
                                else
                                {
-                                       /* Apply special damage XXX XXX XXX */
+                                       /* Apply special damage */
                                        tdam = tot_dam_aux_shot(q_ptr, tdam, m_ptr);
                                        tdam = critical_shot(q_ptr->weight, q_ptr->to_h, j_ptr->to_h, tdam);
 
@@ -3168,10 +3082,8 @@ void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr)
                                {
                                        cave[ny][nx].info |= (CAVE_GLOW);
 
-                                       /* Notice */
                                        note_spot(ny, nx);
 
-                                       /* Redraw */
                                        lite_spot(ny, nx);
                                }
 
@@ -3248,7 +3160,7 @@ void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr)
                                                        m_ptr->fy = ny;
 
                                                        /* Update the monster (new location) */
-                                                       update_mon(c_mon_ptr->m_idx, TRUE);
+                                                       update_monster(c_mon_ptr->m_idx, TRUE);
 
                                                        lite_spot(ny, nx);
                                                        lite_spot(oy, ox);
@@ -3379,7 +3291,6 @@ void do_cmd_fire(void)
        /* Require proper missile */
        item_tester_tval = p_ptr->tval_ammo;
 
-       /* Get an item */
        q = _("どれを撃ちますか? ", "Fire which item? ");
        s = _("発射されるアイテムがありません。", "You have nothing to fire.");
        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR)))
@@ -3482,7 +3393,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
        }
        else
        {
-               /* Get an item */
                q = _("どのアイテムを投げますか? ", "Throw which item? ");
                s = _("投げるアイテムがない。", "You have nothing to throw.");
                if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP)))
@@ -3502,13 +3412,11 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                o_ptr = &o_list[0 - item];
        }
 
-
        /* Item is cursed */
        if (object_is_cursed(o_ptr) && (item >= INVEN_RARM))
        {
                msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
 
-               /* Nope */
                return FALSE;
        }
 
@@ -3519,13 +3427,10 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                        msg_print(_("アリーナではアイテムを使えない!", "You're in the arena now. This is hand-to-hand!"));
                        msg_print(NULL);
 
-                       /* Nope */
                        return FALSE;
                }
 
        }
-
-       /* Get local object */
        q_ptr = &forge;
 
        /* Obtain a local object */
@@ -3621,8 +3526,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
        y = p_ptr->y;
        x = p_ptr->x;
 
-
-       /* Hack -- Handle stuff */
        handle_stuff();
 
        if ((p_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
@@ -3739,7 +3642,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                                ds = q_ptr->ds;
                                torch_dice(q_ptr, &dd, &ds); /* throwing a torch */
                                tdam = damroll(dd, ds);
-                               /* Apply special damage XXX XXX XXX */
+                               /* Apply special damage */
                                tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0, TRUE);
                                tdam = critical_shot(q_ptr->weight, q_ptr->to_h, 0, tdam);
                                if (q_ptr->to_d > 0)