diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-07-09 21:31:43 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-07-10 00:08:23 +0100 |
commit | cd6ac8930db6ad3b866b4b8398a25b49c3767a5b (patch) | |
tree | b7d85e0845f1d0aa1b17ee3a0105823190bba4be /src/player.lisp | |
parent | 062b5f59d74bda9710c3b532648658a4a7910290 (diff) | |
download | cantedraw-master.tar.gz cantedraw-master.tar.bz2 cantedraw-master.zip |
Overhaulmaster
Loads of changes, some which I wasn't sure what I was on when doing
them
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))) |