summaryrefslogtreecommitdiffstats
path: root/src/game.lisp
diff options
context:
space:
mode:
authorEl-BG-1970 <elouangros@hotmail.com>2022-08-04 11:13:32 +0200
committerEl-BG-1970 <elouangros@hotmail.com>2022-08-04 11:13:32 +0200
commit164b961cdd97c4ef324bbb0ae5f46b394201183b (patch)
tree0051bfc0d5c91e150eec85f8860f3244332a0764 /src/game.lisp
parent8104b4db1c5752b777d17e1f84f8a575587c735f (diff)
downloadtransacc-164b961cdd97c4ef324bbb0ae5f46b394201183b.tar.gz
implemented game:buy-item and game:sell-item
Diffstat (limited to 'src/game.lisp')
-rw-r--r--src/game.lisp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/game.lisp b/src/game.lisp
index 7c2cbbb..2f7ce88 100644
--- a/src/game.lisp
+++ b/src/game.lisp
@@ -1,6 +1,8 @@
(defpackage game
(:use :cl)
- (:export :new-game))
+ (:export :new-game
+ :buy-item
+ :sell-item))
(in-package :game)
@@ -17,3 +19,15 @@
:player player
:zones zones
:start-zone start-zone))
+
+(defmethod buy-item ((g game) name amount)
+ (with-slots (player curzone) g
+ (let ((item (zone:get-commodity curzone name)))
+ (when item
+ (player:buy-item player name amount)))))
+
+(defmethod sell-item ((g game) name amount)
+ (with-slots (player curzone) g
+ (let ((item (zone:get-commodity curzone name)))
+ (when item
+ (player:sell-item player name amount)))))