• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision560ce856d452ae51e6f632028bdeb51ab79b199c (tree)
Time2019-02-04 02:03:26
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

[Refactor] #37353 do_cmd_rerate() と do_cmd_rerate_aux() を整理。 / Refactor do_cmd_rerate() and do_cmd_rerate_aux().

Change Summary

Incremental Difference

--- a/Hengband_vcs2017/Hengband/Hengband.vcxproj
+++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj
@@ -263,7 +263,6 @@
263263 <ClCompile Include="..\..\src\z-term.c" />
264264 <ClCompile Include="..\..\src\z-util.c" />
265265 <ClCompile Include="..\..\src\z-virt.c" />
266- <ClInclude Include="spells.h" />
267266 </ItemGroup>
268267 <ItemGroup>
269268 <ClInclude Include="..\..\src\angband.h" />
@@ -333,6 +332,7 @@
333332 <ClInclude Include="..\..\src\spells-summon.h" />
334333 <ClInclude Include="..\..\src\floor-streams.h" />
335334 <ClInclude Include="..\..\src\projection.h" />
335+ <ClInclude Include="..\..\src\spells.h" />
336336 <ClInclude Include="..\..\src\store.h" />
337337 <ClInclude Include="..\..\src\trap.h" />
338338 <ClInclude Include="..\..\src\types.h" />
--- a/src/birth.c
+++ b/src/birth.c
@@ -18,6 +18,7 @@
1818 #include "store.h"
1919 #include "quest.h"
2020 #include "player-status.h"
21+#include "spells.h"
2122
2223 /*!
2324 * オートローラーの内容を描画する間隔 /
@@ -1199,7 +1200,7 @@ static void get_extra(bool roll_hitdie)
11991200 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
12001201
12011202 /* Roll for hit point unless quick-start */
1202- if (roll_hitdie) do_cmd_rerate_aux();
1203+ if (roll_hitdie) do_cmd_rerate(SPOP_NO_UPDATE);
12031204
12041205 /* Initial hitpoints */
12051206 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- do_cmd_rerate(FALSE);
455+ do_cmd_rerate(0L);
456456 get_max_stats();
457457 p_ptr->update |= PU_BONUS;
458458 lose_all_mutations();
--- a/src/effects.c
+++ b/src/effects.c
@@ -3687,7 +3687,7 @@ void change_race(CHARACTER_IDX new_race, concptr effect_msg)
36873687 else
36883688 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
36893689
3690- do_cmd_rerate(FALSE);
3690+ do_cmd_rerate(0L);
36913691
36923692 /* The experience level may be modified */
36933693 check_experience();
@@ -3817,7 +3817,7 @@ void do_poly_self(void)
38173817 power -= 10;
38183818
38193819 get_max_stats();
3820- do_cmd_rerate(FALSE);
3820+ do_cmd_rerate(0L);
38213821 }
38223822
38233823 while ((power > randint0(15)) && one_in_(3))
--- a/src/externs.h
+++ b/src/externs.h
@@ -1428,8 +1428,7 @@ extern void spoil_random_artifact(concptr fname);
14281428
14291429 /* wizard2.c */
14301430 extern void strip_name(char *buf, KIND_OBJECT_IDX k_idx);
1431-extern void do_cmd_rerate_aux(void);
1432-extern void do_cmd_rerate(bool display);
1431+extern void do_cmd_rerate(SPOP_FLAGS options);
14331432 extern void cheat_death(player_type *creature_ptr);
14341433
14351434
--- a/src/h-type.h
+++ b/src/h-type.h
@@ -254,7 +254,7 @@ typedef byte FF_FLAGS_IDX; /*!< 地形特性ID */
254254
255255 typedef s16b FEAT_PRIORITY; /*!< 地形の縮小表示優先順位 */
256256
257-typedef BIT_FLAGS SPOP_FLAGS; /*1< スペル用オプション */
257+typedef BIT_FLAGS SPOP_FLAGS; /*!< スペル用オプション */
258258
259259 /*** Pointers to all the basic types defined above ***/
260260
--- a/src/load.c
+++ b/src/load.c
@@ -3791,22 +3791,22 @@ static errr rd_savefile_new_aux(void)
37913791 if(z_older_than(10, 2, 2) && (p_ptr->pclass == CLASS_BEASTMASTER) && !p_ptr->is_dead)
37923792 {
37933793 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3794- do_cmd_rerate(FALSE);
3794+ do_cmd_rerate(0L);
37953795 }
37963796 if(z_older_than(10, 3, 2) && (p_ptr->pclass == CLASS_ARCHER) && !p_ptr->is_dead)
37973797 {
37983798 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3799- do_cmd_rerate(FALSE);
3799+ do_cmd_rerate(0L);
38003800 }
38013801 if(z_older_than(10, 2, 6) && (p_ptr->pclass == CLASS_SORCERER) && !p_ptr->is_dead)
38023802 {
38033803 p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
3804- do_cmd_rerate(FALSE);
3804+ do_cmd_rerate(0L);
38053805 }
38063806 if(z_older_than(10, 4, 7) && (p_ptr->pclass == CLASS_BLUE_MAGE) && !p_ptr->is_dead)
38073807 {
38083808 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3809- do_cmd_rerate(FALSE);
3809+ do_cmd_rerate(0L);
38103810 }
38113811
38123812 /* Important -- Initialize the magic */
--- a/src/spells.h
+++ b/src/spells.h
@@ -1,6 +1,6 @@
11 #pragma once
22
33 #define SPOP_DISPLAY_MES 0x0001 // !< スペル処理オプション … メッセージを表示する
4-#define SPOP_UPDATE 0x0002 // !< スペル処理オプション … ステータス更新を解決後行う
4+#define SPOP_NO_UPDATE 0x0002 // !< スペル処理オプション … ステータス更新を解決後行う
55 #define SPOP_DEBUG 0x8000 // !< スペル処理オプション … デバッグ処理あり
66
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -4622,7 +4622,7 @@ void cast_shuffle(void)
46224622 else if (die < 111)
46234623 {
46244624 msg_print(_("《審判》だ。", "It's the Judgement."));
4625- do_cmd_rerate(FALSE);
4625+ do_cmd_rerate(0L);
46264626 lose_all_mutations();
46274627 }
46284628 else if (die < 120)
--- a/src/wizard2.c
+++ b/src/wizard2.c
@@ -19,15 +19,19 @@
1919 #include "artifact.h"
2020 #include "player-status.h"
2121
22+#include "spells.h"
2223 #include "spells-object.h"
2324 #include "spells-summon.h"
2425
2526 /*!
26- * @brief プレイヤーのヒットダイスを振り直す / Roll the hitdie -- aux of do_cmd_rerate()
27+ * @brief プレイヤーのヒットダイスを振り直す / Hack -- Rerate Hitpoints
28+ * @param options スペル共通オプション
2729 * @return なし
2830 */
29-void do_cmd_rerate_aux(void)
31+void do_cmd_rerate(SPOP_FLAGS options)
3032 {
33+ PERCENTAGE percent;
34+
3135 /* Minimum hitpoints at highest level */
3236 HIT_POINT min_value = p_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (p_ptr->hitdie + 1)) * 3 / 8;
3337
@@ -55,42 +59,31 @@ void do_cmd_rerate_aux(void)
5559
5660 /* Require "valid" hitpoints at highest level */
5761 if ((p_ptr->player_hp[PY_MAX_LEVEL - 1] >= min_value) &&
58- (p_ptr->player_hp[PY_MAX_LEVEL - 1] <= max_value)) break;
62+ (p_ptr->player_hp[PY_MAX_LEVEL - 1] <= max_value)) break;
5963 }
60-}
61-
62-
63-/*!
64- * @brief プレイヤーのヒットダイスを振り直した後明示を行う / Hack -- Rerate Hitpoints
65- * @param display TRUEならば体力ランクを明示する
66- * @return なし
67- */
68-void do_cmd_rerate(bool display)
69-{
70- PERCENTAGE percent;
71-
72- /* Rerate */
73- do_cmd_rerate_aux();
7464
7565 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
7666 (2 * p_ptr->hitdie + ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
7767
78-
7968 /* Update and redraw hitpoints */
8069 p_ptr->update |= (PU_HP);
8170 p_ptr->redraw |= (PR_HP);
8271 p_ptr->window |= (PW_PLAYER);
83- handle_stuff();
8472
85- if (display)
86- {
87- msg_format(_("現在の体力ランクは %d/100 です。", "Your life rate is %d/100 now."), percent);
88- p_ptr->knowledge |= KNOW_HPRATE;
89- }
90- else
73+ if(!(options & SPOP_NO_UPDATE)) handle_stuff();
74+
75+ if (options & SPOP_DISPLAY_MES)
9176 {
92- msg_print(_("体力ランクが変わった。", "Life rate is changed."));
93- p_ptr->knowledge &= ~(KNOW_HPRATE);
77+ if (options & SPOP_DEBUG)
78+ {
79+ msg_format(_("現在の体力ランクは %d/100 です。", "Your life rate is %d/100 now."), percent);
80+ p_ptr->knowledge |= KNOW_HPRATE;
81+ }
82+ else
83+ {
84+ msg_print(_("体力ランクが変わった。", "Life rate is changed."));
85+ p_ptr->knowledge &= ~(KNOW_HPRATE);
86+ }
9487 }
9588 }
9689
@@ -1902,7 +1895,7 @@ void do_cmd_debug(void)
19021895
19031896 /* Hitpoint rerating */
19041897 case 'h':
1905- do_cmd_rerate(TRUE);
1898+ do_cmd_rerate(SPOP_DISPLAY_MES | SPOP_DEBUG);
19061899 break;
19071900
19081901 case 'H':
Show on old repository browser