bool item::stacks_with(item rhs) { bool stacks = (type == rhs.type && damage == rhs.damage && active == rhs.active && charges == rhs.charges && item_flags == rhs.item_flags && contents.size() == rhs.contents.size() && (!goes_bad() || bday == rhs.bday)); if ((corpse == NULL && rhs.corpse != NULL) || (corpse != NULL && rhs.corpse == NULL) ) return false; if (corpse != NULL && rhs.corpse != NULL && corpse->id != rhs.corpse->id) return false; if (contents.size() != rhs.contents.size()) return false; if(is_var_veh_part()) if(bigness != rhs.bigness) return false; for (int i = 0; i < contents.size() && stacks; i++) stacks &= contents[i].stacks_with(rhs.contents[i]); return stacks; }
bool item::stacks_with(item rhs) { bool stacks = (type == rhs.type && damage == rhs.damage && active == rhs.active && charges == rhs.charges && contents.size() == rhs.contents.size() && (!goes_bad() || bday == rhs.bday)); if (contents.size() != rhs.contents.size()) return false; for (int i = 0; i < contents.size() && stacks; i++) stacks &= contents[i].stacks_with(rhs.contents[i]); return stacks; }