OSDN Git Service

[Refactor] #37783 (2.2.1.5) 「魅了」と「支配」処理の分化作業中。 / Differentiating "charm" and "control".
[hengband/hengband.git] / src / cmd5.c
index 9af9c8b..dafb9dc 100644 (file)
@@ -64,19 +64,20 @@ bool select_the_force = FALSE;
  * The "known" should be TRUE for cast/pray, FALSE for study
  * </pre>
  */
-static int get_spell(SPELL_IDX *sn, cptr prompt, OBJECT_SUBTYPE_VALUE sval, bool learned, int use_realm)
+static int get_spell(SPELL_IDX *sn, cptr prompt, OBJECT_SUBTYPE_VALUE sval, bool learned, REALM_IDX use_realm)
 {
        int         i;
-       int         spell = -1;
+       SPELL_IDX   spell = -1;
        int         num = 0;
        int         ask = TRUE;
-       int         need_mana;
-       int         spells[64];
+       MANA_POINT  need_mana;
+       SPELL_IDX   spells[64];
        bool        flag, redraw, okay;
        char        choice;
        const magic_type  *s_ptr;
        char        out_val[160];
        cptr        p;
+       COMMAND_CODE code;
 #ifdef JP
        char jverb_buf[128];
 #endif
@@ -85,8 +86,9 @@ static int get_spell(SPELL_IDX *sn, cptr prompt, OBJECT_SUBTYPE_VALUE sval, bool
 #ifdef ALLOW_REPEAT /* TNB */
 
        /* Get the spell, if available */
-       if (repeat_pull(sn))
+       if (repeat_pull(&code))
        {
+               *sn = (SPELL_IDX)code;
                /* Verify the spell */
                if (spell_okay(*sn, learned, FALSE, use_realm))
                {
@@ -338,7 +340,7 @@ static int get_spell(SPELL_IDX *sn, cptr prompt, OBJECT_SUBTYPE_VALUE sval, bool
 
 #ifdef ALLOW_REPEAT /* TNB */
 
-       repeat_push(*sn);
+       repeat_push((COMMAND_CODE)spell);
 
 #endif /* ALLOW_REPEAT -- TNB */
 
@@ -406,13 +408,13 @@ static bool player_has_no_spellbooks(void)
  */
 static void confirm_use_force(bool browse_only)
 {
-       SPELL_IDX item;
        char which;
+       COMMAND_CODE code;
 
 #ifdef ALLOW_REPEAT
 
        /* Get the item index */
-       if (repeat_pull(&item) && (item == INVEN_FORCE))
+       if (repeat_pull(&code) && (code == INVEN_FORCE))
        {
                browse_only ? do_cmd_mind_browse() : do_cmd_mind();
                return;
@@ -466,12 +468,15 @@ static void confirm_use_force(bool browse_only)
  */
 void do_cmd_browse(void)
 {
-       int             item, sval, use_realm = 0, j, line;
+       OBJECT_IDX item;
+       OBJECT_SUBTYPE_VALUE sval;
+       REALM_IDX use_realm = 0;
+       int j, line;
        SPELL_IDX spell = -1;
-       int             num = 0;
+       int num = 0;
 
-       int             spells[64];
-       char    temp[62*4];
+       SPELL_IDX spells[64];
+       char temp[62*4];
 
        object_type     *o_ptr;
 
@@ -654,7 +659,8 @@ static void change_realm2(CHARACTER_IDX next_realm)
  */
 void do_cmd_study(void)
 {
-       int     i, item;
+       int     i;
+       OBJECT_IDX item;
        OBJECT_SUBTYPE_VALUE sval;
        int     increment = 0;
        bool    learned = FALSE;
@@ -1052,21 +1058,18 @@ static void wild_magic(int spell)
  */
 void do_cmd_cast(void)
 {
-       int     item;
+       OBJECT_IDX item;
        OBJECT_SUBTYPE_VALUE sval;
        SPELL_IDX spell;
-       IDX realm;
+       REALM_IDX realm;
        int     chance;
        int     increment = 0;
-       int     use_realm;
-       int     need_mana;
+       REALM_IDX use_realm;
+       MANA_POINT need_mana;
 
        cptr prayer;
-
        object_type     *o_ptr;
-
        const magic_type *s_ptr;
-
        cptr q, s;
 
        bool over_exerted = FALSE;
@@ -1174,9 +1177,8 @@ void do_cmd_cast(void)
 
        /* Ask for a spell */
 #ifdef JP
-       if (!get_spell(&spell,  
-                               ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "詠唱する" : (mp_ptr->spell_book == TV_MUSIC_BOOK) ? "歌う" : "唱える"), 
-                      sval, TRUE, realm))
+       if (!get_spell(&spell, ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "詠唱する" : (mp_ptr->spell_book == TV_MUSIC_BOOK) ? "歌う" : "唱える"), 
+                       sval, TRUE, realm))
        {
                if (spell == -2) msg_format("その本には知っている%sがない。", prayer);
                return;
@@ -1596,7 +1598,7 @@ void check_pets_num_and_align(monster_type *m_ptr, bool inc)
 int calculate_upkeep(void)
 {
        s32b old_friend_align = friend_align;
-       IDX m_idx;
+       MONSTER_IDX m_idx;
        bool have_a_unique = FALSE;
        s32b total_friend_levels = 0;
 
@@ -1659,14 +1661,14 @@ void do_cmd_pet_dismiss(void)
 {
        monster_type    *m_ptr;
        bool            all_pets = FALSE;
-       IDX pet_ctr;
+       MONSTER_IDX pet_ctr;
        int i;
        int Dismissed = 0;
 
-       u16b *who;
+       MONSTER_IDX *who;
        u16b dummy_why;
        int max_pet = 0;
-       int cu, cv;
+       bool_hack cu, cv;
 
        cu = Term->scr->cu;
        cv = Term->scr->cv;
@@ -1674,7 +1676,7 @@ void do_cmd_pet_dismiss(void)
        Term->scr->cv = 1;
 
        /* Allocate the "who" array */
-       C_MAKE(who, max_m_idx, u16b);
+       C_MAKE(who, max_m_idx, MONSTER_IDX);
 
        /* Process the monsters (backwards) */
        for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
@@ -1783,7 +1785,7 @@ void do_cmd_pet_dismiss(void)
        Term->scr->cv = cv;
        Term_fresh();
 
-       C_KILL(who, max_m_idx, u16b);
+       C_KILL(who, max_m_idx, MONSTER_IDX);
 
 #ifdef JP
        msg_format("%d 体のペットを放しました。", Dismissed);
@@ -1805,7 +1807,7 @@ static bool player_can_ride_aux(cave_type *c_ptr, bool now_riding)
 {
        bool p_can_enter;
        bool old_character_xtra = character_xtra;
-       int  old_riding = p_ptr->riding;
+       MONSTER_IDX old_riding = p_ptr->riding;
        bool old_riding_ryoute = p_ptr->riding_ryoute;
        bool old_old_riding_ryoute = p_ptr->old_riding_ryoute;
        bool old_pf_ryoute = (p_ptr->pet_extra_flags & PF_RYOUTE) ? TRUE : FALSE;
@@ -1844,7 +1846,7 @@ static bool player_can_ride_aux(cave_type *c_ptr, bool now_riding)
  * @param force TRUEならば強制的に落馬する
  * @return 実際に落馬したらTRUEを返す
  */
-bool rakuba(int dam, bool force)
+bool rakuba(HIT_POINT dam, bool force)
 {
        int i, y, x, oy, ox;
        int sn = 0, sy = 0, sx = 0;
@@ -2206,7 +2208,7 @@ static void do_name_pet(void)
  */
 void do_cmd_pet(void)
 {
-       SPELL_IDX i = 0;
+       COMMAND_CODE i = 0;
        int                     num;
        int                     powers[36];
        cptr                    power_desc[36];
@@ -2216,7 +2218,7 @@ void do_cmd_pet(void)
        int                     pet_ctr;
        monster_type    *m_ptr;
 
-       int mode = 0;
+       PET_COMMAND_IDX mode = 0;
 
        char buf[160];
        char target_buf[160];
@@ -2473,7 +2475,7 @@ void do_cmd_pet(void)
                        if (!redraw || use_menu)
                        {
                                byte y = 1, x = 0;
-                               int ctr = 0;
+                               PET_COMMAND_IDX ctr = 0;
 
                                /* Show list */
                                redraw = TRUE;
@@ -2520,7 +2522,7 @@ void do_cmd_pet(void)
                        ask = (isupper(choice));
 
                        /* Lowercase */
-                       if (ask) choice = tolower(choice);
+                       if (ask) choice = (char)tolower(choice);
 
                        /* Extract request */
                        i = (islower(choice) ? A2I(choice) : -1);