OSDN Git Service

[Refactor] #3308 OBJECT_SUBTYPE_VALUE 型エイリアスを削除した
authorHourier <66951241+Hourier@users.noreply.github.com>
Tue, 16 May 2023 13:24:36 +0000 (22:24 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Tue, 16 May 2023 13:24:36 +0000 (22:24 +0900)
15 files changed:
src/cmd-action/cmd-spell.cpp
src/cmd-item/cmd-magiceat.cpp
src/cmd-item/cmd-usestaff.cpp
src/cmd-item/cmd-usestaff.h
src/cmd-item/cmd-zaprod.cpp
src/cmd-item/cmd-zaprod.h
src/cmd-item/cmd-zapwand.cpp
src/cmd-item/cmd-zapwand.h
src/mind/mind-archer.cpp
src/mind/mind-chaos-warrior.cpp
src/monster-floor/monster-death-util.cpp
src/object-enchant/others/apply-magic-others.cpp
src/system/h-type.h
src/system/system-variables.cpp
src/system/system-variables.h

index 4a4d0b8..94aaccb 100644 (file)
@@ -305,7 +305,7 @@ static bool spell_okay(PlayerType *player_ptr, int spell, bool learned, bool stu
  * The "known" should be TRUE for cast/pray, FALSE for study
  * </pre>
  */
-static int get_spell(PlayerType *player_ptr, SPELL_IDX *sn, concptr prompt, OBJECT_SUBTYPE_VALUE sval, bool learned, int16_t use_realm)
+static int get_spell(PlayerType *player_ptr, SPELL_IDX *sn, concptr prompt, int sval, bool learned, int16_t use_realm)
 {
     int i;
     SPELL_IDX spell = -1;
index 2bd675e..74f1bd9 100644 (file)
@@ -139,7 +139,6 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
     char choice;
     bool flag, request_list;
     auto tval = ItemKindType::NONE;
-    OBJECT_SUBTYPE_VALUE i = 0;
     char out_val[160];
 
     int menu_line = (use_menu ? 1 : 0);
@@ -250,12 +249,12 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
 
     request_list = always_show_list;
 
-    const int ITEM_GROUP_SIZE = item_group.size();
+    const int item_group_size = item_group.size();
+    auto sval = 0;
     while (!flag) {
         /* Show the list */
         if (request_list || use_menu) {
             byte y, x = 0;
-            OBJECT_SUBTYPE_VALUE ctr;
             PERCENTAGE chance;
             short bi_id;
             POSITION x1, y1;
@@ -280,17 +279,17 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
 #endif
 
             /* Print list */
-            for (ctr = 0; ctr < ITEM_GROUP_SIZE; ctr++) {
-                auto &item = item_group[ctr];
+            for (auto sval_ctr = 0; sval_ctr < item_group_size; sval_ctr++) {
+                auto &item = item_group[sval_ctr];
                 if (item.count == 0) {
                     continue;
                 }
 
-                bi_id = lookup_baseitem_id({ tval, ctr });
+                bi_id = lookup_baseitem_id({ tval, sval_ctr });
 
                 std::string dummy;
                 if (use_menu) {
-                    if (ctr == (menu_line - 1)) {
+                    if (sval_ctr == (menu_line - 1)) {
                         dummy = _("》", "> ");
                     } else {
                         dummy = "  ";
@@ -299,15 +298,15 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
                 /* letter/number for power selection */
                 else {
                     char letter;
-                    if (ctr < 26) {
-                        letter = I2A(ctr);
+                    if (sval_ctr < 26) {
+                        letter = I2A(sval_ctr);
                     } else {
-                        letter = '0' + ctr - 26;
+                        letter = '0' + sval_ctr - 26;
                     }
                     dummy = format("%c)", letter);
                 }
-                x1 = ((ctr < ITEM_GROUP_SIZE / 2) ? x : x + 40);
-                y1 = ((ctr < ITEM_GROUP_SIZE / 2) ? y + ctr : y + ctr - ITEM_GROUP_SIZE / 2);
+                x1 = ((sval_ctr < item_group_size / 2) ? x : x + 40);
+                y1 = ((sval_ctr < item_group_size / 2) ? y + sval_ctr : y + sval_ctr - item_group_size / 2);
                 const auto &baseitem = baseitems_info[bi_id];
                 level = (tval == ItemKindType::ROD ? baseitem.level * 5 / 6 - 5 : baseitem.level);
                 chance = level * 4 / 5 + 20;
@@ -370,9 +369,9 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
             case 'k':
             case 'K': {
                 do {
-                    menu_line += ITEM_GROUP_SIZE - 1;
-                    if (menu_line > ITEM_GROUP_SIZE) {
-                        menu_line -= ITEM_GROUP_SIZE;
+                    menu_line += item_group_size - 1;
+                    if (menu_line > item_group_size) {
+                        menu_line -= item_group_size;
                     }
                 } while (item_group[menu_line - 1].count == 0);
                 break;
@@ -383,8 +382,8 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
             case 'J': {
                 do {
                     menu_line++;
-                    if (menu_line > ITEM_GROUP_SIZE) {
-                        menu_line -= ITEM_GROUP_SIZE;
+                    if (menu_line > item_group_size) {
+                        menu_line -= item_group_size;
                     }
                 } while (item_group[menu_line - 1].count == 0);
                 break;
@@ -400,11 +399,11 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
                 if ((choice == '4') || (choice == 'h') || (choice == 'H')) {
                     reverse = true;
                 }
-                if (menu_line > ITEM_GROUP_SIZE / 2) {
-                    menu_line -= ITEM_GROUP_SIZE / 2;
+                if (menu_line > item_group_size / 2) {
+                    menu_line -= item_group_size / 2;
                     reverse = true;
                 } else {
-                    menu_line += ITEM_GROUP_SIZE / 2;
+                    menu_line += item_group_size / 2;
                 }
                 while (item_group[menu_line - 1].count == 0) {
                     if (reverse) {
@@ -414,7 +413,7 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
                         }
                     } else {
                         menu_line++;
-                        if (menu_line > ITEM_GROUP_SIZE - 1) {
+                        if (menu_line > item_group_size - 1) {
                             reverse = true;
                         }
                     }
@@ -425,7 +424,7 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
             case 'x':
             case 'X':
             case '\r': {
-                i = menu_line - 1;
+                sval = menu_line - 1;
                 should_redraw_cursor = false;
                 break;
             }
@@ -455,22 +454,22 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
 
         if (!use_menu) {
             if (isalpha(choice)) {
-                i = A2I(choice);
+                sval = A2I(choice);
             } else {
-                i = choice - '0' + 26;
+                sval = choice - '0' + 26;
             }
         }
 
         /* Totally Illegal */
-        if ((i < 0) || (i > ITEM_GROUP_SIZE) || item_group[i].count == 0) {
+        if ((sval < 0) || (sval > item_group_size) || item_group[sval].count == 0) {
             bell();
             continue;
         }
 
         if (!only_browse) {
-            auto &item = item_group[i];
+            auto &item = item_group[sval];
             if (tval == ItemKindType::ROD) {
-                if (item.charge > baseitems_info[lookup_baseitem_id({ tval, i })].pval * (item.count - 1) * EATER_ROD_CHARGE) {
+                if (item.charge > baseitems_info[lookup_baseitem_id({ tval, sval })].pval * (item.count - 1) * EATER_ROD_CHARGE) {
                     msg_print(_("その魔法はまだ充填している最中だ。", "The magic is still charging."));
                     msg_print(nullptr);
                     continue;
@@ -492,7 +491,7 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
             term_erase(7, 21, 255);
             term_erase(7, 20, 255);
 
-            display_wrap_around(baseitems_info[lookup_baseitem_id({ tval, i })].text, 62, 21, 10);
+            display_wrap_around(baseitems_info[lookup_baseitem_id({ tval, sval })].text, 62, 21, 10);
             continue;
         }
 
@@ -520,9 +519,9 @@ static std::optional<BaseitemKey> select_magic_eater(PlayerType *player_ptr, boo
         break;
     }
 
-    repeat_push(base + i);
+    repeat_push(base + sval);
 
-    return BaseitemKey(tval, i);
+    return BaseitemKey(tval, sval);
 }
 
 /*!
index c854f38..b447716 100644 (file)
@@ -50,7 +50,7 @@
  * @param known 判明済ならばTRUE
  * @return 発動により効果内容が確定したならばTRUEを返す
  */
-int staff_effect(PlayerType *player_ptr, OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, bool magic, bool known)
+int staff_effect(PlayerType *player_ptr, int sval, bool *use_charge, bool powerful, bool magic, bool known)
 {
     int k;
     bool ident = false;
index 8fc9b1d..165d70e 100644 (file)
@@ -1,7 +1,5 @@
 #pragma once
 
-#include "system/angband.h"
-
 class PlayerType;
-int staff_effect(PlayerType *player_ptr, OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, bool magic, bool known);
+int staff_effect(PlayerType *player_ptr, int sval, bool *use_charge, bool powerful, bool magic, bool known);
 void do_cmd_use_staff(PlayerType *player_ptr);
index f517827..7c2a226 100644 (file)
@@ -42,7 +42,7 @@
  * @param powerful 強力発動上の処理ならばTRUE
  * @return 発動により効果内容が確定したならばTRUEを返す
  */
-int rod_effect(PlayerType *player_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool powerful)
+int rod_effect(PlayerType *player_ptr, int sval, int dir, bool *use_charge, bool powerful)
 {
     int ident = false;
     PLAYER_LEVEL lev = powerful ? player_ptr->lev * 2 : player_ptr->lev;
index 847d4ba..02a71b2 100644 (file)
@@ -1,7 +1,5 @@
 #pragma once
 
-#include "system/angband.h"
-
 class PlayerType;
-int rod_effect(PlayerType *player_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool powerful);
+int rod_effect(PlayerType *player_ptr, int sval, int dir, bool *use_charge, bool powerful);
 void do_cmd_zap_rod(PlayerType *player_ptr);
index a8f4adf..22dbf87 100644 (file)
@@ -51,7 +51,7 @@
  * @param magic 魔道具術上の処理ならばTRUE
  * @return 発動により効果内容が確定したならばTRUEを返す
  */
-bool wand_effect(PlayerType *player_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool powerful, bool magic)
+bool wand_effect(PlayerType *player_ptr, int sval, int dir, bool powerful, bool magic)
 {
     bool ident = false;
     PLAYER_LEVEL lev = powerful ? player_ptr->lev * 2 : player_ptr->lev;
@@ -60,7 +60,7 @@ bool wand_effect(PlayerType *player_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION di
     /* XXX Hack -- Wand of wonder can do anything before it */
     if (sval == SV_WAND_WONDER) {
         int vir = virtue_number(player_ptr, Virtue::CHANCE);
-        sval = (OBJECT_SUBTYPE_VALUE)randint0(SV_WAND_WONDER);
+        sval = randint0(SV_WAND_WONDER);
 
         if (vir) {
             if (player_ptr->virtues[vir - 1] > 0) {
index d52173e..947d7ae 100644 (file)
@@ -1,7 +1,5 @@
 #pragma once
 
-#include "system/angband.h"
-
 class PlayerType;
-bool wand_effect(PlayerType *player_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool powerful, bool magic);
+bool wand_effect(PlayerType *player_ptr, int sval, int dir, bool powerful, bool magic);
 void do_cmd_aim_wand(PlayerType *player_ptr);
index f8b6c41..15c6a9a 100644 (file)
@@ -126,7 +126,7 @@ bool create_ammo(PlayerType *player_ptr)
 
         ItemEntity forge;
         auto *q_ptr = &forge;
-        q_ptr->prep(lookup_baseitem_id({ ItemKindType::SHOT, (OBJECT_SUBTYPE_VALUE)m_bonus(1, player_ptr->lev) + 1 }));
+        q_ptr->prep(lookup_baseitem_id({ ItemKindType::SHOT, m_bonus(1, player_ptr->lev) + 1 }));
         q_ptr->number = (byte)rand_range(15, 30);
         object_aware(player_ptr, q_ptr);
         object_known(q_ptr);
index de5d70a..4658e17 100644 (file)
@@ -14,7 +14,7 @@ void acquire_chaos_weapon(PlayerType *player_ptr)
     ItemEntity forge;
     auto *q_ptr = &forge;
     auto dummy = ItemKindType::SWORD;
-    OBJECT_SUBTYPE_VALUE dummy2;
+    int dummy2;
     switch (randint1(player_ptr->lev)) {
     case 0:
     case 1:
index eb4d05c..fcb76b5 100644 (file)
@@ -19,7 +19,7 @@
  * Used to allocate proper treasure when "Creeping coins" die
  * Note the use of actual "monster names"
  */
-static OBJECT_SUBTYPE_VALUE get_coin_type(MonsterRaceId r_idx)
+static int get_coin_type(MonsterRaceId r_idx)
 {
     switch (r_idx) {
     case MonsterRaceId::COPPER_COINS:
index 004de6c..bcd3e52 100644 (file)
@@ -138,7 +138,7 @@ void OtherItemsEnchanter::generate_figurine()
  */
 void OtherItemsEnchanter::generate_corpse()
 {
-    const std::unordered_map<OBJECT_SUBTYPE_VALUE, MonsterDropType> match = {
+    const std::unordered_map<int, MonsterDropType> match = {
         { SV_SKELETON, MonsterDropType::DROP_SKELETON },
         { SV_CORPSE, MonsterDropType::DROP_CORPSE },
     };
index e826d46..408c4fa 100644 (file)
@@ -127,7 +127,6 @@ typedef int DIRECTION; /*!< ゲーム中の方角の型定義 */
 typedef int32_t EXP; /*!< ゲーム中の主経験値の型定義 */
 typedef int16_t SUB_EXP; /*!< ゲーム中の副経験値の型定義 */
 
-typedef int32_t OBJECT_SUBTYPE_VALUE; /*!< ゲーム中のアイテム副分類の型定義 */
 typedef int16_t PARAMETER_VALUE; /*!< ゲーム中のアイテム能力値の型定義 */
 typedef int32_t WEIGHT; /*!< ゲーム中の重量の型定義(ポンド) */
 
index 2ed0cee..5371db7 100644 (file)
@@ -31,4 +31,4 @@ init_flags_type init_flags; //!< @todo このグローバル変数何とかし
  */
 bool (*get_obj_index_hook)(short bi_id);
 
-OBJECT_SUBTYPE_VALUE coin_type;
+int coin_type;
index bb0399b..6e5851d 100644 (file)
@@ -27,5 +27,5 @@ extern concptr ANGBAND_SYS;
 extern concptr ANGBAND_KEYBOARD;
 extern concptr ANGBAND_GRAF;
 
-extern OBJECT_SUBTYPE_VALUE coin_type;
+extern int coin_type;
 extern bool (*get_obj_index_hook)(short bi_id);