diff options
author | ANAND ︻气デ═一 <ClobberXD@gmail.com> | 2019-05-11 22:18:27 +0530 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-05-11 18:48:27 +0200 |
commit | 8e3b63bd28579d8f8cb3e7844600504f12b087a5 (patch) | |
tree | 43e963c21839c92cbc3f81e19c899cb055a8cd04 /src/inventory.h | |
parent | 72feab081c336d2d71d300131d30e71694b485f3 (diff) | |
download | minetest-8e3b63bd28579d8f8cb3e7844600504f12b087a5.tar.gz minetest-8e3b63bd28579d8f8cb3e7844600504f12b087a5.tar.bz2 minetest-8e3b63bd28579d8f8cb3e7844600504f12b087a5.zip |
Define operators == and != for ItemStack
Diffstat (limited to 'src/inventory.h')
-rw-r--r-- | src/inventory.h | 15 |
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 */ |