summaryrefslogtreecommitdiff
path: root/src/inventory.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-26 16:07:54 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-26 16:07:54 +0100
commit5afe88df2538274859a162ffd63ed52118e80c19 (patch)
treeb610dfd58dc748fd63f49565b2a43eea2316714f /src/inventory.cpp
parent73ba2a95f5bd4a0dd09af52d5864800be2b0a4c6 (diff)
downloadmana-5afe88df2538274859a162ffd63ed52118e80c19.tar.gz
mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.bz2
mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.xz
mana-5afe88df2538274859a162ffd63ed52118e80c19.zip
Apply C++11 fixits
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index a88ab96b..a7418175 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -42,7 +42,7 @@ Inventory::Inventory(Type type, int size):
mUsed(0)
{
mItems = new Item*[mSize];
- std::fill_n(mItems, mSize, (Item*) 0);
+ std::fill_n(mItems, mSize, (Item*) nullptr);
}
Inventory::~Inventory()
@@ -56,7 +56,7 @@ Inventory::~Inventory()
Item *Inventory::getItem(int index) const
{
if (index < 0 || index >= mSize || !mItems[index] || mItems[index]->getQuantity() <= 0)
- return 0;
+ return nullptr;
return mItems[index];
}
@@ -67,7 +67,7 @@ Item *Inventory::findItem(int itemId) const
if (mItems[i] && mItems[i]->getId() == itemId)
return mItems[i];
- return NULL;
+ return nullptr;
}
void Inventory::addItem(int id, int quantity)
@@ -118,7 +118,7 @@ void Inventory::removeItem(int id)
void Inventory::removeItemAt(int index)
{
delete mItems[index];
- mItems[index] = 0;
+ mItems[index] = nullptr;
if (mUsed > 0) {
mUsed--;
distributeSlotsChangedEvent();