Skip to content

Commit 0e005c8

Browse files
AndrettinAJenbo
authored andcommitted
Fixed item properties not being written to the "normal" infobox if the floating infobox option is disabled
1 parent 62a45a2 commit 0e005c8

File tree

1 file changed

+88
-73
lines changed

1 file changed

+88
-73
lines changed

Source/items.cpp

Lines changed: 88 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,92 +1595,94 @@ void ItemDoppel()
15951595

15961596
void PrintItemOil(char iDidx)
15971597
{
1598+
const bool floatingInfoBoxEnabled = *GetOptions().Gameplay.floatingInfoBox;
1599+
15981600
switch (iDidx) {
15991601
case IMISC_OILACC:
1600-
AddInfoBoxString(_("increases a weapon's"), true);
1601-
AddInfoBoxString(_("chance to hit"), true);
1602+
AddInfoBoxString(_("increases a weapon's"), floatingInfoBoxEnabled);
1603+
AddInfoBoxString(_("chance to hit"), floatingInfoBoxEnabled);
16021604
break;
16031605
case IMISC_OILMAST:
1604-
AddInfoBoxString(_("greatly increases a"), true);
1605-
AddInfoBoxString(_("weapon's chance to hit"), true);
1606+
AddInfoBoxString(_("greatly increases a"), floatingInfoBoxEnabled);
1607+
AddInfoBoxString(_("weapon's chance to hit"), floatingInfoBoxEnabled);
16061608
break;
16071609
case IMISC_OILSHARP:
1608-
AddInfoBoxString(_("increases a weapon's"), true);
1609-
AddInfoBoxString(_("damage potential"), true);
1610+
AddInfoBoxString(_("increases a weapon's"), floatingInfoBoxEnabled);
1611+
AddInfoBoxString(_("damage potential"), floatingInfoBoxEnabled);
16101612
break;
16111613
case IMISC_OILDEATH:
1612-
AddInfoBoxString(_("greatly increases a weapon's"), true);
1613-
AddInfoBoxString(_("damage potential - not bows"), true);
1614+
AddInfoBoxString(_("greatly increases a weapon's"), floatingInfoBoxEnabled);
1615+
AddInfoBoxString(_("damage potential - not bows"), floatingInfoBoxEnabled);
16141616
break;
16151617
case IMISC_OILSKILL:
1616-
AddInfoBoxString(_("reduces attributes needed"), true);
1617-
AddInfoBoxString(_("to use armor or weapons"), true);
1618+
AddInfoBoxString(_("reduces attributes needed"), floatingInfoBoxEnabled);
1619+
AddInfoBoxString(_("to use armor or weapons"), floatingInfoBoxEnabled);
16181620
break;
16191621
case IMISC_OILBSMTH:
1620-
AddInfoBoxString(/*xgettext:no-c-format*/ _("restores 20% of an"), true);
1621-
AddInfoBoxString(_("item's durability"), true);
1622+
AddInfoBoxString(/*xgettext:no-c-format*/ _("restores 20% of an"), floatingInfoBoxEnabled);
1623+
AddInfoBoxString(_("item's durability"), floatingInfoBoxEnabled);
16221624
break;
16231625
case IMISC_OILFORT:
1624-
AddInfoBoxString(_("increases an item's"), true);
1625-
AddInfoBoxString(_("current and max durability"), true);
1626+
AddInfoBoxString(_("increases an item's"), floatingInfoBoxEnabled);
1627+
AddInfoBoxString(_("current and max durability"), floatingInfoBoxEnabled);
16261628
break;
16271629
case IMISC_OILPERM:
1628-
AddInfoBoxString(_("makes an item indestructible"), true);
1630+
AddInfoBoxString(_("makes an item indestructible"), floatingInfoBoxEnabled);
16291631
break;
16301632
case IMISC_OILHARD:
1631-
AddInfoBoxString(_("increases the armor class"), true);
1632-
AddInfoBoxString(_("of armor and shields"), true);
1633+
AddInfoBoxString(_("increases the armor class"), floatingInfoBoxEnabled);
1634+
AddInfoBoxString(_("of armor and shields"), floatingInfoBoxEnabled);
16331635
break;
16341636
case IMISC_OILIMP:
1635-
AddInfoBoxString(_("greatly increases the armor"), true);
1636-
AddInfoBoxString(_("class of armor and shields"), true);
1637+
AddInfoBoxString(_("greatly increases the armor"), floatingInfoBoxEnabled);
1638+
AddInfoBoxString(_("class of armor and shields"), floatingInfoBoxEnabled);
16371639
break;
16381640
case IMISC_RUNEF:
1639-
AddInfoBoxString(_("sets fire trap"), true);
1641+
AddInfoBoxString(_("sets fire trap"), floatingInfoBoxEnabled);
16401642
break;
16411643
case IMISC_RUNEL:
16421644
case IMISC_GR_RUNEL:
1643-
AddInfoBoxString(_("sets lightning trap"), true);
1645+
AddInfoBoxString(_("sets lightning trap"), floatingInfoBoxEnabled);
16441646
break;
16451647
case IMISC_GR_RUNEF:
1646-
AddInfoBoxString(_("sets fire trap"), true);
1648+
AddInfoBoxString(_("sets fire trap"), floatingInfoBoxEnabled);
16471649
break;
16481650
case IMISC_RUNES:
1649-
AddInfoBoxString(_("sets petrification trap"), true);
1651+
AddInfoBoxString(_("sets petrification trap"), floatingInfoBoxEnabled);
16501652
break;
16511653
case IMISC_FULLHEAL:
1652-
AddInfoBoxString(_("restore all life"), true);
1654+
AddInfoBoxString(_("restore all life"), floatingInfoBoxEnabled);
16531655
break;
16541656
case IMISC_HEAL:
1655-
AddInfoBoxString(_("restore some life"), true);
1657+
AddInfoBoxString(_("restore some life"), floatingInfoBoxEnabled);
16561658
break;
16571659
case IMISC_MANA:
1658-
AddInfoBoxString(_("restore some mana"), true);
1660+
AddInfoBoxString(_("restore some mana"), floatingInfoBoxEnabled);
16591661
break;
16601662
case IMISC_FULLMANA:
1661-
AddInfoBoxString(_("restore all mana"), true);
1663+
AddInfoBoxString(_("restore all mana"), floatingInfoBoxEnabled);
16621664
break;
16631665
case IMISC_ELIXSTR:
1664-
AddInfoBoxString(_("increase strength"), true);
1666+
AddInfoBoxString(_("increase strength"), floatingInfoBoxEnabled);
16651667
break;
16661668
case IMISC_ELIXMAG:
1667-
AddInfoBoxString(_("increase magic"), true);
1669+
AddInfoBoxString(_("increase magic"), floatingInfoBoxEnabled);
16681670
break;
16691671
case IMISC_ELIXDEX:
1670-
AddInfoBoxString(_("increase dexterity"), true);
1672+
AddInfoBoxString(_("increase dexterity"), floatingInfoBoxEnabled);
16711673
break;
16721674
case IMISC_ELIXVIT:
1673-
AddInfoBoxString(_("increase vitality"), true);
1675+
AddInfoBoxString(_("increase vitality"), floatingInfoBoxEnabled);
16741676
break;
16751677
case IMISC_REJUV:
1676-
AddInfoBoxString(_("restore some life and mana"), true);
1678+
AddInfoBoxString(_("restore some life and mana"), floatingInfoBoxEnabled);
16771679
break;
16781680
case IMISC_FULLREJUV:
1679-
AddInfoBoxString(_("restore all life and mana"), true);
1681+
AddInfoBoxString(_("restore all life and mana"), floatingInfoBoxEnabled);
16801682
break;
16811683
case IMISC_ARENAPOT:
1682-
AddInfoBoxString(_("restore all life and mana"), true);
1683-
AddInfoBoxString(_("(works only in arenas)"), true);
1684+
AddInfoBoxString(_("restore all life and mana"), floatingInfoBoxEnabled);
1685+
AddInfoBoxString(_("(works only in arenas)"), floatingInfoBoxEnabled);
16841686
break;
16851687
}
16861688
}
@@ -1714,33 +1716,37 @@ Point DrawUniqueInfoWindow(const Surface &out)
17141716

