diff options
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/being.cpp b/src/being.cpp index 0aa3d456..eba5b7c0 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -273,8 +273,7 @@ Being::getRawStatistics(void) /** * Update the internal status. */ -void -Being::update(void) +void Being::update(void) { // computed stats. mStats.health = 20 + (20 * mRawStats.vitality); @@ -287,5 +286,29 @@ Being::update(void) mNeedUpdate = false; } +void Being::setInventory(const std::vector<unsigned int> &inven) +{ + inventory = inven; +} + +bool Being::addInventory(unsigned int itemId) +{ + // If required weight could be tallied to see if player can pick up more. + inventory.push_back(itemId); + return true; +} + +bool Being::delInventory(unsigned int itemId) +{ + for (std::vector<unsigned int>::iterator i = inventory.begin(); + i != inventory.end(); i++) { + if (*i == itemId) { + inventory.erase(i); + return true; + } + } + return false; +} + } // namespace tmwserv |