summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorAaron Marks <nymacro@gmail.com>2005-08-04 08:54:03 +0000
committerAaron Marks <nymacro@gmail.com>2005-08-04 08:54:03 +0000
commitca4fec29828b55ea66c5835ab20d2287bb1eb4ff (patch)
tree7211660bd5fed954a82a234faf14de1db0d612ab /src/being.cpp
parent18b778662388e98e90b13f28f28a83911ee96e95 (diff)
downloadmanaserv-ca4fec29828b55ea66c5835ab20d2287bb1eb4ff.tar.gz
manaserv-ca4fec29828b55ea66c5835ab20d2287bb1eb4ff.tar.bz2
manaserv-ca4fec29828b55ea66c5835ab20d2287bb1eb4ff.tar.xz
manaserv-ca4fec29828b55ea66c5835ab20d2287bb1eb4ff.zip
Added basic inventory (not fully functional)
Extended GameHandler Extended protocol Fixed problem with SQL query
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp27
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