• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision1681b6dda05d6cd5681a9441804cc332fc96c9fb (tree)
Time2019-06-22 12:15:40
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/cmd-activate.c
+++ b/src/cmd-activate.c
@@ -1035,7 +1035,7 @@ bool activate_artifact(object_type *o_ptr)
10351035 fire_breath(GF_MISSILE, dir, 300, 4);
10361036 msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
10371037 (void)set_afraid(p_ptr, 0);
1038- (void)set_hero(randint1(50) + 50, FALSE);
1038+ (void)set_hero(p_ptr, randint1(50) + 50, FALSE);
10391039 (void)hp_player(p_ptr, 10);
10401040 (void)set_blessed(p_ptr, randint1(50) + 50, FALSE);
10411041 (void)set_oppose_acid(randint1(50) + 50, FALSE);
@@ -1239,7 +1239,7 @@ bool activate_artifact(object_type *o_ptr)
12391239 {
12401240 msg_print(_("天国の歌が聞こえる...", "A heavenly choir sings..."));
12411241 (void)cure_critical_wounds(777);
1242- (void)set_hero(randint1(25) + 25, FALSE);
1242+ (void)set_hero(p_ptr, randint1(25) + 25, FALSE);
12431243 break;
12441244 }
12451245
@@ -1663,7 +1663,7 @@ bool activate_artifact(object_type *o_ptr)
16631663 {
16641664 msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
16651665 (void)set_afraid(p_ptr, 0);
1666- (void)set_hero(randint1(20) + 20, FALSE);
1666+ (void)set_hero(p_ptr, randint1(20) + 20, FALSE);
16671667 dispel_evil(p_ptr->lev * 3);
16681668 break;
16691669 }
@@ -1685,7 +1685,7 @@ bool activate_artifact(object_type *o_ptr)
16851685 {
16861686 TIME_EFFECT v = randint1(25) + 25;
16871687 (void)set_afraid(p_ptr, 0);
1688- (void)set_hero(v, FALSE);
1688+ (void)set_hero(p_ptr, v, FALSE);
16891689 (void)hp_player(p_ptr, 10);
16901690 (void)set_blessed(p_ptr, v, FALSE);
16911691 (void)set_oppose_acid(v, FALSE);
--- a/src/core.c
+++ b/src/core.c
@@ -2001,7 +2001,7 @@ static void process_world_aux_timeout(void)
20012001 /* Heroism */
20022002 if (p_ptr->hero)
20032003 {
2004- (void)set_hero(p_ptr->hero - 1, TRUE);
2004+ (void)set_hero(p_ptr, p_ptr->hero - 1, TRUE);
20052005 }
20062006
20072007 /* Super Heroism */
--- a/src/mind.c
+++ b/src/mind.c
@@ -1144,7 +1144,7 @@ static bool cast_mindcrafter_spell(int spell)
11441144 }
11451145
11461146 t = 10 + randint1((plev * 3) / 2);
1147- set_hero(t, FALSE);
1147+ set_hero(p_ptr, t, FALSE);
11481148 /* Haste */
11491149 (void)set_fast(p_ptr, t, FALSE);
11501150 break;
--- a/src/player-effects.c
+++ b/src/player-effects.c
@@ -296,7 +296,7 @@ void dispel_player(void)
296296 (void)set_shield(p_ptr, 0, TRUE);
297297 (void)set_blessed(p_ptr, 0, TRUE);
298298 (void)set_tsuyoshi(0, TRUE);
299- (void)set_hero(0, TRUE);
299+ (void)set_hero(p_ptr, 0, TRUE);
300300 (void)set_shero(0, TRUE);
301301 (void)set_protevil(0, TRUE);
302302 (void)set_invuln(0, TRUE);
@@ -1138,19 +1138,19 @@ bool set_blessed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
11381138 * @param do_dec 現在の継続時間より長い値のみ上書きする
11391139 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
11401140 */
1141-bool set_hero(TIME_EFFECT v, bool do_dec)
1141+bool set_hero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
11421142 {
11431143 bool notice = FALSE;
11441144 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
11451145
1146- if (p_ptr->is_dead) return FALSE;
1146+ if (creature_ptr->is_dead) return FALSE;
11471147
11481148 /* Open */
11491149 if (v)
11501150 {
1151- if (p_ptr->hero && !do_dec)
1151+ if (creature_ptr->hero && !do_dec)
11521152 {
1153- if (p_ptr->hero > v) return FALSE;
1153+ if (creature_ptr->hero > v) return FALSE;
11541154 }
11551155 else if (!IS_HERO())
11561156 {
@@ -1162,7 +1162,7 @@ bool set_hero(TIME_EFFECT v, bool do_dec)
11621162 /* Shut */
11631163 else
11641164 {
1165- if (p_ptr->hero && !music_singing(MUSIC_HERO) && !music_singing(MUSIC_SHERO))
1165+ if (creature_ptr->hero && !music_singing(MUSIC_HERO) && !music_singing(MUSIC_SHERO))
11661166 {
11671167 msg_print(_("ヒーローの気分が消え失せた。", "The heroism wears off."));
11681168 notice = TRUE;
@@ -1170,17 +1170,17 @@ bool set_hero(TIME_EFFECT v, bool do_dec)
11701170 }
11711171
11721172 /* Use the value */
1173- p_ptr->hero = v;
1174- p_ptr->redraw |= (PR_STATUS);
1173+ creature_ptr->hero = v;
1174+ creature_ptr->redraw |= (PR_STATUS);
11751175
11761176 /* Nothing to notice */
11771177 if (!notice) return (FALSE);
11781178
11791179 if (disturb_state) disturb(FALSE, FALSE);
1180- p_ptr->update |= (PU_BONUS);
1180+ creature_ptr->update |= (PU_BONUS);
11811181
11821182 /* Recalculate hitpoints */
1183- p_ptr->update |= (PU_HP);
1183+ creature_ptr->update |= (PU_HP);
11841184 handle_stuff();
11851185 return (TRUE);
11861186 }
--- a/src/player-effects.h
+++ b/src/player-effects.h
@@ -27,7 +27,7 @@ extern bool set_shield(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
2727 extern bool set_tsubureru(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
2828 extern bool set_magicdef(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
2929 extern bool set_blessed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
30-extern bool set_hero(TIME_EFFECT v, bool do_dec);
30+extern bool set_hero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
3131 extern bool set_shero(TIME_EFFECT v, bool do_dec);
3232 extern bool set_protevil(TIME_EFFECT v, bool do_dec);
3333 extern bool set_invuln(TIME_EFFECT v, bool do_dec);
--- a/src/realm-crusade.c
+++ b/src/realm-crusade.c
@@ -565,7 +565,7 @@ concptr do_crusade_spell(SPELL_IDX spell, BIT_FLAGS mode)
565565 if (attempt < 0) continue;
566566 summon_specific(-1, my, mx, plev, SUMMON_KNIGHTS, (PM_ALLOW_GROUP | PM_FORCE_PET | PM_HASTE));
567567 }
568- set_hero(randint1(base) + base, FALSE);
568+ set_hero(p_ptr, randint1(base) + base, FALSE);
569569 set_blessed(p_ptr, randint1(base) + base, FALSE);
570570 set_fast(p_ptr, randint1(sp_sides) + sp_base, FALSE);
571571 set_protevil(randint1(base) + base, FALSE);
--- a/src/spells-status.c
+++ b/src/spells-status.c
@@ -295,7 +295,7 @@ bool_hack heroism(int base)
295295 {
296296 bool_hack ident = FALSE;
297297 if (set_afraid(p_ptr, 0)) ident = TRUE;
298- if (set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
298+ if (set_hero(p_ptr, p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
299299 if (hp_player(p_ptr, 10)) ident = TRUE;
300300 return ident;
301301 }
@@ -463,7 +463,7 @@ bool cosmic_cast_off(player_type *creature_ptr, object_type *o_ptr)
463463 (void)set_afraid(p_ptr, 0);
464464 (void)set_tim_esp(creature_ptr->tim_esp + t, FALSE);
465465 (void)set_tim_regen(creature_ptr->tim_regen + t, FALSE);
466- (void)set_hero(creature_ptr->hero + t, FALSE);
466+ (void)set_hero(p_ptr, creature_ptr->hero + t, FALSE);
467467 (void)set_blessed(p_ptr, creature_ptr->blessed + t, FALSE);
468468 (void)set_fast(p_ptr, creature_ptr->fast + t, FALSE);
469469 (void)set_shero(creature_ptr->shero + t, FALSE);
Show on old repository browser