Browse Source

🚚 Rename 'UItemStruct' struct to 'UniqueItem' (#2806)

* 🚚 Rename 'UItemStruct' struct to 'UniqueItem'
* 🚚 Rename 'UniqueItemList' global array to 'UniqueItems'
New name is more concise and follows the standard of pluralizing the base name for collections.
pull/2812/head
Juliano Leal Goncalves 5 years ago committed by GitHub
parent
commit
4431e3a823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Source/itemdat.cpp
  2. 4
      Source/itemdat.h
  3. 16
      Source/items.cpp

2
Source/itemdat.cpp

@ -389,7 +389,7 @@ const PLStruct ItemSuffixes[] = {
};
/** Contains the data related to each unique item ID. */
const UItemStruct UniqueItemList[] = {
const UniqueItem UniqueItems[] = {
// clang-format off
// UIName, UIItemId, UIMinLvl, UINumPL, UIValue, ItemPower[0], ItemPower[1], ItemPower[2], ItemPower[3], ItemPower[4], ItemPower[5]
// TRANSLATORS: Unique Item section

4
Source/itemdat.h

@ -583,7 +583,7 @@ struct PLStruct {
int multVal;
};
struct UItemStruct {
struct UniqueItem {
const char *UIName;
enum unique_base_item UIItemId;
int8_t UIMinLvl;
@ -595,6 +595,6 @@ struct UItemStruct {
extern ItemData AllItemsList[];
extern const PLStruct ItemPrefixes[];
extern const PLStruct ItemSuffixes[];
extern const UItemStruct UniqueItemList[];
extern const UniqueItem UniqueItems[];
} // namespace devilution

16
Source/items.cpp

@ -1509,11 +1509,11 @@ _unique_items CheckUnique(Item &item, int lvl, int uper, bool recreate)
return UITEM_INVALID;
int numu = 0;
for (int j = 0; UniqueItemList[j].UIItemId != UITYPE_INVALID; j++) {
for (int j = 0; UniqueItems[j].UIItemId != UITYPE_INVALID; j++) {
if (!IsUniqueAvailable(j))
break;
if (UniqueItemList[j].UIItemId == AllItemsList[item.IDidx].iItemId
&& lvl >= UniqueItemList[j].UIMinLvl
if (UniqueItems[j].UIItemId == AllItemsList[item.IDidx].iItemId
&& lvl >= UniqueItems[j].UIMinLvl
&& (recreate || !UniqueItemFlags[j] || gbIsMultiplayer)) {
uok[j] = true;
numu++;
@ -1539,14 +1539,14 @@ void GetUniqueItem(Item &item, _unique_items uid)
{
UniqueItemFlags[uid] = true;
for (const auto &power : UniqueItemList[uid].powers) {
for (const auto &power : UniqueItems[uid].powers) {
if (power.type == IPL_INVALID)
break;
SaveItemPower(item, power);
}
strcpy(item._iIName, _(UniqueItemList[uid].UIName));
item._iIvalue = UniqueItemList[uid].UIValue;
strcpy(item._iIName, _(UniqueItems[uid].UIName));
item._iIvalue = UniqueItems[uid].UIValue;
if (item._iMiscId == IMISC_UNIQUE)
item._iSeed = uid;
@ -3380,7 +3380,7 @@ void SpawnUnique(_unique_items uid, Point position)
int curlv = ItemsGetCurrlevel();
int idx = 0;
while (AllItemsList[idx].iItemId != UniqueItemList[uid].UIItemId)
while (AllItemsList[idx].iItemId != UniqueItems[uid].UIItemId)
idx++;
GetItemAttrs(item, idx, curlv);
@ -4129,7 +4129,7 @@ void DrawUniqueInfo(const Surface &out)
DrawUniqueInfoWindow(GlobalBackBuffer());
Rectangle rect { { 32 + RightPanel.position.x - SPANEL_WIDTH, 44 + RightPanel.position.y + 2 * 12 }, { 257, 0 } };
const UItemStruct &uitem = UniqueItemList[curruitem._iUid];
const UniqueItem &uitem = UniqueItems[curruitem._iUid];
DrawString(out, _(uitem.UIName), rect, UiFlags::AlignCenter);
DrawUniqueInfoDevider(out, 5);

Loading…
Cancel
Save