Browse Source

Replace some usages of Item.statFlag

pull/3752/head
ephphatha 5 years ago committed by Anders Jenbo
parent
commit
bda0a0624b
  1. 2
      Source/control.cpp
  2. 14
      Source/inv.cpp

2
Source/control.cpp

@ -832,7 +832,7 @@ void DrawInfoBox(const Surface &out)
if (myPlayer.HoldItem._itype == ItemType::Gold) {
int nGold = myPlayer.HoldItem._ivalue;
strcpy(infostr, fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold).c_str());
} else if (!myPlayer.HoldItem._iStatFlag) {
} else if (!myPlayer.CanUseItem(myPlayer.HoldItem)) {
ClearPanel();
AddPanelString(_("Requirements not met"));
} else {

14
Source/inv.cpp

@ -412,7 +412,7 @@ void CheckInvPaste(int pnum, Point cursorPosition)
done = true;
if (!AllItemsList[player.HoldItem.IDidx].iUsable)
done = false;
if (!player.HoldItem._iStatFlag)
if (!player.CanUseItem(player.HoldItem))
done = false;
if (player.HoldItem._itype == ItemType::Gold)
done = false;
@ -464,7 +464,7 @@ void CheckInvPaste(int pnum, Point cursorPosition)
if (!done)
return;
if (IsNoneOf(il, ILOC_UNEQUIPABLE, ILOC_BELT) && !player.HoldItem._iStatFlag) {
if (IsNoneOf(il, ILOC_UNEQUIPABLE, ILOC_BELT) && !player.CanUseItem(player.HoldItem)) {
done = false;
player.Say(HeroSpeech::ICantUseThisYet);
}
@ -1614,13 +1614,7 @@ void CheckItemStats(Player &player)
{
Item &item = player.HoldItem;
item._iStatFlag = false;
if (player._pStrength >= item._iMinStr
&& player._pMagic >= item._iMinMag
&& player._pDexterity >= item._iMinDex) {
item._iStatFlag = true;
}
item._iStatFlag = player.CanUseItem(item);
}
void InvGetItem(int pnum, int ii)
@ -2118,7 +2112,7 @@ bool UseInvItem(int pnum, int cii)
if (!AllItemsList[item->IDidx].iUsable)
return false;
if (!item->_iStatFlag) {
if (!player.CanUseItem(*item)) {
player.Say(HeroSpeech::ICantUseThisYet);
return true;
}

Loading…
Cancel
Save