diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-09-25 00:34:37 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-09-25 00:34:37 +0000 |
commit | 7d6e21ef0617a6c6ece314641fb431e5a84c44b0 (patch) | |
tree | b92b35844400dd41ed0583b98d74917898ebc5e4 /src/inventory.cpp | |
parent | 720f758a8c6bece45e0d2d42e48bed67167f26c6 (diff) | |
download | mana-7d6e21ef0617a6c6ece314641fb431e5a84c44b0.tar.gz mana-7d6e21ef0617a6c6ece314641fb431e5a84c44b0.tar.bz2 mana-7d6e21ef0617a6c6ece314641fb431e5a84c44b0.tar.xz mana-7d6e21ef0617a6c6ece314641fb431e5a84c44b0.zip |
Added some const qualifiers.
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r-- | src/inventory.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index d9bd79f8..f6cf04f4 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -91,7 +91,7 @@ void Inventory::removeItemIndex(int index) mItems[index].setQuantity(0); } -bool Inventory::contains(Item *item) +bool Inventory::contains(Item *item) const { for (int i = 0; i < INVENTORY_SIZE; i++) { if (mItems[i].getId() == item->getId()) { @@ -102,19 +102,19 @@ bool Inventory::contains(Item *item) return false; } -int Inventory::getFreeSlot() +int Inventory::getFreeSlot() const { Item *i = std::find_if(mItems, mItems + INVENTORY_SIZE, std::not1(SlotUsed())); return (i == mItems + INVENTORY_SIZE) ? -1 : (i - mItems); } -int Inventory::getNumberOfSlotsUsed() +int Inventory::getNumberOfSlotsUsed() const { return count_if(mItems, mItems + INVENTORY_SIZE, SlotUsed()); } -int Inventory::getLastUsedSlot() +int Inventory::getLastUsedSlot() const { for (int i = INVENTORY_SIZE - 1; i >= 0; i--) { if (SlotUsed()(mItems[i])) { |