OSDN Git Service

[Refactor] #38997 monster_can_*()にplayer_type * 引数を追加 / Added player_type * argument...
[hengband/hengband.git] / src / cmd / cmd-activate.c
index 14fa598..4bf735f 100644 (file)
@@ -377,23 +377,23 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
        /* Confusion hurts skill */
        if (user_ptr->confused) chance = chance / 2;
 
-       fail = lev+5;
-       if (chance > fail) fail -= (chance - fail)*2;
-       else chance -= (fail - chance)*2;
+       fail = lev + 5;
+       if (chance > fail) fail -= (chance - fail) * 2;
+       else chance -= (fail - chance) * 2;
        if (fail < USE_DEVICE) fail = USE_DEVICE;
        if (chance < USE_DEVICE) chance = USE_DEVICE;
 
-       if(cmd_limit_time_walk(user_ptr)) return;
+       if (cmd_limit_time_walk(user_ptr)) return;
 
        if (user_ptr->pclass == CLASS_BERSERKER) success = FALSE;
        else if (chance > fail)
        {
-               if (randint0(chance*2) < fail) success = FALSE;
+               if (randint0(chance * 2) < fail) success = FALSE;
                else success = TRUE;
        }
        else
        {
-               if (randint0(fail*2) < chance) success = TRUE;
+               if (randint0(fail * 2) < chance) success = TRUE;
                else success = FALSE;
        }
 
@@ -457,7 +457,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                        for (pet_ctr = user_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
                        {
                                if (is_pet(&user_ptr->current_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr))
-                                 who[max_pet++] = pet_ctr;
+                                       who[max_pet++] = pet_ctr;
                        }
 
                        ang_sort(who, &dummy_why, max_pet, ang_sort_comp_pet, ang_sort_swap_hook);
@@ -477,7 +477,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
        }
        else if (o_ptr->tval == TV_CAPTURE)
        {
-               if(!o_ptr->pval)
+               if (!o_ptr->pval)
                {
                        bool old_target_pet = target_pet;
                        target_pet = TRUE;
@@ -488,7 +488,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                        }
                        target_pet = old_target_pet;
 
-                       if(fire_ball(user_ptr, GF_CAPTURE, dir, 0, 0))
+                       if (fire_ball(user_ptr, GF_CAPTURE, dir, 0, 0))
                        {
                                o_ptr->pval = (PARAMETER_VALUE)cap_mon;
                                o_ptr->xtra3 = (XTRA8)cap_mspeed;
@@ -503,7 +503,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                                        if (o_ptr->inscription)
                                                strcpy(buf, quark_str(o_ptr->inscription));
                                        s = buf;
-                                       for (s = buf;*s && (*s != '#'); s++)
+                                       for (s = buf; *s && (*s != '#'); s++)
                                        {
 #ifdef JP
                                                if (iskanji(*s)) s++;
@@ -512,7 +512,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                                        *s = '#';
                                        s++;
 #ifdef JP
- /*nothing*/
                                      /*nothing*/
 #else
                                        *s++ = '\'';
 #endif
@@ -524,7 +524,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                                                t++;
                                        }
 #ifdef JP
- /*nothing*/
                                      /*nothing*/
 #else
                                        *s++ = '\'';
 #endif
@@ -537,9 +537,9 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                {
                        success = FALSE;
                        if (!get_direction(user_ptr, &dir, FALSE, FALSE)) return;
-                       if (monster_can_enter(user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
+                       if (monster_can_enter(user_ptr, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
                        {
-                               if (place_monster_aux(0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
+                               if (place_monster_aux(user_ptr, 0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
                                {
                                        if (o_ptr->xtra3) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
                                        if (o_ptr->xtra5) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
@@ -555,7 +555,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
 #endif
 
                                                t = quark_str(o_ptr->inscription);
-                                               for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
+                                               for (t = quark_str(o_ptr->inscription); *t && (*t != '#'); t++)
                                                {
 #ifdef JP
                                                        if (iskanji(*t)) t++;
@@ -568,13 +568,13 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
 #ifdef JP
                                                        /* nothing */
 #else
-                                                       if (*t =='\'')
+                                                       if (*t == '\'')
                                                        {
                                                                t++;
                                                                quote = TRUE;
                                                        }
 #endif
-                                                       while(*t)
+                                                       while (*t)
                                                        {
                                                                *s = *t;
                                                                t++;
@@ -583,14 +583,14 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
 #ifdef JP
                                                        /* nothing */
 #else
-                                                       if (quote && *(s-1) =='\'')
+                                                       if (quote && *(s - 1) == '\'')
                                                                s--;
 #endif
                                                        *s = '\0';
                                                        user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf);
                                                        t = quark_str(o_ptr->inscription);
                                                        s = buf;
-                                                       while(*t && (*t != '#'))
+                                                       while (*t && (*t != '#'))
                                                        {
                                                                *s = *t;
                                                                t++;
@@ -1189,14 +1189,14 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
        case ACT_SUMMON_ANIMAL:
        {
-               (void)summon_specific(-1, user_ptr->y, user_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
+               (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
                break;
        }
 
        case ACT_SUMMON_PHANTOM:
        {
                msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
-               (void)summon_specific(-1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
+               (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
                break;
        }
 
@@ -1221,7 +1221,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_SUMMON_DAWN:
        {
                msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
-               (void)summon_specific(-1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
+               (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
                break;
        }
 
@@ -1483,7 +1483,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_RUNE_EXPLO:
        {
                msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
-               explosive_rune(user_ptr->current_floor_ptr, user_ptr->y, user_ptr->x);
+               explosive_rune(user_ptr, user_ptr->y, user_ptr->x);
                break;
        }
 
@@ -1807,5 +1807,3 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
        return TRUE;
 }
-
-