# HG changeset patch # User Steve Losh # Date 1483875285 0 # Node ID 0c407f78da0e143b3c78863057e1da60097743df # Parent bf74ba7cd2b771edc5ed7d56d0634cbe403a2d5a Menuize getting diff -r bf74ba7cd2b7 -r 0c407f78da0e src/main.lisp --- a/src/main.lisp Sun Jan 08 11:31:17 2017 +0000 +++ b/src/main.lisp Sun Jan 08 11:34:45 2017 +0000 @@ -415,12 +415,21 @@ (coords-move-entity player dest-x dest-y)))) (defun get-items () - (iterate (for item :in (remove-if-not #'holdable? (coords-nearby *player* 0))) - (when (player-inventory-full-p *player*) - (popup "You can't carry any more items.") - (return)) - (player-get *player* item)) - :tick) + (let ((items (remove-if-not #'holdable? (coords-nearby *player* 0)))) + (cond ((null items) + nil) + ((player-inventory-full-p *player*) + (popup "You can't carry any more items.") + nil) + ((= 1 (length items)) + (player-get *player* (first items)) + :tick) + (t (let ((item (menu "What do you want to get?" + items + #'holdable/description))) + (if item + (progn (player-get *player* item) :tick) + nil)))))) (defun drop-items () (if (player-inventory-empty-p *player*)