17151717
void printItemMiscKBM(const Item &item, const bool isOil, const bool isCastOnTarget)
17161718
{
1719+
const bool floatingInfoBoxEnabled = *GetOptions().Gameplay.floatingInfoBox;
1720+
17171721
if (item._iMiscId == IMISC_MAPOFDOOM) {
1718-
AddInfoBoxString(_("Right-click to view"), true);
1722+
AddInfoBoxString(_("Right-click to view"), floatingInfoBoxEnabled);
17191723
} else if (isOil) {
17201724
PrintItemOil(item._iMiscId);
1721-
AddInfoBoxString(_("Right-click to use"), true);
1725+
AddInfoBoxString(_("Right-click to use"), floatingInfoBoxEnabled);
17221726
} else if (isCastOnTarget) {
1723-
AddInfoBoxString(_("Right-click to read, then\nleft-click to target"), true);
1727+
AddInfoBoxString(_("Right-click to read, then\nleft-click to target"), floatingInfoBoxEnabled);
17241728
} else if (IsAnyOf(item._iMiscId, IMISC_BOOK, IMISC_NOTE, IMISC_SCROLL, IMISC_SCROLLT)) {
1725-
AddInfoBoxString(_("Right-click to read"), true);
1729+
AddInfoBoxString(_("Right-click to read"), floatingInfoBoxEnabled);
17261730
}
17271731
}
17281732

