diff --git a/Source/items.cpp b/Source/items.cpp index 062ac5d8e6be..dc725178b31c 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -3352,7 +3352,8 @@ void TryRandomUniqueItem(Item &item, _item_indexes idx, int8_t mLevel, int uper, } // Amount to decrease the final uid by in CheckUnique() to get the desired unique. - const int uidOffset = std::count_if(uids.begin() + uid + 1, uids.end(), [&uniqueItem](UniqueItem potentialMatch) { + const int uidOffset = std::count_if(uids.begin() + uid + 1, uids.end(), [&uniqueItem](int matchId) { + const UniqueItem &potentialMatch = UniqueItems[matchId]; return uniqueItem.UIItemId == potentialMatch.UIItemId && uniqueItem.UIMinLvl == potentialMatch.UIMinLvl; });