* @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 == TV_POLEARM || o_ptr->tval == TV_SWORD || o_ptr->tval == TV_DIGGING || o_ptr->tval == TV_HAFTED)) {
+ if (!(o_ptr->tval == ItemKindType::POLEARM || o_ptr->tval == ItemKindType::SWORD || o_ptr->tval == ItemKindType::DIGGING || o_ptr->tval == ItemKindType::HAFTED)) {
return false;
}
/* Favorite weapons are varied depend on the class */
+ auto short_pclass = enum2i(player_ptr->pclass);
switch (player_ptr->pclass) {
- case CLASS_PRIEST: {
- TrFlags flgs;
- object_flags_known(o_ptr, flgs);
+ case PlayerClassType::PRIEST: {
+ auto flgs = object_flags_known(o_ptr);
- if (!has_flag(flgs, TR_BLESSED) && !(o_ptr->tval == TV_HAFTED))
+ if (flgs.has_not(TR_BLESSED) && !(o_ptr->tval == ItemKindType::HAFTED))
return false;
break;
}
- case CLASS_MONK:
- case CLASS_FORCETRAINER:
+ case PlayerClassType::MONK:
+ case PlayerClassType::FORCETRAINER:
/* Icky to wield? */
- if (!(s_info[player_ptr->pclass].w_max[o_ptr->tval - 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: {
- TrFlags flgs;
- object_flags_known(o_ptr, flgs);
+ case PlayerClassType::BEASTMASTER:
+ case PlayerClassType::CAVALRY: {
+ auto flgs = object_flags_known(o_ptr);
/* Is it known to be suitable to using while riding? */
- if (!(has_flag(flgs, TR_RIDING)))
+ if (flgs.has_not(TR_RIDING))
return false;
break;
}
- case CLASS_SORCERER:
- if (s_info[player_ptr->pclass].w_max[o_ptr->tval - 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[o_ptr->tval - 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;