OSDN Git Service

[Refactor] #37353 マジックナンバー修正(A_MAX) / Fix magic number (A_MAX).
[hengband/hengband.git] / src / xtra2.c
index 5271123..1a9c191 100644 (file)
@@ -139,7 +139,7 @@ void check_experience(void)
                                                choice = inkey();
                                                if ((choice >= 'a') && (choice <= 'f')) break;
                                        }
-                                       for(n = 0; n < 6; n++)
+                                       for(n = 0; n < A_MAX; n++)
                                                if (n != choice - 'a')
                                                        prt("",n+2,14);
                                        if (get_check(_("よろしいですか?", "Are you sure? "))) break;
@@ -188,7 +188,7 @@ void check_experience(void)
  * Used to allocate proper treasure when "Creeping coins" die
  * Note the use of actual "monster names"
  */
-static int get_coin_type(MONRACE_IDX r_idx)
+static OBJECT_SUBTYPE_VALUE get_coin_type(MONRACE_IDX r_idx)
 {
        /* Analyze monsters */
        switch (r_idx)
@@ -471,8 +471,6 @@ void check_quest_completion(monster_type *m_ptr)
 
                        /* Make a great object */
                        make_object(o_ptr, AM_GOOD | AM_GREAT);
-
-                       /* Drop it in the dungeon */
                        (void)drop_near(o_ptr, -1, y, x);
                }
        }
@@ -640,8 +638,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                        /* Prepare to make a prize */
                        object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval));
                        apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
-
-                       /* Drop it in the dungeon */
                        (void)drop_near(q_ptr, -1, y, x);
                }
 
@@ -704,8 +700,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
 
                q_ptr->pval = m_ptr->r_idx;
-
-               /* Drop it in the dungeon */
                (void)drop_near(q_ptr, -1, y, x);
        }
 
@@ -751,8 +745,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                        object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS));
 
                        apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | mo_mode);
-
-                       /* Drop it in the dungeon */
                        (void)drop_near(q_ptr, -1, y, x);
                }
                break;
@@ -771,8 +763,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
 
                        /* Make a book */
                        make_object(q_ptr, mo_mode);
-
-                       /* Drop it in the dungeon */
                        (void)drop_near(q_ptr, -1, y, x);
                }
                break;
@@ -873,8 +863,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
 
                /* Mega-Hack -- Actually create "Grond" */
                apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
-
-               /* Drop it in the dungeon */
                (void)drop_near(q_ptr, -1, y, x);
                q_ptr = &forge;
 
@@ -886,8 +874,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
 
                /* Mega-Hack -- Actually create "Chaos" */
                apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
-
-               /* Drop it in the dungeon */
                (void)drop_near(q_ptr, -1, y, x);
                break;
 
@@ -898,8 +884,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
 
                        /* Prepare to make a broken sword */
                        object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2)));
-
-                       /* Drop it in the dungeon */
                        (void)drop_near(q_ptr, -1, y, x);
                }
                break;
@@ -915,8 +899,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                        object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME));
 
                        apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
-
-                       /* Drop it in the dungeon */
                        (void)drop_near(q_ptr, -1, y, x);
                }
                break;
@@ -944,8 +926,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
 
                                /* Make a cloak */
                                make_object(q_ptr, mo_mode);
-
-                               /* Drop it in the dungeon */
                                (void)drop_near(q_ptr, -1, y, x);
                        }
                        break;
@@ -961,8 +941,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
 
                                /* Make a poleweapon */
                                make_object(q_ptr, mo_mode);
-
-                               /* Drop it in the dungeon */
                                (void)drop_near(q_ptr, -1, y, x);
                        }
                        break;
@@ -978,8 +956,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
 
                                /* Make a hard armor */
                                make_object(q_ptr, mo_mode);
-
-                               /* Drop it in the dungeon */
                                (void)drop_near(q_ptr, -1, y, x);
                        }
                        break;
@@ -995,8 +971,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
 
                                /* Make a hafted weapon */
                                make_object(q_ptr, mo_mode);
-
-                               /* Drop it in the dungeon */
                                (void)drop_near(q_ptr, -1, y, x);
                        }
                        break;
@@ -1012,8 +986,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
 
                                /* Make a sword */
                                make_object(q_ptr, mo_mode);
-
-                               /* Drop it in the dungeon */
                                (void)drop_near(q_ptr, -1, y, x);
                        }
                        break;
@@ -1087,8 +1059,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                                object_prep(q_ptr, k_idx);
 
                                apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | AM_GOOD);
