clear();
}
+pouch::pouch(const pouch &p)
+{
+ count = p.count;
+ items = p.items;
+}
+
+pouch::pouch(pouch *p)
+{
+ count = p->count;
+ items = p->items;
+}
+
void pouch::clear()
{
items.clear();
+ count = 0;
}
bool pouch::isEmpty()
{
return NULL;
}
- itemContainer it(i);
- items.push_front(it);
- ++count;
- sort();
- return &items.front();
+ else
+ {
+ itemContainer it(i), *temp;
+ items.push_front(it);
+ ++count;
+ temp = &items.front();
+ sort();
+ return temp;
+ }
}
+
itemContainer *pouch::addItem(item *i, int amt)
{
- if (count >= 3000 || count + amt >= maxitems)
+ if (count >= 3000 || (count + amt) >= maxitems)
{
return NULL;
}
-
- for (int x=0; x < amt; x++)
+ else
{
- itemContainer it(i);
- items.push_front(it);
- ++count;
+ itemContainer it(i), *temp;
+ for (int x=0; x < amt; x++)
+ {
+ items.push_front(it);
+ ++count;
+ }
+ temp = &items.front();
+ sort();
+ return temp;
}
- sort();
- return &items.front();
}
itemContainer *pouch::addItemNoChecks(item *i)
void pouch::deleteItem(item *i)
{
list<itemContainer>::iterator item_iter;
- count--;
item_iter = find(items.begin(), items.end(), i);
-
+
if (item_iter != items.end())
- items.erase(item_iter);
+ {
+ items.erase(item_iter);
+ count--;
+ }
}
const pouch &pouch::operator=(const pouch &right)