• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision680b8cde52f31a6affd8cff8fb2750ed56748e71 (tree)
Time2019-02-16 19:33:08
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

[Refactor] #37353 roll_hitdice() の引数整理。 / Refactor arguments of roll_hitdice().

Change Summary

Incremental Difference

--- a/src/birth.c
+++ b/src/birth.c
@@ -1201,7 +1201,7 @@ static void get_extra(bool roll_hitdie)
12011201 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
12021202
12031203 /* Roll for hit point unless quick-start */
1204- if (roll_hitdie) roll_hitdice(SPOP_NO_UPDATE);
1204+ if (roll_hitdie) roll_hitdice(p_ptr, SPOP_NO_UPDATE);
12051205
12061206 /* Initial hitpoints */
12071207 p_ptr->mhp = p_ptr->player_hp[0];
--- a/src/cmd-quaff.c
+++ b/src/cmd-quaff.c
@@ -452,7 +452,7 @@ void do_cmd_quaff_potion_aux(INVENTORY_IDX item)
452452 break;
453453
454454 case SV_POTION_NEW_LIFE:
455- roll_hitdice(0L);
455+ roll_hitdice(p_ptr, 0L);
456456 get_max_stats();
457457 p_ptr->update |= PU_BONUS;
458458 lose_all_mutations();
--- a/src/effects.c
+++ b/src/effects.c
@@ -3688,7 +3688,7 @@ void change_race(CHARACTER_IDX new_race, concptr effect_msg)
36883688 else
36893689 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
36903690
3691- roll_hitdice(0L);
3691+ roll_hitdice(p_ptr, 0L);
36923692
36933693 /* The experience level may be modified */
36943694 check_experience();
@@ -3818,7 +3818,7 @@ void do_poly_self(void)
38183818 power -= 10;
38193819
38203820 get_max_stats();
3821- roll_hitdice(0L);
3821+ roll_hitdice(p_ptr, 0L);
38223822 }
38233823
38243824 while ((power > randint0(15)) && one_in_(3))
--- a/src/load.c
+++ b/src/load.c
@@ -3793,22 +3793,22 @@ static errr rd_savefile_new_aux(void)
37933793 if(z_older_than(10, 2, 2) && (p_ptr->pclass == CLASS_BEASTMASTER) && !p_ptr->is_dead)
37943794 {
37953795 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3796- roll_hitdice(0L);
3796+ roll_hitdice(p_ptr, 0L);
37973797 }
37983798 if(z_older_than(10, 3, 2) && (p_ptr->pclass == CLASS_ARCHER) && !p_ptr->is_dead)
37993799 {
38003800 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3801- roll_hitdice(0L);
3801+ roll_hitdice(p_ptr, 0L);
38023802 }
38033803 if(z_older_than(10, 2, 6) && (p_ptr->pclass == CLASS_SORCERER) && !p_ptr->is_dead)
38043804 {
38053805 p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
3806- roll_hitdice(0L);
3806+ roll_hitdice(p_ptr, 0L);
38073807 }
38083808 if(z_older_than(10, 4, 7) && (p_ptr->pclass == CLASS_BLUE_MAGE) && !p_ptr->is_dead)
38093809 {
38103810 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3811- roll_hitdice(0L);
3811+ roll_hitdice(p_ptr, 0L);
38123812 }
38133813
38143814 /* Important -- Initialize the magic */
--- a/src/spells-status.c
+++ b/src/spells-status.c
@@ -192,15 +192,15 @@ bool time_walk(player_type *creature_ptr)
192192 * @param options スペル共通オプション
193193 * @return なし
194194 */
195-void roll_hitdice(SPOP_FLAGS options)
195+void roll_hitdice(player_type *creature_ptr, SPOP_FLAGS options)
196196 {
197197 PERCENTAGE percent;
198198
199199 /* Minimum hitpoints at highest level */
200- HIT_POINT min_value = p_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (p_ptr->hitdie + 1)) * 3 / 8;
200+ HIT_POINT min_value = creature_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (creature_ptr->hitdie + 1)) * 3 / 8;
201201
202202 /* Maximum hitpoints at highest level */
203- HIT_POINT max_value = p_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (p_ptr->hitdie + 1)) * 5 / 8;
203+ HIT_POINT max_value = creature_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (creature_ptr->hitdie + 1)) * 5 / 8;
204204
205205 int i;
206206
@@ -208,31 +208,31 @@ void roll_hitdice(SPOP_FLAGS options)
208208 while (1)
209209 {
210210 /* Pre-calculate level 1 hitdice */
211- p_ptr->player_hp[0] = (HIT_POINT)p_ptr->hitdie;
211+ creature_ptr->player_hp[0] = (HIT_POINT)creature_ptr->hitdie;
212212
213213 for (i = 1; i < 4; i++)
214214 {
215- p_ptr->player_hp[0] += randint1(p_ptr->hitdie);
215+ creature_ptr->player_hp[0] += randint1(creature_ptr->hitdie);
216216 }
217217
218218 /* Roll the hitpoint values */
219219 for (i = 1; i < PY_MAX_LEVEL; i++)
220220 {
221- p_ptr->player_hp[i] = p_ptr->player_hp[i - 1] + randint1(p_ptr->hitdie);
221+ creature_ptr->player_hp[i] = creature_ptr->player_hp[i - 1] + randint1(creature_ptr->hitdie);
222222 }
223223
224224 /* Require "valid" hitpoints at highest level */
225- if ((p_ptr->player_hp[PY_MAX_LEVEL - 1] >= min_value) &&
226- (p_ptr->player_hp[PY_MAX_LEVEL - 1] <= max_value)) break;
225+ if ((creature_ptr->player_hp[PY_MAX_LEVEL - 1] >= min_value) &&
226+ (creature_ptr->player_hp[PY_MAX_LEVEL - 1] <= max_value)) break;
227227 }
228228
229- percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
230- (2 * p_ptr->hitdie + ((PY_MAX_LEVEL - 1 + 3) * (p_ptr->hitdie + 1))));
229+ percent = (int)(((long)creature_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
230+ (2 * creature_ptr->hitdie + ((PY_MAX_LEVEL - 1 + 3) * (creature_ptr->hitdie + 1))));
231231
232232 /* Update and redraw hitpoints */
233- p_ptr->update |= (PU_HP);
234- p_ptr->redraw |= (PR_HP);
235- p_ptr->window |= (PW_PLAYER);
233+ creature_ptr->update |= (PU_HP);
234+ creature_ptr->redraw |= (PR_HP);
235+ creature_ptr->window |= (PW_PLAYER);
236236
237237 if (!(options & SPOP_NO_UPDATE)) handle_stuff();
238238
@@ -241,12 +241,12 @@ void roll_hitdice(SPOP_FLAGS options)
241241 if (options & SPOP_DEBUG)
242242 {
243243 msg_format(_("現在の体力ランクは %d/100 です。", "Your life rate is %d/100 now."), percent);
244- p_ptr->knowledge |= KNOW_HPRATE;
244+ creature_ptr->knowledge |= KNOW_HPRATE;
245245 }
246246 else
247247 {
248248 msg_print(_("体力ランクが変わった。", "Life rate is changed."));
249- p_ptr->knowledge &= ~(KNOW_HPRATE);
249+ creature_ptr->knowledge &= ~(KNOW_HPRATE);
250250 }
251251 }
252252 }
--- a/src/spells-status.h
+++ b/src/spells-status.h
@@ -12,7 +12,7 @@ extern bool poly_monster(DIRECTION dir, int power);
1212 extern bool clone_monster(DIRECTION dir);
1313 extern void stop_singing(void);
1414 extern bool time_walk(player_type *creature_ptr);
15-extern void roll_hitdice(SPOP_FLAGS options);
15+extern void roll_hitdice(player_type *creature_ptr, SPOP_FLAGS options);
1616 extern bool_hack life_stream(bool_hack message, bool_hack virtue_change);
1717 extern bool_hack heroism(int base);
1818 extern bool_hack berserk(int base);
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -4567,7 +4567,7 @@ void cast_shuffle(void)
45674567 else if (die < 111)
45684568 {
45694569 msg_print(_("《審判》だ。", "It's the Judgement."));
4570- roll_hitdice(0L);
4570+ roll_hitdice(p_ptr, 0L);
45714571 lose_all_mutations();
45724572 }
45734573 else if (die < 120)
--- a/src/wizard2.c
+++ b/src/wizard2.c
@@ -1798,7 +1798,7 @@ void do_cmd_debug(void)
17981798
17991799 /* Hitpoint rerating */
18001800 case 'h':
1801- roll_hitdice(SPOP_DISPLAY_MES | SPOP_DEBUG);
1801+ roll_hitdice(p_ptr, SPOP_DISPLAY_MES | SPOP_DEBUG);
18021802 break;
18031803
18041804 case 'H':
Show on old repository browser