diff options
Diffstat (limited to 'src/player.lisp')
| -rw-r--r-- | src/player.lisp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/player.lisp b/src/player.lisp index b5c8651..c9033ac 100644 --- a/src/player.lisp +++ b/src/player.lisp @@ -7,7 +7,8 @@ :repay-debt :buy-item :sell-item - :find-item)) + :find-item + :inventory-stats)) (in-package :player) @@ -40,11 +41,10 @@ (with-slots (stock cash) p (let ((cost (* quantity (commodities:price item)))) - (when (>= cash cost) - (progn - (inventory:add-item stock item quantity) - (setq cash (- cash cost)) - t))))) + (when (and (>= cash cost) + (inventory:add-item stock item quantity)) + (setq cash (- cash cost)) + t)))) (defmethod sell-item ((p player) item amount) (with-slots (stock cash) p @@ -67,3 +67,6 @@ (setq cash (- cash amount) debt (- debt amount)) t))) + +(defmethod inventory-stats ((p player)) + (inventory:how-filled (stock p))) |
