• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisionca54d42ec07e8369de612dfc3dd0e4e998841d0e (tree)
Time2019-07-13 19:57:48
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/player-status.c
+++ b/src/player-status.c
@@ -3916,10 +3916,10 @@ void calc_bonuses(player_type *creature_ptr)
39163916 }
39173917
39183918
3919-static void calc_alignment(void)
3919+static void calc_alignment(player_type *creature_ptr)
39203920 {
39213921 MONSTER_IDX m_idx;
3922- p_ptr->align = 0;
3922+ creature_ptr->align = 0;
39233923 int i, j, neutral[2];
39243924
39253925 for (m_idx = current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
@@ -3932,51 +3932,51 @@ static void calc_alignment(void)
39323932
39333933 if (is_pet(m_ptr))
39343934 {
3935- if (r_ptr->flags3 & RF3_GOOD) p_ptr->align += r_ptr->level;
3936- if (r_ptr->flags3 & RF3_EVIL) p_ptr->align -= r_ptr->level;
3935+ if (r_ptr->flags3 & RF3_GOOD) creature_ptr->align += r_ptr->level;
3936+ if (r_ptr->flags3 & RF3_EVIL) creature_ptr->align -= r_ptr->level;
39373937 }
39383938 }
39393939
3940- if (p_ptr->mimic_form)
3940+ if (creature_ptr->mimic_form)
39413941 {
3942- switch (p_ptr->mimic_form)
3942+ switch (creature_ptr->mimic_form)
39433943 {
39443944 case MIMIC_DEMON:
3945- p_ptr->align -= 200;
3945+ creature_ptr->align -= 200;
39463946 break;
39473947 case MIMIC_DEMON_LORD:
3948- p_ptr->align -= 200;
3948+ creature_ptr->align -= 200;
39493949 break;
39503950 }
39513951 }
39523952 else
39533953 {
3954- switch (p_ptr->prace)
3954+ switch (creature_ptr->prace)
39553955 {
39563956 case RACE_ANGEL:
3957- p_ptr->align += 200;
3957+ creature_ptr->align += 200;
39583958 break;
39593959 case RACE_DEMON:
3960- p_ptr->align -= 200;
3960+ creature_ptr->align -= 200;
39613961 break;
39623962 }
39633963 }
39643964
39653965 for (i = 0; i < 2; i++)
39663966 {
3967- if (has_melee_weapon(p_ptr, INVEN_RARM + i))
3967+ if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
39683968 {
3969- if (p_ptr->inventory_list[INVEN_RARM + i].name1 == ART_IRON_BALL) p_ptr->align -= 1000;
3969+ if (creature_ptr->inventory_list[INVEN_RARM + i].name1 == ART_IRON_BALL) creature_ptr->align -= 1000;
39703970 }
39713971 }
39723972
39733973 /* Determine player alignment */
39743974 for (i = 0, j = 0; i < 8; i++)
39753975 {
3976- switch (p_ptr->vir_types[i])
3976+ switch (creature_ptr->vir_types[i])
39773977 {
39783978 case V_JUSTICE:
3979- p_ptr->align += p_ptr->virtues[i] * 2;
3979+ creature_ptr->align += creature_ptr->virtues[i] * 2;
39803980 break;
39813981 case V_CHANCE:
39823982 /* Do nothing */
@@ -3986,25 +3986,25 @@ static void calc_alignment(void)
39863986 neutral[j++] = i;
39873987 break;
39883988 case V_UNLIFE:
3989- p_ptr->align -= p_ptr->virtues[i];
3989+ creature_ptr->align -= creature_ptr->virtues[i];
39903990 break;
39913991 default:
3992- p_ptr->align += p_ptr->virtues[i];
3992+ creature_ptr->align += creature_ptr->virtues[i];
39933993 break;
39943994 }
39953995 }
39963996
39973997 for (i = 0; i < j; i++)
39983998 {
3999- if (p_ptr->align > 0)
3999+ if (creature_ptr->align > 0)
40004000 {
4001- p_ptr->align -= p_ptr->virtues[neutral[i]] / 2;
4002- if (p_ptr->align < 0) p_ptr->align = 0;
4001+ creature_ptr->align -= creature_ptr->virtues[neutral[i]] / 2;
4002+ if (creature_ptr->align < 0) creature_ptr->align = 0;
40034003 }
4004- else if (p_ptr->align < 0)
4004+ else if (creature_ptr->align < 0)
40054005 {
4006- p_ptr->align += p_ptr->virtues[neutral[i]] / 2;
4007- if (p_ptr->align > 0) p_ptr->align = 0;
4006+ creature_ptr->align += creature_ptr->virtues[neutral[i]] / 2;
4007+ if (creature_ptr->align > 0) creature_ptr->align = 0;
40084008 }
40094009 }
40104010 }
@@ -5008,7 +5008,7 @@ void update_creature(player_type *creature_ptr)
50085008 if (creature_ptr->update & (PU_BONUS))
50095009 {
50105010 creature_ptr->update &= ~(PU_BONUS);
5011- calc_alignment();
5011+ calc_alignment(creature_ptr);
50125012 calc_bonuses(creature_ptr);
50135013 }
50145014
Show on old repository browser