-
-                               /* Drop it in the dungeon */
                                (void)drop_near(q_ptr, -1, y, x);
                        }
                        msg_format(_("あなたは%sを制覇した!", "You have conquered %s!"),d_name+d_info[dungeon_type].name);
@@ -1142,8 +1112,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
 
                        dump_item++;
                }
-
-               /* Drop it in the dungeon */
                (void)drop_near(q_ptr, -1, y, x);
        }
 
@@ -2688,15 +2656,12 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, cptr info)
        /* Hack -- under the player */
        if (player_bold(y, x))
        {
-               /* Description */
 #ifdef JP
                s1 = "あなたは";
                s2 = "の上";
                s3 = "にいる";
 #else
                s1 = "You are ";
-
-               /* Preposition */
                s2 = "on ";
 #endif
        }
@@ -4324,8 +4289,6 @@ void gain_level_reward(int chosen_reward)
                        q_ptr->to_d = 3 + randint1(dun_level) % 10;
                        one_resistance(q_ptr);
                        q_ptr->name2 = EGO_CHAOTIC;
-
-                       /* Drop it in the dungeon */
                        (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
                        reward = _("(混沌)の武器を手に入れた。", "chaos weapon");
                        break;
@@ -4451,7 +4414,7 @@ void gain_level_reward(int chosen_reward)
                        msg_print(_("「汝、謙虚たることを学ぶべし!」", "'Thou needst a lesson in humility, mortal!'"));
                        msg_print(_("あなたは以前より弱くなった!", "You feel less powerful!"));
 
-                       for (dummy = 0; dummy < 6; dummy++)
+                       for (dummy = 0; dummy < A_MAX; dummy++)
                        {
                                (void)dec_stat(dummy, 10 + randint1(15), TRUE);
                        }
@@ -4472,7 +4435,7 @@ void gain_level_reward(int chosen_reward)
 
                        msg_print(_("「我がささやかなる賜物を受けとるがよい!」", "'Receive this modest gift from me!'"));
 
-                       for (dummy = 0; dummy < 6; dummy++)
+                       for (dummy = 0; dummy < A_MAX; dummy++)
                        {
                                (void)do_inc_stat(dummy);
                        }
@@ -4563,7 +4526,7 @@ void gain_level_reward(int chosen_reward)
                                        }
                                        break;
                                default:
-                                       for (dummy = 0; dummy < 6; dummy++)
+                                       for (dummy = 0; dummy < A_MAX; dummy++)
                                        {
                                                (void)dec_stat(dummy, 10 + randint1(15), TRUE);
                                        }
@@ -4578,7 +4541,7 @@ void gain_level_reward(int chosen_reward)
                        msg_print(_("「死ぬがよい、下僕よ!」", "'Die, mortal!'"));
 
                        take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
-                       for (dummy = 0; dummy < 6; dummy++)
+                       for (dummy = 0; dummy < A_MAX; dummy++)
                        {
                                (void)dec_stat(dummy, 10 + randint1(15), FALSE);
                        }
@@ -5149,59 +5112,6 @@ int bow_tmul(OBJECT_SUBTYPE_VALUE sval)
        return (tmul);
 }
 
-/*
- * Return alignment title
- */
-cptr your_alignment(void)
-{
-       if (p_ptr->align > 150) return _("大善", "Lawful");
-       else if (p_ptr->align > 50) return _("中善", "Good");
-       else if (p_ptr->align > 10) return _("小善", "Neutral Good");
-       else if (p_ptr->align > -11) return _("中立", "Neutral");
-       else if (p_ptr->align > -51) return _("小悪", "Neutral Evil");
-       else if (p_ptr->align > -151) return _("中悪", "Evil");
-       else return _("大悪", "Chaotic");
-}
-
-
-/*
- * Return proficiency level of weapons and misc. skills (except riding)
- */
-int weapon_exp_level(int weapon_exp)
-{
-       if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
-       else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
-       else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
-       else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
-       else return EXP_LEVEL_MASTER;
-}
-
-
-/*
- * Return proficiency level of riding
- */
-int riding_exp_level(int riding_exp)
-{
-       if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
-       else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
-       else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
-       else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
-       else return EXP_LEVEL_MASTER;
-}
-
-
-/*
- * Return proficiency level of spells
- */
-int spell_exp_level(int spell_exp)
-{
-       if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
-       else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
-       else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
-       else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
-       else return EXP_LEVEL_MASTER;
-}
-
 
 /*
  * Display a rumor and apply its effects