OSDN Git Service

[Refactor] #37353 コメント整理。 / Refactor comments.
[hengband/hengband.git] / src / racial.c
index 6d388a4..7d98c1a 100644 (file)
 #include "cmd-magiceat.h"
 #include "cmd-zapwand.h"
 #include "cmd-pet.h"
-
+#include "melee.h"
 #include "object-hook.h"
 
+#include "mutation.h"
+
 /*!
  * @brief レイシャル「弾/矢の製造」処理 / do_cmd_cast calls this function if the player's class is 'archer'.
  * Hook to determine if an object is contertible in an arrow/bolt
@@ -31,7 +33,7 @@ static bool do_cmd_archer(void)
        object_type     *q_ptr;
 
        char com[80];
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        q_ptr = &forge;
 
@@ -129,26 +131,16 @@ static bool do_cmd_archer(void)
        else if (ext == 2)
        {
                OBJECT_IDX item;
-               cptr q, s;
+               concptr q, s;
                s16b slot;
 
                item_tester_hook = item_tester_hook_convertible;
 
                q = _("どのアイテムから作りますか? ", "Convert which item? ");
                s = _("材料を持っていない。", "You have no item to convert.");
-               if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
+               q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+               if (!q_ptr) return FALSE;
 
-               /* Get the item (in the pack) */
-               if (item >= 0)
-               {
-                       q_ptr = &inventory[item];
-               }
-
-               /* Get the item (on the floor) */
-               else
-               {
-                       q_ptr = &o_list[0 - item];
-               }
                q_ptr = &forge;
 
                /* Hack -- Give the player some small firestones */
@@ -185,26 +177,17 @@ static bool do_cmd_archer(void)
        else if (ext == 3)
        {
                OBJECT_IDX item;
-               cptr q, s;
+               concptr q, s;
                s16b slot;
 
                item_tester_hook = item_tester_hook_convertible;
 
                q = _("どのアイテムから作りますか? ", "Convert which item? ");
                s = _("材料を持っていない。", "You have no item to convert.");
-               if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
 
-               /* Get the item (in the pack) */
-               if (item >= 0)
-               {
-                       q_ptr = &inventory[item];
-               }
+               q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+               if (!q_ptr) return FALSE;
 
-               /* Get the item (on the floor) */
-               else
-               {
-                       q_ptr = &o_list[0 - item];
-               }
                q_ptr = &forge;
 
                /* Hack -- Give the player some small firestones */
@@ -249,9 +232,9 @@ bool gain_magic(void)
        OBJECT_IDX item;
        PARAMETER_VALUE pval;
        int ext = 0;
-       cptr q, s;
+       concptr q, s;
        object_type *o_ptr;
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        /* Only accept legal items */
        item_tester_hook = item_tester_hook_recharge;
@@ -259,19 +242,8 @@ bool gain_magic(void)
        q = _("どのアイテムの魔力を取り込みますか? ", "Gain power of which item? ");
        s = _("魔力を取り込めるアイテムがない。", "You have nothing to gain power.");
 
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+       if (!o_ptr) return (FALSE);
 
        if (o_ptr->tval == TV_STAFF && o_ptr->sval == SV_STAFF_NOTHING)
        {
@@ -279,7 +251,6 @@ bool gain_magic(void)
                return FALSE;
        }
 
-
        if (!object_is_known(o_ptr))
        {
                msg_print(_("鑑定されていないと取り込めない。", "You need to identify before absorbing."));
@@ -579,7 +550,7 @@ typedef struct power_desc_type power_desc_type;
  */
 struct power_desc_type
 {
-       char name[80];      //!<レイシャル名
+       GAME_TEXT name[MAX_NLEN];      //!<レイシャル名
        PLAYER_LEVEL level;     //!<体得レベル
        int cost;
        int stat;
@@ -745,7 +716,7 @@ static bool cmd_racial_power_aux(s32b command)
                        int i;
                        cave_type *c_ptr;
 
-                       for (i = 0; i < 6; i++)
+                       for (i = 0; i < A_MAX; i++)
                        {
                                dir = randint0(8);
                                y = p_ptr->y + ddy_ddd[dir];
@@ -954,7 +925,7 @@ static bool cmd_racial_power_aux(s32b command)
                        }
                        else if (command == -4)
                        {
-                               project_hack(GF_CHARM_LIVING, p_ptr->lev);
+                               project_all_los(GF_CHARM_LIVING, p_ptr->lev);
                        }
                        break;
                }
@@ -1045,7 +1016,7 @@ static bool cmd_racial_power_aux(s32b command)
                }
                case CLASS_CAVALRY:
                {
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
                        monster_type *m_ptr;
                        monster_race *r_ptr;
                        int rlev;
@@ -1085,7 +1056,7 @@ static bool cmd_racial_power_aux(s32b command)
                }
                case CLASS_BERSERKER:
                {
-                       if (!word_of_recall()) return FALSE;
+                       if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
                        break;
                }
                case CLASS_SMITH:
@@ -1304,7 +1275,7 @@ static bool cmd_racial_power_aux(s32b command)
                case RACE_DRACONIAN:
                        {
                                int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
-                               cptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
+                               concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
 
                                if (!get_aim_dir(&dir)) return FALSE;
 
@@ -1550,6 +1521,7 @@ void do_cmd_racial_power(void)
        char            out_val[160];
        int menu_line = (use_menu ? 1 : 0);
 
+       if (p_ptr->wild_mode) return;
 
        for (num = 0; num < 36; num++)
        {
@@ -2650,8 +2622,6 @@ if (!repeat_pull(&i) || i<0 || i>=num) {
                        {
                                /* Hide list */
                                redraw = FALSE;
-
-                               /* Restore the screen */
                                screen_load();
                        }
 
@@ -2707,8 +2677,6 @@ if (!repeat_pull(&i) || i<0 || i>=num) {
                /* Stop the loop */
                flag = TRUE;
        }
-
-       /* Restore the screen */
        if (redraw) screen_load();
 
        /* Abort if needed */