From d261883d4148a87ea8f6bb6cef16be406a2c0a10 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Thu, 9 May 2019 18:38:31 +0200 Subject: Update api --- server/api/game-manager.lisp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'server/api/game-manager.lisp') 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))) -- cgit v1.2.3