17291733
void printItemMiscGenericGamepad(const Item &item, const bool isOil, bool isCastOnTarget)
17301734
{
1735+
const bool floatingInfoBoxEnabled = *GetOptions().Gameplay.floatingInfoBox;
1736+
17311737
if (item._iMiscId == IMISC_MAPOFDOOM) {
1732-
AddInfoBoxString(_("Activate to view"), true);
1738+
AddInfoBoxString(_("Activate to view"), floatingInfoBoxEnabled);
17331739
} else if (isOil) {
17341740
PrintItemOil(item._iMiscId);
17351741
if (!invflag) {
1736-
AddInfoBoxString(_("Open inventory to use"), true);
1742+
AddInfoBoxString(_("Open inventory to use"), floatingInfoBoxEnabled);
17371743
} else {
1738-
AddInfoBoxString(_("Activate to use"), true);
1744+
AddInfoBoxString(_("Activate to use"), floatingInfoBoxEnabled);
17391745
}
17401746
} else if (isCastOnTarget) {
1741-
AddInfoBoxString(_("Select from spell book, then\ncast spell to read"), true);
1747+
AddInfoBoxString(_("Select from spell book, then\ncast spell to read"), floatingInfoBoxEnabled);
17421748
} else if (IsAnyOf(item._iMiscId, IMISC_BOOK, IMISC_NOTE, IMISC_SCROLL, IMISC_SCROLLT)) {
1743-
AddInfoBoxString(_("Activate to read"), true);
1749+
AddInfoBoxString(_("Activate to read"), floatingInfoBoxEnabled);
17441750
}
17451751
}
17461752

@@ -1753,30 +1759,34 @@ void printItemMiscGamepad(const Item &item, bool isOil, bool isCastOnTarget)
17531759
const std::string_view activateButton = GetOptions().Padmapper.InputNameForAction("SecondaryAction");
17541760
const std::string_view castButton = GetOptions().Padmapper.InputNameForAction("SpellAction");
17551761

