summaryrefslogtreecommitdiff
path: root/src/inventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 3d1a4786..59f51e39 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,7 +29,11 @@ struct SlotUsed : public std::unary_function<Item*, bool>
{
bool operator()(const Item *item) const
{
+#ifdef TMWSERV_SUPPORT
+ return item && item->getId() && item->getQuantity();
+#else
return item && item->getId() != -1 && item->getQuantity() > 0;
+#endif
}
};
@@ -50,15 +53,19 @@ Inventory::~Inventory()
delete [] mItems;
}
-Item* Inventory::getItem(int index) const
+Item *Inventory::getItem(int index) const
{
+#ifdef TMWSERV_SUPPORT
+ if (index < 0 || index >= mSize)
+#else
if (index < 0 || index >= mSize || !mItems[index] || mItems[index]->getQuantity() <= 0)
+#endif
return 0;
return mItems[index];
}
-Item* Inventory::findItem(int itemId) const
+Item *Inventory::findItem(int itemId) const
{
for (int i = 0; i < mSize; i++)
if (mItems[i] && mItems[i]->getId() == itemId)