| 
					
				 | 
			
			
				@@ -3,17 +3,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				       (cons 'b 'buy-menu) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				       (cons '2 'sell-menu) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				       (cons 's 'sell-menu) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				       (cons '3 'display-prices) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				       (cons 'd 'display-prices) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				       (cons '4 'top-level-game-menu) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				       (cons '3 'top-level-game-menu) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				       (cons 'r 'top-level-game-menu))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 (defvar *trade-menu-options-display* " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Actions: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 1 | Buy | b 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 2 | Sell | s 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-3 | Display Prices | d 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-4 | Return to top level | r 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+3 | Return to top level | r 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 (defun buy-transaction (resource quantity) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -118,14 +115,15 @@ Actions: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ;;; This is kept around in case I need it. I'm not sure 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ;;; this is any less 'bad' than how buy/sell-transaction 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-;;; currently work 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+;;; currently works 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 (defmacro dynamic-slot-access (predicate slotname accessor) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   "Given a predicate where the predicate is a struct slot accessor like 'market-price-of-', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    a slotname like 'petrofuel', and a struct location, return the result of the slot accessor function" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   `(funcall ,(symbol-function (find-symbol (string-upcase (concatenate 'string predicate slotname)))) ,accessor)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-(defmacro dynamic-slot-setting (predicate slotname accessor value) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  `(setf ,(funcall (symbol-function (find-symbol (string-upcase (concatenate 'string predicate slotname)))) accessor) ,value)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+;; Can't get this to work how I expect, need to experiment morex 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+;; (defmacro dynamic-slot-setting (predicate slotname accessor value) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+;;   `(setf (funcall (symbol-function (find-symbol (string-upcase (concatenate 'string predicate slotname)))) accessor) ,value)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 (defun display-prices () 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   (let ((market-list (list 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -139,6 +137,8 @@ Actions: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     (format-table T market-list :column-label '("Resource" "Cost")))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 (defun trade-menu () 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  (display-prices) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  (display-inventory) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   (format t *trade-menu-options-display*) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   (let ((option (prompt-read "Enter an option: "))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     (format t "~%") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -148,21 +148,24 @@ Actions: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ;;; END TRADING ;;; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ;;; MARKET ;;; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-(defun range (start end) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  "Basic function to generate a list that 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   contains a range of ints" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  (loop for i from start below end collect i)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ;;; Use this parameter when randomizing market prices. Used to lookup how 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ;;; 'random' prices should really be." 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 (defparameter *market-price-bounds* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  (list (cons 'petrofuel (range 10 41)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	(cons 'ammo (range 5 31)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	(cons 'archeotech (range 750 2001)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	(cons 'spice (range 5 101)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	(cons 'gruel (range 1 16)))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  (list (cons 'petrofuel '(10 41)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	(cons 'ammo '(5 31)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	(cons 'archeotech '(750 2001)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	(cons 'spice '(5 101)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	(cons 'gruel '(1 16)))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 (defun randomize-market-prices (market) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  (loop for resource in *market-price-bounds* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	do (progn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	     ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  (let ((get-random-val (lambda (resource-arg) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			  (+ (cadr resource-arg) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			     (random (caddr resource-arg)))))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    (loop for resource in *market-price-bounds* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	do (case (car resource) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	     (gruel (setf (market-price-of-gruel market) (funcall get-random-val resource))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	     (ammo (setf (market-price-of-ammo market) (funcall get-random-val resource))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	     (spice (setf (market-price-of-spice market) (funcall get-random-val resource))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	     (archeotech (setf (market-price-of-archeotech market) (funcall get-random-val resource))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	     (petrofuel (setf (market-price-of-petrofuel market) (funcall get-random-val resource))))))) 
			 |