1762+
const bool floatingInfoBoxEnabled = *GetOptions().Gameplay.floatingInfoBox;
1763+
17561764
if (item._iMiscId == IMISC_MAPOFDOOM) {
1757-
AddInfoBoxString(fmt::format(fmt::runtime(_("{} to view")), activateButton), true);
1765+
AddInfoBoxString(fmt::format(fmt::runtime(_("{} to view")), activateButton), floatingInfoBoxEnabled);
17581766
} else if (isOil) {
17591767
PrintItemOil(item._iMiscId);
17601768
if (!invflag) {
1761-
AddInfoBoxString(_("Open inventory to use"), true);
1769+
AddInfoBoxString(_("Open inventory to use"), floatingInfoBoxEnabled);
17621770
} else {
1763-
AddInfoBoxString(fmt::format(fmt::runtime(_("{} to use")), activateButton), true);
1771+
AddInfoBoxString(fmt::format(fmt::runtime(_("{} to use")), activateButton), floatingInfoBoxEnabled);
17641772
}
17651773
} else if (isCastOnTarget) {
1766-
AddInfoBoxString(fmt::format(fmt::runtime(_("Select from spell book,\nthen {} to read")), castButton), true);
1774+
AddInfoBoxString(fmt::format(fmt::runtime(_("Select from spell book,\nthen {} to read")), castButton), floatingInfoBoxEnabled);
17671775
} else if (IsAnyOf(item._iMiscId, IMISC_BOOK, IMISC_NOTE, IMISC_SCROLL, IMISC_SCROLLT)) {
1768-
AddInfoBoxString(fmt::format(fmt::runtime(_("{} to read")), activateButton), true);
1776+
AddInfoBoxString(fmt::format(fmt::runtime(_("{} to read")), activateButton), floatingInfoBoxEnabled);
17691777
}
17701778
}
17711779

17721780
void PrintItemMisc(const Item &item)
17731781
{
1782+
const bool floatingInfoBoxEnabled = *GetOptions().Gameplay.floatingInfoBox;
1783+
17741784
if (item._iMiscId == IMISC_EAR) {
1775-
AddInfoBoxString(fmt::format(fmt::runtime(pgettext("player", "Level: {:d}")), item._ivalue), true);
1785+
AddInfoBoxString(fmt::format(fmt::runtime(pgettext("player", "Level: {:d}")), item._ivalue), floatingInfoBoxEnabled);
17761786
return;
17771787
}
17781788
if (item._iMiscId == IMISC_AURIC) {
1779-
AddInfoBoxString(_("Doubles gold capacity"), true);
1789+
AddInfoBoxString(_("Doubles gold capacity"), floatingInfoBoxEnabled);
17801790
return;
17811791
}
17821792
const bool isOil = (item._iMiscId >= IMISC_USEFIRST && item._iMiscId <= IMISC_USELAST)
@@ -1816,7 +1826,8 @@ void PrintItemInfo(const Item &item)
18161826
text.append(fmt::format(fmt::runtime(_(" {:d} Mag")), mag));
18171827
if (dex != 0)
18181828
text.append(fmt::format(fmt::runtime(_(" {:d} Dex")), dex));
1819-
AddInfoBoxString(text, true);
1829+
const bool floatingInfoBoxEnabled = *GetOptions().Gameplay.floatingInfoBox;
1830+
AddInfoBoxString(text, floatingInfoBoxEnabled);
18201831
}
18211832
}
18221833

@@ -4056,36 +4067,38 @@ void PrintItemDetails(const Item &item)
40564067
if (HeadlessMode)
40574068
return;
40584069

