• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision3f40ffc6ae0d47299c917d660a40ae46bc6fa007 (tree)
Time2019-07-12 00:06:45
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/core.c
+++ b/src/core.c
@@ -2662,7 +2662,7 @@ static void process_world_aux_curse(void)
26622662 if (p_ptr->exp < 0) p_ptr->exp = 0;
26632663 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
26642664 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2665- check_experience();
2665+ check_experience(p_ptr);
26662666 }
26672667 /* Add light curse (Later) */
26682668 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
--- a/src/player-effects.c
+++ b/src/player-effects.c
@@ -3625,7 +3625,7 @@ bool restore_level(player_type *creature_ptr)
36253625 creature_ptr->exp = creature_ptr->max_exp;
36263626
36273627 /* Check the experience */
3628- check_experience();
3628+ check_experience(p_ptr);
36293629
36303630 /* Did something */
36313631 return (TRUE);
@@ -3753,7 +3753,7 @@ void change_race(player_type *creature_ptr, CHARACTER_IDX new_race, concptr effe
37533753 roll_hitdice(creature_ptr, 0L);
37543754
37553755 /* The experience level may be modified */
3756- check_experience();
3756+ check_experience(p_ptr);
37573757
37583758 creature_ptr->redraw |= (PR_BASIC);
37593759
@@ -3922,7 +3922,7 @@ void gain_exp_64(player_type *creature_ptr, s32b amount, u32b amount_frac)
39223922 creature_ptr->max_exp += amount / 5;
39233923 }
39243924
3925- check_experience();
3925+ check_experience(p_ptr);
39263926 }
39273927
39283928
@@ -4024,7 +4024,7 @@ void calc_android_exp(player_type *creature_ptr)
40244024 if (i == INVEN_BODY) total_exp += exp / 32;
40254025 }
40264026 creature_ptr->exp = creature_ptr->max_exp = total_exp;
4027- check_experience();
4027+ check_experience(p_ptr);
40284028 }
40294029
40304030
@@ -4038,7 +4038,7 @@ void lose_exp(player_type *creature_ptr, s32b amount)
40384038
40394039 creature_ptr->exp -= amount;
40404040
4041- check_experience();
4041+ check_experience(p_ptr);
40424042 }
40434043
40444044
--- a/src/player-status.c
+++ b/src/player-status.c
@@ -5479,91 +5479,91 @@ void sanity_blast(monster_type *m_ptr, bool necro)
54795479 * Advance experience levels and print experience
54805480 * @return なし
54815481 */
5482-void check_experience(void)
5482+void check_experience(player_type *creature_ptr)
54835483 {
54845484 bool level_reward = FALSE;
54855485 bool level_mutation = FALSE;
54865486 bool level_inc_stat = FALSE;
5487- bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
5488- PLAYER_LEVEL old_lev = p_ptr->lev;
5487+ bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
5488+ PLAYER_LEVEL old_lev = creature_ptr->lev;
54895489
54905490 /* Hack -- lower limit */
5491- if (p_ptr->exp < 0) p_ptr->exp = 0;
5492- if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
5493- if (p_ptr->max_max_exp < 0) p_ptr->max_max_exp = 0;
5491+ if (creature_ptr->exp < 0) creature_ptr->exp = 0;
5492+ if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
5493+ if (creature_ptr->max_max_exp < 0) creature_ptr->max_max_exp = 0;
54945494
54955495 /* Hack -- upper limit */
5496- if (p_ptr->exp > PY_MAX_EXP) p_ptr->exp = PY_MAX_EXP;
5497- if (p_ptr->max_exp > PY_MAX_EXP) p_ptr->max_exp = PY_MAX_EXP;
5498- if (p_ptr->max_max_exp > PY_MAX_EXP) p_ptr->max_max_exp = PY_MAX_EXP;
5496+ if (creature_ptr->exp > PY_MAX_EXP) creature_ptr->exp = PY_MAX_EXP;
5497+ if (creature_ptr->max_exp > PY_MAX_EXP) creature_ptr->max_exp = PY_MAX_EXP;
5498+ if (creature_ptr->max_max_exp > PY_MAX_EXP) creature_ptr->max_max_exp = PY_MAX_EXP;
54995499
55005500 /* Hack -- maintain "max" experience */
5501- if (p_ptr->exp > p_ptr->max_exp) p_ptr->max_exp = p_ptr->exp;
5501+ if (creature_ptr->exp > creature_ptr->max_exp) creature_ptr->max_exp = creature_ptr->exp;
55025502
55035503 /* Hack -- maintain "max max" experience */
5504- if (p_ptr->max_exp > p_ptr->max_max_exp) p_ptr->max_max_exp = p_ptr->max_exp;
5504+ if (creature_ptr->max_exp > creature_ptr->max_max_exp) creature_ptr->max_max_exp = creature_ptr->max_exp;
55055505
55065506 /* Redraw experience */
5507- p_ptr->redraw |= (PR_EXP);
5507+ creature_ptr->redraw |= (PR_EXP);
55085508 handle_stuff();
55095509
55105510
55115511 /* Lose levels while possible */
5512- while ((p_ptr->lev > 1) &&
5513- (p_ptr->exp < ((android ? player_exp_a : player_exp)[p_ptr->lev - 2] * p_ptr->expfact / 100L)))
5512+ while ((creature_ptr->lev > 1) &&
5513+ (creature_ptr->exp < ((android ? player_exp_a : player_exp)[creature_ptr->lev - 2] * creature_ptr->expfact / 100L)))
55145514 {
55155515 /* Lose a level */
5516- p_ptr->lev--;
5517- p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5518- p_ptr->redraw |= (PR_LEV | PR_TITLE);
5519- p_ptr->window |= (PW_PLAYER);
5516+ creature_ptr->lev--;
5517+ creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5518+ creature_ptr->redraw |= (PR_LEV | PR_TITLE);
5519+ creature_ptr->window |= (PW_PLAYER);
55205520 handle_stuff();
55215521 }
55225522
55235523
55245524 /* Gain levels while possible */
5525- while ((p_ptr->lev < PY_MAX_LEVEL) &&
5526- (p_ptr->exp >= ((android ? player_exp_a : player_exp)[p_ptr->lev - 1] * p_ptr->expfact / 100L)))
5525+ while ((creature_ptr->lev < PY_MAX_LEVEL) &&
5526+ (creature_ptr->exp >= ((android ? player_exp_a : player_exp)[creature_ptr->lev - 1] * creature_ptr->expfact / 100L)))
55275527 {
55285528 /* Gain a level */
5529- p_ptr->lev++;
5529+ creature_ptr->lev++;
55305530
55315531 /* Save the highest level */
5532- if (p_ptr->lev > p_ptr->max_plv)
5532+ if (creature_ptr->lev > creature_ptr->max_plv)
55335533 {
5534- p_ptr->max_plv = p_ptr->lev;
5534+ creature_ptr->max_plv = creature_ptr->lev;
55355535
5536- if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
5537- (p_ptr->muta2 & MUT2_CHAOS_GIFT))
5536+ if ((creature_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
5537+ (creature_ptr->muta2 & MUT2_CHAOS_GIFT))
55385538 {
55395539 level_reward = TRUE;
55405540 }
5541- if (p_ptr->prace == RACE_BEASTMAN)
5541+ if (creature_ptr->prace == RACE_BEASTMAN)
55425542 {
55435543 if (one_in_(5)) level_mutation = TRUE;
55445544 }
55455545 level_inc_stat = TRUE;
55465546
5547- do_cmd_write_nikki(NIKKI_LEVELUP, p_ptr->lev, NULL);
5547+ do_cmd_write_nikki(NIKKI_LEVELUP, creature_ptr->lev, NULL);
55485548 }
55495549
55505550 sound(SOUND_LEVEL);
55515551
5552- msg_format(_("レベル %d にようこそ。", "Welcome to level %d."), p_ptr->lev);
5552+ msg_format(_("レベル %d にようこそ。", "Welcome to level %d."), creature_ptr->lev);
55535553
5554- p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5555- p_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
5556- p_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
5554+ creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5555+ creature_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
5556+ creature_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
55575557
55585558 /* HPとMPの上昇量を表示 */
5559- p_ptr->level_up_message = TRUE;
5559+ creature_ptr->level_up_message = TRUE;
55605560 handle_stuff();
55615561
5562- p_ptr->level_up_message = FALSE;
5562+ creature_ptr->level_up_message = FALSE;
55635563
55645564 if (level_inc_stat)
55655565 {
5566- if (!(p_ptr->max_plv % 10))
5566+ if (!(creature_ptr->max_plv % 10))
55675567 {
55685568 int choice;
55695569 screen_save();
@@ -5572,17 +5572,17 @@ void check_experience(void)
55725572 int n;
55735573 char tmp[32];
55745574
5575- cnv_stat(p_ptr->stat_max[0], tmp);
5575+ cnv_stat(creature_ptr->stat_max[0], tmp);
55765576 prt(format(_(" a) 腕力 (現在値 %s)", " a) Str (cur %s)"), tmp), 2, 14);
5577- cnv_stat(p_ptr->stat_max[1], tmp);
5577+ cnv_stat(creature_ptr->stat_max[1], tmp);
55785578 prt(format(_(" b) 知能 (現在値 %s)", " a) Int (cur %s)"), tmp), 3, 14);
5579- cnv_stat(p_ptr->stat_max[2], tmp);
5579+ cnv_stat(creature_ptr->stat_max[2], tmp);
55805580 prt(format(_(" c) 賢さ (現在値 %s)", " a) Wis (cur %s)"), tmp), 4, 14);
5581- cnv_stat(p_ptr->stat_max[3], tmp);
5581+ cnv_stat(creature_ptr->stat_max[3], tmp);
55825582 prt(format(_(" d) 器用 (現在値 %s)", " a) Dex (cur %s)"), tmp), 5, 14);
5583- cnv_stat(p_ptr->stat_max[4], tmp);
5583+ cnv_stat(creature_ptr->stat_max[4], tmp);
55845584 prt(format(_(" e) 耐久 (現在値 %s)", " a) Con (cur %s)"), tmp), 6, 14);
5585- cnv_stat(p_ptr->stat_max[5], tmp);
5585+ cnv_stat(creature_ptr->stat_max[5], tmp);
55865586 prt(format(_(" f) 魅力 (現在値 %s)", " a) Chr (cur %s)"), tmp), 7, 14);
55875587
55885588 prt("", 8, 14);
@@ -5598,38 +5598,38 @@ void check_experience(void)
55985598 prt("", n + 2, 14);
55995599 if (get_check(_("よろしいですか?", "Are you sure? "))) break;
56005600 }
5601- do_inc_stat(p_ptr, choice - 'a');
5601+ do_inc_stat(creature_ptr, choice - 'a');
56025602 screen_load();
56035603 }
5604- else if (!(p_ptr->max_plv % 2))
5605- do_inc_stat(p_ptr, randint0(6));
5604+ else if (!(creature_ptr->max_plv % 2))
5605+ do_inc_stat(creature_ptr, randint0(6));
56065606 }
56075607
56085608 if (level_mutation)
56095609 {
56105610 msg_print(_("あなたは変わった気がする...", "You feel different..."));
5611- (void)gain_mutation(p_ptr, 0);
5611+ (void)gain_mutation(creature_ptr, 0);
56125612 level_mutation = FALSE;
56135613 }
56145614
56155615 /*
5616- * 報酬でレベルが上ると再帰的に check_experience() が
5616+ * 報酬でレベルが上ると再帰的に check_experience(creature_ptr) が
56175617 * 呼ばれるので順番を最後にする。
56185618 */
56195619 if (level_reward)
56205620 {
5621- gain_level_reward(p_ptr, 0);
5621+ gain_level_reward(creature_ptr, 0);
56225622 level_reward = FALSE;
56235623 }
56245624
5625- p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5626- p_ptr->redraw |= (PR_LEV | PR_TITLE);
5627- p_ptr->window |= (PW_PLAYER | PW_SPELL);
5625+ creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5626+ creature_ptr->redraw |= (PR_LEV | PR_TITLE);
5627+ creature_ptr->window |= (PW_PLAYER | PW_SPELL);
56285628 handle_stuff();
56295629 }
56305630
56315631 /* Load an autopick preference file */
5632- if (old_lev != p_ptr->lev) autopick_load_pref(FALSE);
5632+ if (old_lev != creature_ptr->lev) autopick_load_pref(FALSE);
56335633 }
56345634
56355635 /*!
--- a/src/player-status.h
+++ b/src/player-status.h
@@ -747,7 +747,7 @@ extern void free_turn(player_type *creature_ptr);
747747 extern bool player_place(player_type *creature_ptr, POSITION y, POSITION x);
748748 extern void sanity_blast(monster_type *m_ptr, bool necro);
749749
750-extern void check_experience(void);
750+extern void check_experience(player_type *creature_ptr);
751751 extern void wreck_the_pattern(player_type *creature_ptr);
752752 extern void cnv_stat(int val, char *out_val);
753753 extern s16b modify_stat_value(int value, int amount);
--- a/src/realm-hex.c
+++ b/src/realm-hex.c
@@ -885,7 +885,7 @@ concptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
885885 p_ptr->exp += r;
886886
887887 /* Check the experience */
888- check_experience();
888+ check_experience(p_ptr);
889889
890890 flag = TRUE;
891891 }
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -3153,7 +3153,7 @@ void ring_of_power(DIRECTION dir)
31533153 /* Lose some experience (permanently) */
31543154 p_ptr->exp -= (p_ptr->exp / 4);
31553155 p_ptr->max_exp -= (p_ptr->exp / 4);
3156- check_experience();
3156+ check_experience(p_ptr);
31573157
31583158 break;
31593159 }
--- a/src/wizard2.c
+++ b/src/wizard2.c
@@ -387,7 +387,7 @@ static void do_cmd_wiz_change_aux(void)
387387 p_ptr->exp = tmp_long;
388388
389389 /* Update */
390- check_experience();
390+ check_experience(p_ptr);
391391 }
392392 }
393393
Show on old repository browser