mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
Define operators == and != for ItemStack
This commit is contained in:
parent
72feab081c
commit
8e3b63bd28
2 changed files with 16 additions and 8 deletions
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue