diff options
Diffstat (limited to 'src/player.lisp')
-rw-r--r-- | src/player.lisp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/player.lisp b/src/player.lisp index 5807ac5..30eefd5 100644 --- a/src/player.lisp +++ b/src/player.lisp @@ -40,8 +40,8 @@ (id err) (balance err) (required err))))) (fn player-exists? (id table) (-> (symbol hash-table) boolean) - (and (gethash id table) - (player-p (gethash id table)))) + (let ((item (gethash id table))) + (and item (player-p item)))) (defun error-if-no-player (id table) (unless (player-exists? id table) @@ -60,12 +60,12 @@ (unless (player-can-pay? id table amount) (error 'error-player-broke :id id :balance (player-balance (gethash id table)) :required amount)) - (decf (player-balance (gethash id table)) amount)) + (-<> id (gethash table) player-balance (decf amount))) (fn player-credit (id table amount) (-> (symbol hash-table fixnum) fixnum) (error-if-no-player id table) - (incf (player-balance (gethash id table)) amount)) + (-<> id (gethash table) player-balance (incf amount))) (fn player-set-cards (id table cards) (-> (symbol hash-table cardset) t) (error-if-no-player id table) - (setf (player-hand (gethash id table)) cards)) + (-<> id (gethash table) player-hand (setf cards))) |