4070+
const bool floatingInfoBoxEnabled = *GetOptions().Gameplay.floatingInfoBox;
4071+
40594072
if (item._iClass == ICLASS_WEAPON) {
40604073
if (item._iMinDam == item._iMaxDam) {
40614074
if (item._iMaxDur == DUR_INDESTRUCTIBLE)
4062-
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d} Indestructible")), item._iMinDam), true);
4075+
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d} Indestructible")), item._iMinDam), floatingInfoBoxEnabled);
40634076
else
4064-
AddInfoBoxString(fmt::format(fmt::runtime(_(/* TRANSLATORS: Dur: is durability */ "damage: {:d} Dur: {:d}/{:d}")), item._iMinDam, item._iDurability, item._iMaxDur), true);
4077+
AddInfoBoxString(fmt::format(fmt::runtime(_(/* TRANSLATORS: Dur: is durability */ "damage: {:d} Dur: {:d}/{:d}")), item._iMinDam, item._iDurability, item._iMaxDur), floatingInfoBoxEnabled);
40654078
} else {
40664079
if (item._iMaxDur == DUR_INDESTRUCTIBLE)
4067-
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d}-{:d} Indestructible")), item._iMinDam, item._iMaxDam), true);
4080+
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d}-{:d} Indestructible")), item._iMinDam, item._iMaxDam), floatingInfoBoxEnabled);
40684081
else
4069-
AddInfoBoxString(fmt::format(fmt::runtime(_(/* TRANSLATORS: Dur: is durability */ "damage: {:d}-{:d} Dur: {:d}/{:d}")), item._iMinDam, item._iMaxDam, item._iDurability, item._iMaxDur), true);
4082+
AddInfoBoxString(fmt::format(fmt::runtime(_(/* TRANSLATORS: Dur: is durability */ "damage: {:d}-{:d} Dur: {:d}/{:d}")), item._iMinDam, item._iMaxDam, item._iDurability, item._iMaxDur), floatingInfoBoxEnabled);
40704083
}
40714084
}
40724085
if (item._iClass == ICLASS_ARMOR) {
40734086
if (item._iMaxDur == DUR_INDESTRUCTIBLE)
4074-
AddInfoBoxString(fmt::format(fmt::runtime(_("armor: {:d} Indestructible")), item._iAC), true);
4087+
AddInfoBoxString(fmt::format(fmt::runtime(_("armor: {:d} Indestructible")), item._iAC), floatingInfoBoxEnabled);
40754088
else
4076-
AddInfoBoxString(fmt::format(fmt::runtime(_(/* TRANSLATORS: Dur: is durability */ "armor: {:d} Dur: {:d}/{:d}")), item._iAC, item._iDurability, item._iMaxDur), true);
4089+
AddInfoBoxString(fmt::format(fmt::runtime(_(/* TRANSLATORS: Dur: is durability */ "armor: {:d} Dur: {:d}/{:d}")), item._iAC, item._iDurability, item._iMaxDur), floatingInfoBoxEnabled);
40774090
}
40784091
if (item._iMiscId == IMISC_STAFF && item._iMaxCharges != 0) {
4079-
AddInfoBoxString(fmt::format(fmt::runtime(_("Charges: {:d}/{:d}")), item._iCharges, item._iMaxCharges), true);
4092+
AddInfoBoxString(fmt::format(fmt::runtime(_("Charges: {:d}/{:d}")), item._iCharges, item._iMaxCharges), floatingInfoBoxEnabled);
40804093
}
40814094
if (item._iPrePower != -1) {
4082-
AddInfoBoxString(PrintItemPower(item._iPrePower, item), true);
4095+
AddInfoBoxString(PrintItemPower(item._iPrePower, item), floatingInfoBoxEnabled);
40834096
}
40844097
if (item._iSufPower != -1) {
4085-
AddInfoBoxString(PrintItemPower(item._iSufPower, item), true);
4098+
AddInfoBoxString(PrintItemPower(item._iSufPower, item), floatingInfoBoxEnabled);
40864099
}
40874100
if (item._iMagical == ITEM_QUALITY_UNIQUE) {
4088-
AddInfoBoxString(_("unique item"), true);
4101+
AddInfoBoxString(_("unique item"), floatingInfoBoxEnabled);
40894102
ShowUniqueItemInfoBox = true;
40904103
curruitem = item;
40914104
}
@@ -4097,37 +4110,39 @@ void PrintItemDur(const Item &item)
40974110
if (HeadlessMode)
40984111
return;
40994112

