• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revisionb01a718aaef3bd258c9c3c2d433069ac4db86def (tree)
Time2019-06-15 17:16:21
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38997 do_cmd_activate_aux() に player_type * 引数を使用者として追加.

Change Summary

Incremental Difference

--- a/src/cmd-activate.c
+++ b/src/cmd-activate.c
@@ -345,7 +345,7 @@ const activation_type activation_info[] =
345345 * the user hits "escape" at the "direction" prompt.
346346 * </pre>
347347 */
348-void do_cmd_activate_aux(INVENTORY_IDX item)
348+void do_cmd_activate_aux(player_type *user_ptr, INVENTORY_IDX item)
349349 {
350350 DIRECTION dir;
351351 DEPTH lev;
@@ -357,7 +357,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
357357 /* Get the item (in the pack) */
358358 if (item >= 0)
359359 {
360- o_ptr = &p_ptr->inventory_list[item];
360+ o_ptr = &user_ptr->inventory_list[item];
361361 }
362362
363363 /* Get the item (on the floor) */
@@ -366,7 +366,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
366366 o_ptr = &current_floor_ptr->o_list[0 - item];
367367 }
368368
369- take_turn(p_ptr, 100);
369+ take_turn(user_ptr, 100);
370370
371371 /* Extract the item level */
372372 lev = k_info[o_ptr->k_idx].level;
@@ -383,10 +383,10 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
383383 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
384384
385385 /* Base chance of success */
386- chance = p_ptr->skill_dev;
386+ chance = user_ptr->skill_dev;
387387
388388 /* Confusion hurts skill */
389- if (p_ptr->confused) chance = chance / 2;
389+ if (user_ptr->confused) chance = chance / 2;
390390
391391 fail = lev+5;
392392 if (chance > fail) fail -= (chance - fail)*2;
@@ -394,9 +394,9 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
394394 if (fail < USE_DEVICE) fail = USE_DEVICE;
395395 if (chance < USE_DEVICE) chance = USE_DEVICE;
396396
397- if(cmd_limit_time_walk(p_ptr)) return;
397+ if(cmd_limit_time_walk(user_ptr)) return;
398398
399- if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
399+ if (user_ptr->pclass == CLASS_BERSERKER) success = FALSE;
400400 else if (chance > fail)
401401 {
402402 if (randint0(chance*2) < fail) success = FALSE;
@@ -429,7 +429,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
429429 ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
430430 {
431431 msg_print(_("燃料がない。", "It has no fuel."));
432- free_turn(p_ptr);
432+ free_turn(user_ptr);
433433 return;
434434 }
435435
@@ -443,7 +443,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
443443 {
444444 (void)activate_artifact(o_ptr);
445445
446- p_ptr->window |= (PW_INVEN | PW_EQUIP);
446+ user_ptr->window |= (PW_INVEN | PW_EQUIP);
447447
448448 /* Success */
449449 return;
@@ -452,7 +452,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
452452 /* Special items */
453453 else if (o_ptr->tval == TV_WHISTLE)
454454 {
455- if (music_singing_any()) stop_singing(p_ptr);
455+ if (music_singing_any()) stop_singing(user_ptr);
456456 if (hex_spelling_any()) stop_hex_spell_all();
457457
458458 {
@@ -467,7 +467,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
467467 /* Process the monsters (backwards) */
468468 for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
469469 {
470- if (is_pet(&current_floor_ptr->m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
470+ if (is_pet(&current_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr))
471471 who[max_pet++] = pet_ctr;
472472 }
473473
@@ -477,7 +477,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
477477 for (i = 0; i < max_pet; i++)
478478 {
479479 pet_ctr = who[i];
480- teleport_monster_to(pet_ctr, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
480+ teleport_monster_to(pet_ctr, user_ptr->y, user_ptr->x, 100, TELEPORT_PASSIVE);
481481 }
482482
483483 /* Free the "who" array */
@@ -548,9 +548,9 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
548548 {
549549 success = FALSE;
550550 if (!get_direction(&dir, FALSE, FALSE)) return;
551- if (monster_can_enter(p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
551+ if (monster_can_enter(user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
552552 {
553- if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
553+ if (place_monster_aux(0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
554554 {
555555 if (o_ptr->xtra3) current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
556556 if (o_ptr->xtra5) current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
@@ -653,7 +653,7 @@ void do_cmd_activate(void)
653653 if (!choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return;
654654
655655 /* Activate the item */
656- do_cmd_activate_aux(item);
656+ do_cmd_activate_aux(p_ptr, item);
657657 }
658658
659659 /*!
--- a/src/cmd-activate.h
+++ b/src/cmd-activate.h
@@ -1,7 +1,7 @@
11 #pragma once
22
33 extern void do_cmd_activate(void);
4-extern void do_cmd_activate_aux(INVENTORY_IDX item);
4+extern void do_cmd_activate_aux(player_type *user_ptr, INVENTORY_IDX item);
55 extern bool activate_artifact(object_type * o_ptr);
66
77 typedef struct {
--- a/src/cmd-item.c
+++ b/src/cmd-item.c
@@ -1610,7 +1610,7 @@ void do_cmd_use(void)
16101610 /* Activate an artifact */
16111611 default:
16121612 {
1613- do_cmd_activate_aux(item);
1613+ do_cmd_activate_aux(p_ptr, item);
16141614 break;
16151615 }
16161616 }
Show on old repository browser