* @param o_ptr 対象のオブジェクト構造体ポインタ
* @return オブジェクトが適正武器ならばTRUEを返す
*/
-bool object_is_favorite(player_type *player_ptr, const object_type *o_ptr)
+bool object_is_favorite(PlayerType *player_ptr, const object_type *o_ptr)
{
/* Only melee weapons match */
if (!(o_ptr->tval == ItemKindType::POLEARM || o_ptr->tval == ItemKindType::SWORD || o_ptr->tval == ItemKindType::DIGGING || o_ptr->tval == ItemKindType::HAFTED)) {
}
/* Favorite weapons are varied depend on the class */
+ auto short_pclass = enum2i(player_ptr->pclass);
switch (player_ptr->pclass) {
- case CLASS_PRIEST: {
+ case PlayerClassType::PRIEST: {
auto flgs = object_flags_known(o_ptr);
if (flgs.has_not(TR_BLESSED) && !(o_ptr->tval == ItemKindType::HAFTED))
break;
}
- case CLASS_MONK:
- case CLASS_FORCETRAINER:
+ case PlayerClassType::MONK:
+ case PlayerClassType::FORCETRAINER:
/* Icky to wield? */
- if (!(s_info[player_ptr->pclass].w_max[enum2i(o_ptr->tval) - enum2i(TV_WEAPON_BEGIN)][o_ptr->sval]))
+ if (!(s_info[short_pclass].w_max[o_ptr->tval][o_ptr->sval]))
return false;
break;
- case CLASS_BEASTMASTER:
- case CLASS_CAVALRY: {
+ case PlayerClassType::BEASTMASTER:
+ case PlayerClassType::CAVALRY: {
auto flgs = object_flags_known(o_ptr);
/* Is it known to be suitable to using while riding? */
break;
}
- case CLASS_SORCERER:
- if (s_info[player_ptr->pclass].w_max[enum2i(o_ptr->tval) - enum2i(TV_WEAPON_BEGIN)][o_ptr->sval] < WEAPON_EXP_MASTER)
+ case PlayerClassType::SORCERER:
+ if (s_info[short_pclass].w_max[o_ptr->tval][o_ptr->sval] < PlayerSkill::weapon_exp_at(PlayerSkillRank::MASTER))
return false;
break;
- case CLASS_NINJA:
+ case PlayerClassType::NINJA:
/* Icky to wield? */
- if (s_info[player_ptr->pclass].w_max[enum2i(o_ptr->tval) - enum2i(TV_WEAPON_BEGIN)][o_ptr->sval] <= WEAPON_EXP_BEGINNER)
+ if (s_info[short_pclass].w_max[o_ptr->tval][o_ptr->sval] <= PlayerSkill::weapon_exp_at(PlayerSkillRank::BEGINNER))
return false;
break;