aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Pouar <pouar@pouar.net>2020-07-18 12:41:12 -0500
committerGravatar Pouar <pouar@pouar.net>2020-07-18 12:41:12 -0500
commitd90e77b2b9161b19f753da0a67fc22366f0e8b5c (patch)
tree64f9d95363d381455ca81029bcbb836be506440a
parentapparently this feature was already supported in iterate (diff)
bugfix
-rw-r--r--core/bin.lisp13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/bin.lisp b/core/bin.lisp
index 6f2972c..d88e7f6 100644
--- a/core/bin.lisp
+++ b/core/bin.lisp
@@ -1120,13 +1120,12 @@ You can also specify multiple directions, for example @code{(move :south :south)
(let ((allies-length (list-length (allies-of *game*))))
(if (< allies-length ally-index)
(format t "You only have ~d allies~%" allies-length)
- (pushnew (nth ally-index (allies-of *game*)) (team-of *game*)
- :test (lambda (ally team-member)
- (let ((result (eq ally team-member)))
- (if result
- (format t "~a is already on the battle team~%" (name-of ally))
- (format t "~a has joined the battle team~%" (name-of ally)))
- result))))))
+ (let* ((ally (nth ally-index (allies-of *game*)))
+ (old (car (team-of *game*)))
+ (new (car (pushnew ally (team-of *game*) :test 'eq))))
+ (if (eq old new)
+ (format t "~a is already on the battle team~%" (name-of ally))
+ (format t "~a has joined the battle team~%" (name-of ally)))))))
(defunassert yadfa-world:remove-ally-from-team (team-index)
(team-index unsigned-byte)
"Removes an ally to your battle team. @var{TEAM-INDEX} is the index of an ally in your battle team list"