diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-12-19 15:15:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-12-19 15:15:44 +0300 |
commit | f0315000bcf20685471966d2f25cd8e9f35e8230 (patch) | |
tree | b5b51e2880191696d6217181d5aa4d5c5341265f /src/inventory.cpp | |
parent | 5615f8dde421e8d44c5e49a5a44ab7e69cb543a5 (diff) | |
download | plus-f0315000bcf20685471966d2f25cd8e9f35e8230.tar.gz plus-f0315000bcf20685471966d2f25cd8e9f35e8230.tar.bz2 plus-f0315000bcf20685471966d2f25cd8e9f35e8230.tar.xz plus-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.cpp | 15 |
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)); +} |