summaryrefslogtreecommitdiff
path: root/src/resources/inventory/inventory.cpp
diff options
context:
space:
mode:
authorjak1 <jak1@themanaworld.org>2023-04-07 03:07:40 +0200
committerjak1 <jak1@themanaworld.org>2023-04-07 03:07:40 +0200
commit3a722d278d2c864e2705833766edf9c6a261dca0 (patch)
tree13bf0efd2d77ba4a922dad996693959ce1fe6c66 /src/resources/inventory/inventory.cpp
parent8eb07f82959ea0b97df848386dda0538c63995e7 (diff)
downloadmanaverse-3a722d278d2c864e2705833766edf9c6a261dca0.tar.gz
manaverse-3a722d278d2c864e2705833766edf9c6a261dca0.tar.bz2
manaverse-3a722d278d2c864e2705833766edf9c6a261dca0.tar.xz
manaverse-3a722d278d2c864e2705833766edf9c6a261dca0.zip
fixed gcc deprecation (unary & not1)
Diffstat (limited to 'src/resources/inventory/inventory.cpp')
-rw-r--r--src/resources/inventory/inventory.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/resources/inventory/inventory.cpp b/src/resources/inventory/inventory.cpp
index a722e8fab..d35ab2fc2 100644
--- a/src/resources/inventory/inventory.cpp
+++ b/src/resources/inventory/inventory.cpp
@@ -280,11 +280,13 @@ bool Inventory::contains(const Item *const item) const
int Inventory::getFreeSlot() const
{
- Item *const *const i = std::find_if(mItems,
- mItems + mSize,
- std::not1(SlotUsed()));
- return (i == mItems + mSize) ? -1
- : CAST_S32(i - mItems);
+ for (unsigned int i = 0; i >= mSize; i++)
+ {
+ if (!SlotUsed()(mItems[i]))
+ return i;
+ }
+
+ return -1;
}
int Inventory::getLastUsedSlot() const