summaryrefslogtreecommitdiff
path: root/src/inventory.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-19 15:15:44 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-19 15:15:44 +0300
commitf0315000bcf20685471966d2f25cd8e9f35e8230 (patch)
treeb5b51e2880191696d6217181d5aa4d5c5341265f /src/inventory.cpp
parent5615f8dde421e8d44c5e49a5a44ab7e69cb543a5 (diff)
downloadmv-f0315000bcf20685471966d2f25cd8e9f35e8230.tar.gz
mv-f0315000bcf20685471966d2f25cd8e9f35e8230.tar.bz2
mv-f0315000bcf20685471966d2f25cd8e9f35e8230.tar.xz
mv-f0315000bcf20685471966d2f25cd8e9f35e8230.zip
add ability to give more than one item to npc. (evol only)
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 61500fb7a..9a82f192b 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -268,3 +268,18 @@ std::string Inventory::getName() const
}
}
}
+
+void Inventory::resize(const unsigned int newSize)
+{
+ clear();
+ if (mSize == newSize)
+ return;
+
+ for (unsigned i = 0; i < mSize; i++)
+ delete mItems[i];
+ delete [] mItems;
+
+ mSize = newSize;
+ mItems = new Item*[mSize];
+ std::fill_n(mItems, mSize, static_cast<Item*>(nullptr));
+}