OSDN Git Service

[fix] MPの無い職業に設定される定数を定義
authorHabu <habu@users.osdn.me>
Sun, 7 Feb 2021 08:22:21 +0000 (17:22 +0900)
committerHabu <habu@users.osdn.me>
Sun, 7 Feb 2021 08:22:21 +0000 (17:22 +0900)
m_info.txtにおいて、MPの無い職業のspell_firstに99を設定するが、
ソースコード上ではマジックナンバーとならないように
SPELL_FIRST_NO_SPELL を定義して使用する。

src/player/player-class.h
src/player/player-status.c
src/window/main-window-left-frame.c

index 661c444..f2900df 100644 (file)
@@ -7,6 +7,9 @@
 #include "system/angband.h"
 #include "spell/technic-info-table.h"
 
+/** m_info.txtでMPの無い職業に設定される */
+#define SPELL_FIRST_NO_SPELL 99
+
 /*
  * Information about the player's "magic"
  *
index c3ca968..92d47ab 100644 (file)
@@ -893,7 +893,7 @@ static void calc_spells(player_type *creature_ptr)
  */
 static void calc_mana(player_type *creature_ptr)
 {
-    if (!mp_ptr->spell_book && mp_ptr->spell_first == 99)
+    if (!mp_ptr->spell_book && mp_ptr->spell_first == SPELL_FIRST_NO_SPELL)
         return;
 
     int levels;
index 5ada11a..f74f658 100644 (file)
@@ -140,7 +140,7 @@ void print_sp(player_type *creature_ptr)
 {
     char tmp[32];
     byte color;
-    if (!mp_ptr->spell_book && mp_ptr->spell_first == 99)
+    if (!mp_ptr->spell_book && mp_ptr->spell_first == SPELL_FIRST_NO_SPELL)
         return;
 
     put_str(_("MP", "SP"), ROW_CURSP, COL_CURSP);