• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisionfbb4e4b1d568377fbba733c744ae909399a0ad26 (tree)
Time2019-07-09 23:59:32
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38997 calc_mana() に player_type * 引数を追加.

Change Summary

Incremental Difference

--- a/src/player-status.c
+++ b/src/player-status.c
@@ -4522,7 +4522,7 @@ static void calc_spells(void)
45224522 * @details
45234523 * This function induces status messages.
45244524 */
4525-static void calc_mana(void)
4525+static void calc_mana(player_type *creature_ptr)
45264526 {
45274527 int msp, levels, cur_wgt, max_wgt;
45284528
@@ -4532,49 +4532,49 @@ static void calc_mana(void)
45324532 /* Hack -- Must be literate */
45334533 if (!mp_ptr->spell_book) return;
45344534
4535- if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4536- (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
4537- (p_ptr->pclass == CLASS_BLUE_MAGE))
4535+ if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
4536+ (creature_ptr->pclass == CLASS_MIRROR_MASTER) ||
4537+ (creature_ptr->pclass == CLASS_BLUE_MAGE))
45384538 {
4539- levels = p_ptr->lev;
4539+ levels = creature_ptr->lev;
45404540 }
45414541 else
45424542 {
4543- if (mp_ptr->spell_first > p_ptr->lev)
4543+ if (mp_ptr->spell_first > creature_ptr->lev)
45444544 {
45454545 /* Save new mana */
4546- p_ptr->msp = 0;
4546+ creature_ptr->msp = 0;
45474547
45484548 /* Display mana later */
4549- p_ptr->redraw |= (PR_MANA);
4549+ creature_ptr->redraw |= (PR_MANA);
45504550 return;
45514551 }
45524552
45534553 /* Extract "effective" player level */
4554- levels = (p_ptr->lev - mp_ptr->spell_first) + 1;
4554+ levels = (creature_ptr->lev - mp_ptr->spell_first) + 1;
45554555 }
45564556
4557- if (p_ptr->pclass == CLASS_SAMURAI)
4557+ if (creature_ptr->pclass == CLASS_SAMURAI)
45584558 {
4559- msp = (adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
4559+ msp = (adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
45604560 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
45614561 }
45624562 else
45634563 {
45644564 /* Extract total mana */
4565- msp = adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] * (levels + 3) / 4;
4565+ msp = adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] * (levels + 3) / 4;
45664566
45674567 /* Hack -- usually add one mana */
45684568 if (msp) msp++;
45694569
45704570 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
45714571
4572- if (msp && (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)) msp += msp / 2;
4572+ if (msp && (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)) msp += msp / 2;
45734573
45744574 /* Hack: High mages have a 25% mana bonus */
4575- if (msp && (p_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4;
4575+ if (msp && (creature_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4;
45764576
4577- if (msp && (p_ptr->pclass == CLASS_SORCERER)) msp += msp * (25 + p_ptr->lev) / 100;
4577+ if (msp && (creature_ptr->pclass == CLASS_SORCERER)) msp += msp * (25 + creature_ptr->lev) / 100;
45784578 }
45794579
45804580 /* Only mages are affected */
@@ -4583,10 +4583,10 @@ static void calc_mana(void)
45834583 BIT_FLAGS flgs[TR_FLAG_SIZE];
45844584
45854585 /* Assume player is not encumbered by gloves */
4586- p_ptr->cumber_glove = FALSE;
4586+ creature_ptr->cumber_glove = FALSE;
45874587
45884588 /* Get the gloves */
4589- o_ptr = &p_ptr->inventory_list[INVEN_HANDS];
4589+ o_ptr = &creature_ptr->inventory_list[INVEN_HANDS];
45904590
45914591 /* Examine the gloves */
45924592 object_flags(o_ptr, flgs);
@@ -4600,7 +4600,7 @@ static void calc_mana(void)
46004600 !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0)))
46014601 {
46024602 /* Encumbered */
4603- p_ptr->cumber_glove = TRUE;
4603+ creature_ptr->cumber_glove = TRUE;
46044604
46054605 /* Reduce mana */
46064606 msp = (3 * msp) / 4;
@@ -4609,20 +4609,20 @@ static void calc_mana(void)
46094609
46104610
46114611 /* Assume player not encumbered by armor */
4612- p_ptr->cumber_armor = FALSE;
4612+ creature_ptr->cumber_armor = FALSE;
46134613
46144614 /* Weigh the armor */
46154615 cur_wgt = 0;
4616- if (p_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight;
4617- if (p_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight;
4618- cur_wgt += p_ptr->inventory_list[INVEN_BODY].weight;
4619- cur_wgt += p_ptr->inventory_list[INVEN_HEAD].weight;
4620- cur_wgt += p_ptr->inventory_list[INVEN_OUTER].weight;
4621- cur_wgt += p_ptr->inventory_list[INVEN_HANDS].weight;
4622- cur_wgt += p_ptr->inventory_list[INVEN_FEET].weight;
4616+ if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4617+ if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4618+ cur_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
4619+ cur_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
4620+ cur_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
4621+ cur_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
4622+ cur_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
46234623
46244624 /* Subtract a percentage of maximum mana. */
4625- switch (p_ptr->pclass)
4625+ switch (creature_ptr->pclass)
46264626 {
46274627 /* For these classes, mana is halved if armour
46284628 * is 30 pounds over their weight limit. */
@@ -4633,8 +4633,8 @@ static void calc_mana(void)
46334633 case CLASS_FORCETRAINER:
46344634 case CLASS_SORCERER:
46354635 {
4636- if (p_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight;
4637- if (p_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight;
4636+ if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4637+ if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
46384638 break;
46394639 }
46404640
@@ -4643,8 +4643,8 @@ static void calc_mana(void)
46434643 case CLASS_BARD:
46444644 case CLASS_TOURIST:
46454645 {
4646- if (p_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
4647- if (p_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
4646+ if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
4647+ if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
46484648 break;
46494649 }
46504650
@@ -4652,8 +4652,8 @@ static void calc_mana(void)
46524652 case CLASS_BEASTMASTER:
46534653 case CLASS_MIRROR_MASTER:
46544654 {
4655- if (p_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight / 2;
4656- if (p_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight / 2;
4655+ if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 2;
4656+ if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 2;
46574657 break;
46584658 }
46594659
@@ -4663,8 +4663,8 @@ static void calc_mana(void)
46634663 case CLASS_RED_MAGE:
46644664 case CLASS_WARRIOR_MAGE:
46654665 {
4666- if (p_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight / 3;
4667- if (p_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight / 3;
4666+ if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 3;
4667+ if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 3;
46684668 break;
46694669 }
46704670
@@ -4672,8 +4672,8 @@ static void calc_mana(void)
46724672 case CLASS_PALADIN:
46734673 case CLASS_CHAOS_WARRIOR:
46744674 {
4675- if (p_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_RARM].weight / 5;
4676- if (p_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += p_ptr->inventory_list[INVEN_LARM].weight / 5;
4675+ if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 5;
4676+ if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 5;
46774677 break;
46784678 }
46794679
@@ -4691,10 +4691,10 @@ static void calc_mana(void)
46914691 if ((cur_wgt - max_wgt) > 0)
46924692 {
46934693 /* Encumbered */
4694- p_ptr->cumber_armor = TRUE;
4694+ creature_ptr->cumber_armor = TRUE;
46954695
46964696 /* Subtract a percentage of maximum mana. */
4697- switch (p_ptr->pclass)
4697+ switch (creature_ptr->pclass)
46984698 {
46994699 /* For these classes, mana is halved if armour
47004700 * is 30 pounds over their weight limit. */
@@ -4746,7 +4746,7 @@ static void calc_mana(void)
47464746
47474747 case CLASS_SAMURAI:
47484748 {
4749- p_ptr->cumber_armor = FALSE;
4749+ creature_ptr->cumber_armor = FALSE;
47504750 break;
47514751 }
47524752
@@ -4764,28 +4764,28 @@ static void calc_mana(void)
47644764
47654765
47664766 /* Maximum mana has changed */
4767- if (p_ptr->msp != msp)
4767+ if (creature_ptr->msp != msp)
47684768 {
47694769 /* Enforce maximum */
4770- if ((p_ptr->csp >= msp) && (p_ptr->pclass != CLASS_SAMURAI))
4770+ if ((creature_ptr->csp >= msp) && (creature_ptr->pclass != CLASS_SAMURAI))
47714771 {
4772- p_ptr->csp = msp;
4773- p_ptr->csp_frac = 0;
4772+ creature_ptr->csp = msp;
4773+ creature_ptr->csp_frac = 0;
47744774 }
47754775
47764776 #ifdef JP
47774777 /* レベルアップの時は上昇量を表示する */
4778- if (p_ptr->level_up_message && (msp > p_ptr->msp))
4778+ if (creature_ptr->level_up_message && (msp > creature_ptr->msp))
47794779 {
4780- msg_format("最大マジック・ポイントが %d 増加した!", (msp - p_ptr->msp));
4780+ msg_format("最大マジック・ポイントが %d 増加した!", (msp - creature_ptr->msp));
47814781 }
47824782 #endif
47834783 /* Save new mana */
4784- p_ptr->msp = msp;
4784+ creature_ptr->msp = msp;
47854785
47864786 /* Display mana later */
4787- p_ptr->redraw |= (PR_MANA);
4788- p_ptr->window |= (PW_PLAYER | PW_SPELL);
4787+ creature_ptr->redraw |= (PR_MANA);
4788+ creature_ptr->window |= (PW_PLAYER | PW_SPELL);
47894789 }
47904790
47914791
@@ -4793,9 +4793,9 @@ static void calc_mana(void)
47934793 if (current_world_ptr->character_xtra) return;
47944794
47954795 /* Take note when "glove state" changes */
4796- if (p_ptr->old_cumber_glove != p_ptr->cumber_glove)
4796+ if (creature_ptr->old_cumber_glove != creature_ptr->cumber_glove)
47974797 {
4798- if (p_ptr->cumber_glove)
4798+ if (creature_ptr->cumber_glove)
47994799 {
48004800 msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
48014801 }
@@ -4805,14 +4805,14 @@ static void calc_mana(void)
48054805 }
48064806
48074807 /* Save it */
4808- p_ptr->old_cumber_glove = p_ptr->cumber_glove;
4808+ creature_ptr->old_cumber_glove = creature_ptr->cumber_glove;
48094809 }
48104810
48114811
48124812 /* Take note when "armor state" changes */
4813- if (p_ptr->old_cumber_armor != p_ptr->cumber_armor)
4813+ if (creature_ptr->old_cumber_armor != creature_ptr->cumber_armor)
48144814 {
4815- if (p_ptr->cumber_armor)
4815+ if (creature_ptr->cumber_armor)
48164816 {
48174817 msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
48184818 }
@@ -4822,7 +4822,7 @@ static void calc_mana(void)
48224822 }
48234823
48244824 /* Save it */
4825- p_ptr->old_cumber_armor = p_ptr->cumber_armor;
4825+ creature_ptr->old_cumber_armor = creature_ptr->cumber_armor;
48264826 }
48274827 }
48284828
@@ -5026,7 +5026,7 @@ void update_creature(player_type *creature_ptr)
50265026 if (creature_ptr->update & (PU_MANA))
50275027 {
50285028 creature_ptr->update &= ~(PU_MANA);
5029- calc_mana();
5029+ calc_mana(creature_ptr);
50305030 }
50315031
50325032 if (creature_ptr->update & (PU_SPELLS))
Show on old repository browser