diff options
Diffstat (limited to 'server/api/game-manager.lisp')
| -rw-r--r-- | server/api/game-manager.lisp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/server/api/game-manager.lisp b/server/api/game-manager.lisp index e5355d1..751aae1 100644 --- a/server/api/game-manager.lisp +++ b/server/api/game-manager.lisp @@ -24,6 +24,14 @@ (with-slots (games) gm (setf games (remove-if #'(lambda (entry) (eql game-id (getf entry :id))) games)))) +(defgeneric dump (g game-id) + (:documentation "Dump a game in the Game manager. Return a plist.")) + +(defmethod dump ((g game-manager) game-id) + (with-slots (games) g + (append (list :id game-id) (remote-snake-server-game:dump (get-game g game-id))))) + + (defmethod get-game ((gm game-manager) game-id) (with-slots (games) gm (let ((game (remove-if-not #'(lambda (entry) (eql game-id (getf entry :id))) games))) |
