Browse Source

cleanup getTextColor

pull/2066/head
qndel 5 years ago committed by Anders Jenbo
parent
commit
2f3cf65b27
  1. 5
      Source/control.cpp
  2. 6
      Source/inv.cpp
  3. 5
      Source/items.cpp
  4. 4
      Source/items.h
  5. 2
      Source/qol/itemlabels.cpp

5
Source/control.cpp

@ -1156,10 +1156,7 @@ void DrawInfoBox(const CelOutputBuffer &out)
strcpy(infostr, myPlayer.HoldItem._iIName);
else
strcpy(infostr, myPlayer.HoldItem._iName);
if (myPlayer.HoldItem._iMagical == ITEM_QUALITY_MAGIC)
infoclr = UIS_BLUE;
if (myPlayer.HoldItem._iMagical == ITEM_QUALITY_UNIQUE)
infoclr = UIS_GOLD;
infoclr = myPlayer.HoldItem.getTextColor(true);
}
} else {
if (pcursitem != -1)

6
Source/inv.cpp

@ -2001,11 +2001,7 @@ char CheckInvHLight()
int nGold = pi->_ivalue;
strcpy(infostr, fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold).c_str());
} else {
if (pi->_iMagical == ITEM_QUALITY_MAGIC) {
infoclr = UIS_BLUE;
} else if (pi->_iMagical == ITEM_QUALITY_UNIQUE) {
infoclr = UIS_GOLD;
}
infoclr = pi->getTextColor(true);
if (pi->_iIdentified) {
strcpy(infostr, pi->_iIName);
PrintItemDetails(pi);

5
Source/items.cpp

@ -3028,10 +3028,7 @@ void GetItemStr(int i)
else
strcpy(infostr, items[i]._iName);
if (items[i]._iMagical == ITEM_QUALITY_MAGIC)
infoclr = UIS_BLUE;
if (items[i]._iMagical == ITEM_QUALITY_UNIQUE)
infoclr = UIS_GOLD;
infoclr = items[i].getTextColor(true);
} else {
int nGold = items[i]._ivalue;
strcpy(infostr, fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold).c_str());

4
Source/items.h

@ -351,9 +351,9 @@ struct ItemStruct {
}
}
UiFlags getTextColor() const
UiFlags getTextColor(bool skipStatCheck = false) const
{
if (!_iStatFlag)
if (!skipStatCheck && !_iStatFlag)
return UIS_RED;
switch (_iMagical) {
case ITEM_QUALITY_MAGIC:

2
Source/qol/itemlabels.cpp

@ -156,7 +156,7 @@ void DrawItemNameLabels(const CelOutputBuffer &out)
FillRect(out, label.pos.x, label.pos.y - height + marginY, label.width, height, PAL8_BLUE + 6);
else
DrawHalfTransparentRectTo(out, label.pos.x, label.pos.y - height + marginY, label.width, height);
DrawString(out, label.text.c_str(), { label.pos.x + marginX, label.pos.y, label.width, height }, itm.getTextColor());
DrawString(out, label.text.c_str(), { label.pos.x + marginX, label.pos.y, label.width, height }, itm.getTextColor(true));
}
labelQueue.clear();
}

Loading…
Cancel
Save