fix some more glitchy stuff
This commit is contained in:
@@ -3,19 +3,18 @@
|
||||
#include <algorithm>
|
||||
|
||||
std::vector<Thinker::ItemMemory>::iterator Thinker::FindLeastValueItem(const eItemType& itemType) {
|
||||
std::ranges::partition(m_ItemMemory,
|
||||
[itemType](const ItemMemory& memory)->bool { return memory.ItemInfo.Type == itemType; });
|
||||
auto minIt = m_ItemMemory.end();
|
||||
|
||||
const auto minItem =
|
||||
std::ranges::min_element(m_ItemMemory,
|
||||
[itemType](const ItemMemory& lhs, const ItemMemory& rhs)->bool {
|
||||
if (lhs.ItemInfo.Type == itemType && rhs.ItemInfo.Type == itemType) {
|
||||
return lhs.ItemInfo.Value < rhs.ItemInfo.Value;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
for (auto it = m_ItemMemory.begin(); it != m_ItemMemory.end(); ++it) {
|
||||
if (it->ItemInfo.Type != itemType)
|
||||
continue;
|
||||
|
||||
return minItem;
|
||||
if (minIt == m_ItemMemory.end() || it->ItemInfo.Value < minIt->ItemInfo.Value) {
|
||||
minIt = it;
|
||||
}
|
||||
}
|
||||
|
||||
return minIt;
|
||||
}
|
||||
|
||||
bool Thinker::IsInvNotFull() const {
|
||||
|
||||
Reference in New Issue
Block a user