aboutsummaryrefslogtreecommitdiffstats
path: root/inc/Inventory.inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc/Inventory.inc')
-rw-r--r--inc/Inventory.inc14
1 files changed, 9 insertions, 5 deletions
diff --git a/inc/Inventory.inc b/inc/Inventory.inc
index 2be48f8..3e0137d 100644
--- a/inc/Inventory.inc
+++ b/inc/Inventory.inc
@@ -1,5 +1,7 @@
<?php
+require_once("perso.inc");
+
class Inventory {
public $items = array();
@@ -55,12 +57,14 @@ class Inventory {
foreach($this->items as $k => $object){
if($object[0] == $item) {
$nb = $this->items[$k][1];
- if($nb > 0) {
- $this->items[$k][0]->consume();
- $this->items[$k][1]--;
+ if(limitUse($this->items[$k][0])){
+ if($nb > 0) {
+ $this->items[$k][0]->consume();
+ $this->items[$k][1]--;
+ }
+ if($nb-1 <= 0) $this->_removeItem($item);
+ return array($object[0], $nb-1);
}
- if($nb-1 <= 0) $this->_removeItem($item);
- return array($object[0], $nb-1);
}
}
return false;