OSDN Git Service

[Refactor] #37353 Defined MAX_SPELLS constant value in spells-util.h
authorHourier <hourier@users.sourceforge.jp>
Sun, 5 Jul 2020 03:44:23 +0000 (12:44 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 5 Jul 2020 03:44:23 +0000 (12:44 +0900)
17 files changed:
src/birth/game-play-initializer.c
src/cmd-action/cmd-hissatsu.c
src/cmd-action/cmd-spell.c
src/cmd-building/cmd-inn.c
src/cmd-item/cmd-magiceat.c
src/grid/grid.h
src/knowledge/knowledge-experiences.c
src/object-potion/quaff-execution.c
src/player/player-status.c
src/player/player-status.h
src/realm/realm-hissatsu.c
src/savedata/extra-loader.c
src/savedata/save.c
src/spell/spell-info.c
src/spell/spells-util.h
src/view/display-sub-window-spells.c
src/wizard/wizard-special-process.c

index a03acd6..fdf0eb6 100644 (file)
@@ -137,7 +137,7 @@ void player_wipe_without_name(player_type *creature_ptr)
     creature_ptr->visit = 1;
     creature_ptr->wild_mode = FALSE;
 
-    for (int i = 0; i < 108; i++) {
+    for (int i = 0; i < MAX_SPELLS; i++) {
         creature_ptr->magic_num1[i] = 0;
         creature_ptr->magic_num2[i] = 0;
     }
index 83a96cd..530993d 100644 (file)
@@ -27,7 +27,6 @@
 #include "player/player-status.h"
 #include "player/special-defense-types.h"
 #include "spell/spells-execution.h"
-#include "spell/spells-util.h"
 #include "spell/technic-info-table.h"
 #include "system/object-type-definition.h"
 #include "term/screen-processor.h"
index b2fe724..3bb7780 100644 (file)
@@ -49,7 +49,6 @@
 #include "spell/spells-execution.h"
 #include "spell/spell-info.h"
 #include "spell/spells-summon.h"
-#include "spell/spells-util.h"
 #include "spell/technic-info-table.h"
 #include "status/base-status.h"
 #include "status/experience.h"
index 8571a64..bcf4ea5 100644 (file)
@@ -152,7 +152,7 @@ static void charge_magic_eating_energy(player_type *customer_ptr)
                customer_ptr->magic_num1[i] = customer_ptr->magic_num2[i] * EATER_CHARGE;
        }
 
-       for (; i < 108; i++)
+       for (; i < MAX_SPELLS; i++)
        {
                customer_ptr->magic_num1[i] = 0;
        }
index 5fd6eb9..519ca00 100644 (file)
@@ -106,11 +106,12 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(player_type *creature_ptr, bool o
                        return sn;
        }
        
-       for (i = 0; i < 108; i++)
+       for (i = 0; i < MAX_SPELLS; i++)
        {
                if (creature_ptr->magic_num2[i]) break;
        }
-       if (i == 108)
+
+       if (i == MAX_SPELLS)
        {
                msg_print(_("魔法を覚えていない!", "You don't have any magic!"));
                return -1;
index 9811248..50719ce 100644 (file)
@@ -15,8 +15,8 @@
  */
 
 #include "system/angband.h"
-#include "spell/spells-util.h"
 #include "floor/geometry.h"
+#include "spell/spells-util.h"
 
  /*
   * A single "grid" in a Cave
index ea3bada..6a91525 100644 (file)
@@ -15,7 +15,6 @@
 #include "player/player-skill.h"
 #include "realm/realm-names-table.h"
 #include "spell/spells-execution.h"
-#include "spell/spells-util.h"
 #include "spell/technic-info-table.h"
 #include "util/angband-files.h"
 
index 913cb8e..4c1605a 100644 (file)
@@ -31,7 +31,6 @@
 #include "spell-kind/spells-teleport.h"
 #include "spell-realm/spells-hex.h"
 #include "spell/spells-status.h"
-#include "spell/spells-util.h"
 #include "status/bad-status-setter.h"
 #include "status/base-status.h"
 #include "status/body-improvement.h"
index 6e7eeae..6164dc1 100644 (file)
@@ -76,7 +76,6 @@
 #include "spell/spells-describer.h"
 #include "spell/spells-execution.h"
 #include "spell/spells-status.h"
-#include "spell/spells-util.h"
 #include "spell/technic-info-table.h"
 #include "status/base-status.h"
 #include "sv-definition/sv-lite-types.h"
index f0f1c9e..7cff06f 100644 (file)
@@ -1,9 +1,9 @@
 #pragma once 
 
-/* 人畜無害なenumヘッダを先に読み込む */
 #include "player/player-classes-types.h"
 #include "player/player-race-types.h"
 #include "player/player-personalities-types.h"
+#include "spell/spells-util.h"
 
 /*
  * Most of the "player" information goes here.
@@ -278,8 +278,8 @@ typedef struct player_type
        SUB_EXP weapon_exp[5][64];    /* Proficiency of weapons */
        SUB_EXP skill_exp[GINOU_MAX]; /* Proficiency of misc. skill */
 
-       MAGIC_NUM1 magic_num1[108];     /*!< Array for non-spellbook type magic */
-       MAGIC_NUM2 magic_num2[108];     /*!< 魔道具術師の取り込み済魔道具使用回数 / Flags for non-spellbook type magics */
+       MAGIC_NUM1 magic_num1[MAX_SPELLS];     /*!< Array for non-spellbook type magic */
+       MAGIC_NUM2 magic_num2[MAX_SPELLS];     /*!< 魔道具術師の取り込み済魔道具使用回数 / Flags for non-spellbook type magics */
 
        SPELL_IDX mane_spell[MAX_MANE];
        HIT_POINT mane_dam[MAX_MANE];
index d89faf8..4370ae5 100644 (file)
@@ -36,7 +36,6 @@
 #include "spell-kind/spells-sight.h"
 #include "spell-kind/spells-teleport.h"
 #include "spell/spell-types.h"
-#include "spell/spells-util.h"
 #include "spell/technic-info-table.h"
 #include "term/screen-processor.h"
 #include "util/bit-flags-calculator.h"
index 6db3f2a..f83f9b6 100644 (file)
@@ -134,14 +134,15 @@ void rd_extra(player_type *creature_ptr)
         set_zangband_skill(creature_ptr);
 
     if (z_older_than(10, 3, 14)) {
-        for (int i = 0; i < 108; i++)
+        for (int i = 0; i < MAX_SPELLS; i++)
             creature_ptr->magic_num1[i] = 0;
-        for (int i = 0; i < 108; i++)
+
+        for (int i = 0; i < MAX_SPELLS; i++)
             creature_ptr->magic_num2[i] = 0;
     } else {
-        for (int i = 0; i < 108; i++)
+        for (int i = 0; i < MAX_SPELLS; i++)
             rd_s32b(&creature_ptr->magic_num1[i]);
-        for (int i = 0; i < 108; i++)
+        for (int i = 0; i < MAX_SPELLS; i++)
             rd_byte(&creature_ptr->magic_num2[i]);
         if (h_older_than(1, 3, 0, 1)) {
             if (creature_ptr->pclass == CLASS_SMITH) {
index 576e5dd..90936a4 100644 (file)
@@ -725,9 +725,9 @@ static void wr_extra(player_type *creature_ptr)
 
     for (int i = 0; i < GINOU_MAX; i++)
         wr_s16b(creature_ptr->skill_exp[i]);
-    for (int i = 0; i < 108; i++)
+    for (int i = 0; i < MAX_SPELLS; i++)
         wr_s32b(creature_ptr->magic_num1[i]);
-    for (int i = 0; i < 108; i++)
+    for (int i = 0; i < MAX_SPELLS; i++)
         wr_byte(creature_ptr->magic_num2[i]);
 
     wr_byte((byte)creature_ptr->start_race);
index 7659476..b902a40 100644 (file)
@@ -7,7 +7,6 @@
 #include "realm/realm-names-table.h"
 #include "realm/realm-types.h"
 #include "spell/spells-execution.h"
-#include "spell/spells-util.h"
 #include "term/screen-processor.h"
 #include "term/term-color-types.h"
 #include "util/int-char-converter.h"
index 39bbbe1..c99b670 100644 (file)
@@ -1,37 +1,26 @@
 #pragma once
 
 #define DETECT_RAD_DEFAULT 30
-#define DETECT_RAD_MAP     30
-#define DETECT_RAD_ALL     255
+#define DETECT_RAD_MAP 30
+#define DETECT_RAD_ALL 255
+#define MAX_SPELLS 108
 
-typedef enum spell_type
-{
-       SPELL_NAME = 0,
-       SPELL_DESC = 1,
-       SPELL_INFO = 2,
-       SPELL_CAST = 3,
-       SPELL_FAIL = 4,
-       SPELL_STOP = 5,
-       SPELL_CONT = 6
-} spell_type;
+typedef enum spell_type { SPELL_NAME = 0, SPELL_DESC = 1, SPELL_INFO = 2, SPELL_CAST = 3, SPELL_FAIL = 4, SPELL_STOP = 5, SPELL_CONT = 6 } spell_type;
 
-typedef enum spell_operation
-{
-       SPOP_DISPLAY_MES = 0x0001,      // !< スペル処理オプション … メッセージを表示する
-       SPOP_NO_UPDATE = 0x0002,        // !< スペル処理オプション … ステータス更新を解決後行う
-       SPOP_DEBUG = 0x8000                     // !< スペル処理オプション … デバッグ処理あり
+typedef enum spell_operation {
+    SPOP_DISPLAY_MES = 0x0001, // !< スペル処理オプション … メッセージを表示する
+    SPOP_NO_UPDATE = 0x0002, // !< スペル処理オプション … ステータス更新を解決後行う
+    SPOP_DEBUG = 0x8000 // !< スペル処理オプション … デバッグ処理あり
 } spell_operation;
 
-typedef enum teleport_flags
-{
-       TELEPORT_SPONTANEOUS    = 0x0000,
-       TELEPORT_NONMAGICAL             = 0x0001,
-       TELEPORT_PASSIVE                = 0x0002,
-       TELEPORT_DEC_VALOUR             = 0x0004
+typedef enum teleport_flags {
+    TELEPORT_SPONTANEOUS = 0x0000,
+    TELEPORT_NONMAGICAL = 0x0001,
+    TELEPORT_PASSIVE = 0x0002,
+    TELEPORT_DEC_VALOUR = 0x0004
 } teleport_flags;
 
-typedef enum autogenesis_magical_effect
-{
-       PROJECT_WHO_UNCTRL_POWER = -1, /*!< 魔法効果の自然発生要因: 名状し難い力の解放 */
-       PROJECT_WHO_GLASS_SHARDS = -2 /*!< 魔法効果の自然発生要因: 破壊されたガラス地形の破片 */
+typedef enum autogenesis_magical_effect {
+    PROJECT_WHO_UNCTRL_POWER = -1, /*!< 魔法効果の自然発生要因: 名状し難い力の解放 */
+    PROJECT_WHO_GLASS_SHARDS = -2 /*!< 魔法効果の自然発生要因: 破壊されたガラス地形の破片 */
 } autogenesis_magical_effect;
index 9114f3e..59173ca 100644 (file)
@@ -5,7 +5,6 @@
 #include "player/player-class.h"
 #include "realm/realm-names-table.h"
 #include "spell/spells-execution.h"
-#include "spell/spells-util.h"
 #include "spell/technic-info-table.h"
 #include "term/gameterm.h"
 #include "term/screen-processor.h"
index 720e6a0..cb7755c 100644 (file)
@@ -71,7 +71,6 @@
 #include "spell/spells-object.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
-#include "spell/spells-util.h"
 #include "status/experience.h"
 #include "system/alloc-entries.h"
 #include "system/angband-version.h"