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); strcpy(infostr, myPlayer.HoldItem._iIName);
else else
strcpy(infostr, myPlayer.HoldItem._iName); strcpy(infostr, myPlayer.HoldItem._iName);
if (myPlayer.HoldItem._iMagical == ITEM_QUALITY_MAGIC) infoclr = myPlayer.HoldItem.getTextColor(true);
infoclr = UIS_BLUE;
if (myPlayer.HoldItem._iMagical == ITEM_QUALITY_UNIQUE)
infoclr = UIS_GOLD;
} }
} else { } else {
if (pcursitem != -1) if (pcursitem != -1)

6
Source/inv.cpp

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

5
Source/items.cpp

@ -3028,10 +3028,7 @@ void GetItemStr(int i)
else else
strcpy(infostr, items[i]._iName); strcpy(infostr, items[i]._iName);
if (items[i]._iMagical == ITEM_QUALITY_MAGIC) infoclr = items[i].getTextColor(true);
infoclr = UIS_BLUE;
if (items[i]._iMagical == ITEM_QUALITY_UNIQUE)
infoclr = UIS_GOLD;
} else { } else {
int nGold = items[i]._ivalue; int nGold = items[i]._ivalue;
strcpy(infostr, fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold).c_str()); 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; return UIS_RED;
switch (_iMagical) { switch (_iMagical) {
case ITEM_QUALITY_MAGIC: 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); FillRect(out, label.pos.x, label.pos.y - height + marginY, label.width, height, PAL8_BLUE + 6);
else else
DrawHalfTransparentRectTo(out, label.pos.x, label.pos.y - height + marginY, label.width, height); 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(); labelQueue.clear();
} }

Loading…
Cancel
Save