From 8e3b63bd28579d8f8cb3e7844600504f12b087a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ANAND=20=EF=B8=BB=E6=B0=94=E3=83=87=E2=95=90=E4=B8=80?= Date: Sat, 11 May 2019 22:18:27 +0530 Subject: [PATCH] Define operators == and != for ItemStack --- src/inventory.cpp | 9 ++------- src/inventory.h | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/inventory.cpp b/src/inventory.cpp index 3bc67da1b..2335136b1 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -508,14 +508,9 @@ bool InventoryList::operator == (const InventoryList &other) const return false; if(m_name != other.m_name) return false; - for(u32 i=0; iname == s.name && + this->count == s.count && + this->wear == s.wear && + this->metadata == s.metadata); + } + + bool operator !=(const ItemStack &s) const + { + return !(*this == s); + } + /* Properties */