• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision11fdf320646b7c775759a97700112d8d8266704a (tree)
Time2019-08-16 23:59:12
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/cmd/cmd-dump.c
+++ b/src/cmd/cmd-dump.c
@@ -4641,7 +4641,7 @@ static void do_cmd_knowledge_pets(void)
46414641 }
46424642 }
46434643
4644- show_upkeep = calculate_upkeep();
4644+ show_upkeep = calculate_upkeep(p_ptr);
46454645
46464646 fprintf(fff, "----------------------------------------------\n");
46474647 #ifdef JP
--- a/src/cmd/cmd-pet.c
+++ b/src/cmd/cmd-pet.c
@@ -74,7 +74,7 @@ bool player_can_ride_aux(grid_type *g_ptr, bool now_riding)
7474 * @brief ペットの維持コスト計算
7575 * @return 維持コスト(%)
7676 */
77-PERCENTAGE calculate_upkeep(void)
77+PERCENTAGE calculate_upkeep(player_type *creature_ptr)
7878 {
7979 MONSTER_IDX m_idx;
8080 bool have_a_unique = FALSE;
@@ -96,9 +96,9 @@ PERCENTAGE calculate_upkeep(void)
9696 total_friends++;
9797 if (r_ptr->flags1 & RF1_UNIQUE)
9898 {
99- if (p_ptr->pclass == CLASS_CAVALRY)
99+ if (creature_ptr->pclass == CLASS_CAVALRY)
100100 {
101- if (p_ptr->riding == m_idx)
101+ if (creature_ptr->riding == m_idx)
102102 total_friend_levels += (r_ptr->level + 5) * 2;
103103 else if (!have_a_unique && (r_info[m_ptr->r_idx].flags7 & RF7_RIDING))
104104 total_friend_levels += (r_ptr->level + 5) * 7 / 2;
@@ -118,7 +118,7 @@ PERCENTAGE calculate_upkeep(void)
118118 if (total_friends)
119119 {
120120 int upkeep_factor;
121- upkeep_factor = (total_friend_levels - (p_ptr->lev * 80 / (cp_ptr->pet_upkeep_div)));
121+ upkeep_factor = (total_friend_levels - (creature_ptr->lev * 80 / (cp_ptr->pet_upkeep_div)));
122122 if (upkeep_factor < 0) upkeep_factor = 0;
123123 if (upkeep_factor > 1000) upkeep_factor = 1000;
124124 return upkeep_factor;
@@ -827,7 +827,7 @@ void do_cmd_pet(void)
827827 break;
828828 }
829829 do_cmd_pet_dismiss();
830- (void)calculate_upkeep();
830+ (void)calculate_upkeep(p_ptr);
831831 break;
832832 }
833833 case PET_TARGET:
--- a/src/cmd/cmd-pet.h
+++ b/src/cmd/cmd-pet.h
@@ -2,7 +2,7 @@
22 #include "grid.h"
33
44 extern bool do_riding(bool force);
5-extern PERCENTAGE calculate_upkeep(void);
5+extern PERCENTAGE calculate_upkeep(player_type *creature_ptr);
66 extern void do_cmd_pet_dismiss(void);
77 extern void do_cmd_pet(void);
88 extern bool player_can_ride_aux(grid_type *g_ptr, bool now_riding);
Show on old repository browser