diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 9a959b926427..5d38a32cce65 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -969,6 +969,14 @@ void LoadMatchingItems(LoadHelper &file, const Player &player, const int n, Item if ((heroItem.dwBuff & CF_HELLFIRE) != (unpackedItem.dwBuff & CF_HELLFIRE)) { unpackedItem = {}; RecreateItem(player, unpackedItem, heroItem.IDidx, heroItem._iCreateInfo, heroItem._iSeed, heroItem._ivalue, (heroItem.dwBuff & CF_HELLFIRE) != 0); + unpackedItem._iIdentified = heroItem._iIdentified; + unpackedItem._iMaxDur = heroItem._iMaxDur; + unpackedItem._iDurability = ClampDurability(unpackedItem, heroItem._iDurability); + unpackedItem._iMaxCharges = std::clamp(heroItem._iMaxCharges, 0, unpackedItem._iMaxCharges); + unpackedItem._iCharges = std::clamp(heroItem._iCharges, 0, unpackedItem._iMaxCharges); + RemoveInvalidItem(unpackedItem); + if (unpackedItem.isEmpty()) + continue; } if (!IsShopPriceValid(unpackedItem)) { unpackedItem.clear(); diff --git a/Source/pack.cpp b/Source/pack.cpp index 04168b78e133..4c1d7c2bbed6 100644 --- a/Source/pack.cpp +++ b/Source/pack.cpp @@ -407,13 +407,7 @@ void UnPackItem(const ItemPack &packedItem, const Player &player, Item &item, bo item._iDurability = ClampDurability(item, packedItem.bDur); item._iMaxCharges = std::clamp(packedItem.bMCh, 0, item._iMaxCharges); item._iCharges = std::clamp(packedItem.bCh, 0, item._iMaxCharges); - RemoveInvalidItem(item); - - if (isHellfire) - item.dwBuff |= CF_HELLFIRE; - else - item.dwBuff &= ~CF_HELLFIRE; } }