From b729d2f97a9002cd9810b07d5a8178c3f6dd83e9 Mon Sep 17 00:00:00 2001 From: El-BG-1970 Date: Fri, 26 Aug 2022 16:56:03 +0200 Subject: added prices panel to gui and panel switching --- src/game.lisp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/game.lisp') diff --git a/src/game.lisp b/src/game.lisp index 40e201c..f0efd14 100644 --- a/src/game.lisp +++ b/src/game.lisp @@ -7,6 +7,7 @@ :get-profit :get-profit-in-zone :get-cur-zone + :get-zone :commodities-panel :player-stats)) @@ -60,9 +61,13 @@ (with-slots (cur-zone) g (get-profit-in-zone g name cur-zone))) +(defmethod get-zone ((g game) zone) + (with-slots (zones) g + (find-if (lambda (x) (string= (zone:name x) zone)) + zones))) -(defmethod commodities-panel ((g game)) - (with-slots (player cur-zone) g +(defmethod commodities-panel ((g game) zone) + (with-slots (player) g (mapcar (lambda (c) (let* ((name (commodities:name c)) (price (commodities:price c)) @@ -75,7 +80,7 @@ :price price :qty quantity :profit profit))) - (zone:get-commodities cur-zone)))) + (zone:get-commodities zone)))) (defmethod player-stats ((g game)) (with-slots (player) g -- cgit v1.2.3