aboutsummaryrefslogtreecommitdiff
path: root/src/inventory.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/inventory.h')
-rw-r--r--src/inventory.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/inventory.h b/src/inventory.h
index 13bd27d8b..ff0086102 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -390,6 +390,20 @@ public:
{
return m_wear;
}
+ // Returns true if weared out
+ bool addWear(u16 add)
+ {
+ if(m_wear >= 65535 - add)
+ {
+ m_wear = 65535;
+ return true;
+ }
+ else
+ {
+ m_wear += add;
+ return false;
+ }
+ }
private:
std::string m_toolname;
u16 m_wear;