Skip to content

Commit b709ffd

Browse files
committed
Assign item.dwBuff in items.cpp:RecreateItem()
Make absolutely certain that the item.dwBuff flag is always set for all items, regardless of how the function gets called. Remove unnecessary item.dwBuff assignments Since item.dwBuff is now set in RecreateItem(), these assignments are unnecessary.
1 parent 3dfc6f6 commit b709ffd

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

Source/inv.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,6 @@ int SyncDropItem(Point position, _item_indexes idx, uint16_t icreateinfo, int is
18861886
item._iPLToHit = ClampToHit(item, toHit);
18871887
item._iMaxDam = ClampMaxDam(item, maxDam);
18881888
}
1889-
item.dwBuff = ibuff;
18901889

18911890
return PlaceItemInWorld(std::move(item), position);
18921891
}

Source/items.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3512,7 +3512,8 @@ void CreateTypeItem(Point position, bool onlygood, ItemType itemType, int imisc,
35123512
void RecreateItem(const Player &player, Item &item, _item_indexes idx, uint16_t icreateinfo, uint32_t iseed, int ivalue, uint32_t dwBuff)
35133513
{
35143514
bool tmpIsHellfire = gbIsHellfire;
3515-
gbIsHellfire = dwBuff & CF_HELLFIRE;
3515+
item.dwBuff = dwBuff;
3516+
gbIsHellfire = item.dwBuff & CF_HELLFIRE;
35163517

35173518
if (idx == IDI_GOLD) {
35183519
InitializeItem(item, IDI_GOLD);
@@ -3556,7 +3557,7 @@ void RecreateItem(const Player &player, Item &item, _item_indexes idx, uint16_t
35563557
bool onlygood = (icreateinfo & CF_ONLYGOOD) != 0;
35573558
bool forceNotUnique = (icreateinfo & CF_UNIQUE) == 0;
35583559
bool pregen = (icreateinfo & CF_PREGEN) != 0;
3559-
auto uidOffset = static_cast<int>((dwBuff & CF_UIDOFFSET) >> 1);
3560+
auto uidOffset = static_cast<int>((item.dwBuff & CF_UIDOFFSET) >> 1);
35603561

35613562
SetupAllItems(player, item, idx, iseed, level, uper, onlygood, pregen, uidOffset, forceNotUnique);
35623563
SetupItem(item);

Source/msg.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2429,7 +2429,6 @@ void PrepareEarForNetwork(const Item &item, TEar &ear)
24292429
void RecreateItem(const Player &player, const TItem &messageItem, Item &item)
24302430
{
24312431
const uint32_t dwBuff = SDL_SwapLE32(messageItem.dwBuff);
2432-
item.dwBuff = dwBuff;
24332432
RecreateItem(player, item,
24342433
static_cast<_item_indexes>(SDL_SwapLE16(messageItem.wIndx)), SDL_SwapLE16(messageItem.wCI),
24352434
SDL_SwapLE32(messageItem.dwSeed), SDL_SwapLE16(messageItem.wValue), dwBuff);

0 commit comments

Comments
 (0)