diff options
Diffstat (limited to 'inc/Inventory.inc')
-rw-r--r-- | inc/Inventory.inc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/inc/Inventory.inc b/inc/Inventory.inc index 3396eb9..20c63bf 100644 --- a/inc/Inventory.inc +++ b/inc/Inventory.inc @@ -20,13 +20,13 @@ class Inventory { } private function _addItem($item) { - $counter = 0; - foreach($this->items as $object){ + foreach($this->items as $k => $object){ if($object[0] == $item){ - $counter++; + $this->items[$k][1]++; + return $this->items[$k]; } } - $tab = array($item,$counter+1); + $tab = array($item,1); $this->items[] = $tab; return $tab; } |