| 965 | } |
| 966 | |
| 967 | void LoadMatchingItems(LoadHelper &file, const Player &player, const int n, Item *pItem) |
| 968 | { |
| 969 | Item heroItem; |
| 970 | |
| 971 | for (int i = 0; i < n; i++) { |
| 972 | Item &unpackedItem = pItem[i]; |
| 973 | LoadItemData(file, heroItem); |
| 974 | if (unpackedItem.isEmpty() || heroItem.isEmpty()) |
| 975 | continue; |
| 976 | if (unpackedItem._iSeed != heroItem._iSeed) |
| 977 | continue; |
| 978 | if (heroItem.IDidx == IDI_EAR) |
| 979 | continue; |
| 980 | if (gbIsMultiplayer) { |
| 981 | // Ensure that the unpacked item was regenerated using the appropriate |
| 982 | // game's item generation logic before attempting to use it for validation |
| 983 | if ((heroItem.dwBuff & CF_HELLFIRE) != (unpackedItem.dwBuff & CF_HELLFIRE)) { |
| 984 | unpackedItem = {}; |
| 985 | RecreateItem(player, unpackedItem, heroItem.IDidx, heroItem._iCreateInfo, heroItem._iSeed, heroItem._ivalue, (heroItem.dwBuff & CF_HELLFIRE) != 0); |
| 986 | unpackedItem._iIdentified = heroItem._iIdentified; |
| 987 | unpackedItem._iMaxDur = heroItem._iMaxDur; |
| 988 | unpackedItem._iDurability = ClampDurability(unpackedItem, heroItem._iDurability); |
| 989 | unpackedItem._iMaxCharges = clamp<int>(heroItem._iMaxCharges, 0, unpackedItem._iMaxCharges); |
| 990 | unpackedItem._iCharges = clamp<int>(heroItem._iCharges, 0, unpackedItem._iMaxCharges); |
| 991 | } |
| 992 | if (gbIsHellfire) { |
| 993 | unpackedItem._iPLToHit = ClampToHit(unpackedItem, heroItem._iPLToHit); // Oil of Accuracy |
| 994 | unpackedItem._iMaxDam = ClampMaxDam(unpackedItem, heroItem._iMaxDam); // Oil of Sharpness |
| 995 | } |
| 996 | } else { |
| 997 | unpackedItem = heroItem; |
| 998 | } |
| 999 | } |
| 1000 | } |
| 1001 | |
| 1002 | /** |
| 1003 | * @brief Loads items on the current dungeon floor |
no test coverage detected