X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Finventory.cpp;h=4b1beb230c6a90fbe9dd71b463a433fb6d5638be;hb=ee7af21e411d5d43ba67f4b67603f72e62b0570d;hp=7051b611fe014f4c28996a35a7645b7b133b322d;hpb=22e186b4aa88b585e71500c4e9a03bf69b0b6191;p=minetest.git diff --git a/src/inventory.cpp b/src/inventory.cpp index 7051b611f..4b1beb230 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -175,7 +175,7 @@ void ItemStack::deSerialize(std::istream &is, IItemDefManager *itemdef) // Convert old materials if(material <= 0xff) material = content_translate_from_19_to_internal(material); - if(material > MAX_CONTENT) + if(material > 0xfff) throw SerializationError("Too large material number"); // Convert old id to name NameIdMapping legacy_nimap; @@ -194,7 +194,7 @@ void ItemStack::deSerialize(std::istream &is, IItemDefManager *itemdef) is>>material; u16 materialcount; is>>materialcount; - if(material > MAX_CONTENT) + if(material > 0xfff) throw SerializationError("Too large material number"); // Convert old id to name NameIdMapping legacy_nimap; @@ -562,6 +562,26 @@ InventoryList & InventoryList::operator = (const InventoryList &other) return *this; } +bool InventoryList::operator == (const InventoryList &other) const +{ + if(m_size != other.m_size) + return false; + if(m_width != other.m_width) + return false; + if(m_name != other.m_name) + return false; + for(u32 i=0; i