diff options
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r-- | src/inventory.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index 5092fe3c..80bc582b 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -29,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 } }; @@ -51,7 +55,11 @@ Inventory::~Inventory() 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]; |