summaryrefslogtreecommitdiff
path: root/src/inventory.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/inventory.h')
-rw-r--r--src/inventory.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/inventory.h b/src/inventory.h
index 465aa66db..95a0bb43e 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -41,7 +41,7 @@ struct ItemStack
// Serialization
void serialize(std::ostream &os) const;
- // Deserialization. Pass itemdef unless you don't want aliases resolved.
+ // Deserialization. Pass itemdef unless you don't want aliases resolved.
void deSerialize(std::istream &is, IItemDefManager *itemdef = NULL);
void deSerialize(const std::string &s, IItemDefManager *itemdef = NULL);
@@ -161,6 +161,19 @@ struct ItemStack
// Similar to takeItem, but keeps this ItemStack intact.
ItemStack peekItem(u32 peekcount) const;
+ bool operator ==(const ItemStack &s) const
+ {
+ return (this->name == s.name &&
+ this->count == s.count &&
+ this->wear == s.wear &&
+ this->metadata == s.metadata);
+ }
+
+ bool operator !=(const ItemStack &s) const
+ {
+ return !(*this == s);
+ }
+
/*
Properties
*/