summaryrefslogtreecommitdiffstats
path: root/src/game.lisp
diff options
context:
space:
mode:
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)))))