mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-16 01:45:36 +02:00
Define operators == and != for ItemStack
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user