4113+
const bool floatingInfoBoxEnabled = *GetOptions().Gameplay.floatingInfoBox;
4114+
41004115
if (item._iClass == ICLASS_WEAPON) {
41014116
if (item._iMinDam == item._iMaxDam) {
41024117
if (item._iMaxDur == DUR_INDESTRUCTIBLE)
4103-
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d} Indestructible")), item._iMinDam), true);
4118+
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d} Indestructible")), item._iMinDam), floatingInfoBoxEnabled);
41044119
else
4105-
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d} Dur: {:d}/{:d}")), item._iMinDam, item._iDurability, item._iMaxDur), true);
4120+
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d} Dur: {:d}/{:d}")), item._iMinDam, item._iDurability, item._iMaxDur), floatingInfoBoxEnabled);
41064121
} else {
41074122
if (item._iMaxDur == DUR_INDESTRUCTIBLE)
4108-
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d}-{:d} Indestructible")), item._iMinDam, item._iMaxDam), true);
4123+
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d}-{:d} Indestructible")), item._iMinDam, item._iMaxDam), floatingInfoBoxEnabled);
41094124
else
4110-
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d}-{:d} Dur: {:d}/{:d}")), item._iMinDam, item._iMaxDam, item._iDurability, item._iMaxDur), true);
4125+
AddInfoBoxString(fmt::format(fmt::runtime(_("damage: {:d}-{:d} Dur: {:d}/{:d}")), item._iMinDam, item._iMaxDam, item._iDurability, item._iMaxDur), floatingInfoBoxEnabled);
41114126
}
41124127
if (item._iMiscId == IMISC_STAFF && item._iMaxCharges > 0) {
4113-
AddInfoBoxString(fmt::format(fmt::runtime(_("Charges: {:d}/{:d}")), item._iCharges, item._iMaxCharges), true);
4128+
AddInfoBoxString(fmt::format(fmt::runtime(_("Charges: {:d}/{:d}")), item._iCharges, item._iMaxCharges), floatingInfoBoxEnabled);
41144129
}
41154130
if (item._iMagical != ITEM_QUALITY_NORMAL)
4116-
AddInfoBoxString(_("Not Identified"), true);
4131+
AddInfoBoxString(_("Not Identified"), floatingInfoBoxEnabled);
41174132
}
41184133
if (item._iClass == ICLASS_ARMOR) {
41194134
if (item._iMaxDur == DUR_INDESTRUCTIBLE)
4120-
AddInfoBoxString(fmt::format(fmt::runtime(_("armor: {:d} Indestructible")), item._iAC), true);
4135+
AddInfoBoxString(fmt::format(fmt::runtime(_("armor: {:d} Indestructible")), item._iAC), floatingInfoBoxEnabled);
41214136
else
4122-
AddInfoBoxString(fmt::format(fmt::runtime(_("armor: {:d} Dur: {:d}/{:d}")), item._iAC, item._iDurability, item._iMaxDur), true);
4137+
AddInfoBoxString(fmt::format(fmt::runtime(_("armor: {:d} Dur: {:d}/{:d}")), item._iAC, item._iDurability, item._iMaxDur), floatingInfoBoxEnabled);
41234138
if (item._iMagical != ITEM_QUALITY_NORMAL)
4124-
AddInfoBoxString(_("Not Identified"), true);
4139+
AddInfoBoxString(_("Not Identified"), floatingInfoBoxEnabled);
41254140
if (item._iMiscId == IMISC_STAFF && item._iMaxCharges > 0) {
4126-
AddInfoBoxString(fmt::format(fmt::runtime(_("Charges: {:d}/{:d}")), item._iCharges, item._iMaxCharges), true);
4141+
AddInfoBoxString(fmt::format(fmt::runtime(_("Charges: {:d}/{:d}")), item._iCharges, item._iMaxCharges), floatingInfoBoxEnabled);
41274142
}
41284143
}
41294144
if (IsAnyOf(item._itype, ItemType::Ring, ItemType::Amulet))
4130-
AddInfoBoxString(_("Not Identified"), true);
4145+
AddInfoBoxString(_("Not Identified"), floatingInfoBoxEnabled);
41314146
PrintItemInfo(item);
41324147
}
41334148

0 commit comments

Comments
 (0)