Skip to content

Commit

Permalink
Restore packed item state when regenerating an item using heroitem data
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenCWills committed Sep 4, 2023
1 parent 49c5aea commit ca0f0d0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Source/loadsave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,11 @@ 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<int>(heroItem._iMaxCharges, 0, unpackedItem._iMaxCharges);
unpackedItem._iCharges = std::clamp<int>(heroItem._iCharges, 0, unpackedItem._iMaxCharges);
}
if (!IsShopPriceValid(unpackedItem)) {
unpackedItem.clear();
Expand Down

0 comments on commit ca0f0d0

Please sign in to comment.