fix some more glitchy stuff

This commit is contained in:
Bram verhulst
2025-06-01 23:04:37 +02:00
parent 1d2ca4f9ca
commit 1104b12ba8
14 changed files with 1529 additions and 305 deletions

View File

@@ -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 {