aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Pouar <pouar@pouar.net>2020-07-17 23:57:09 -0500
committerGravatar Pouar <pouar@pouar.net>2020-07-17 23:57:09 -0500
commit79124b39dc1e2742373511cfadc93ccc54b42e25 (patch)
treec6d70bf40c17fd56b7d28c17fed3a18999aaf0f4
parentmake use of element types where they make sense (diff)
apparently this feature was already supported in iterate
-rw-r--r--core/bin.lisp6
-rw-r--r--core/libexec.lisp54
-rw-r--r--data/items/diaper.lisp8
3 files changed, 34 insertions, 34 deletions
diff --git a/core/bin.lisp b/core/bin.lisp
index 5ac1f73..6f2972c 100644
--- a/core/bin.lisp
+++ b/core/bin.lisp
@@ -403,7 +403,7 @@ You can also specify multiple directions, for example @code{(move :south :south)
(format t "Bitcoins: ~a~%~%" (get-bitcoins-from-prop prop (position-of (player-of *game*))))
(apply #'format-table '("Index" "Name" "Class")
(iter (for i in (get-items-from-prop prop (position-of (player-of *game*))))
- (declaring fixnum for j upfrom 0)
+ (for (the fixnum j) upfrom 0)
(collect (list j (name-of i) (type-of i)))))
(format t "~%~%Actions: ")
(iter (for (key value) on (actions-of (getf (get-props-from-zone (position-of (player-of *game*))) prop)) by #'cddr)
@@ -818,7 +818,7 @@ You can also specify multiple directions, for example @code{(move :south :south)
(let ((items (sort (remove-duplicates items) #'<)))
(setf items (iter (generate i in items)
(for j in (inventory-of (player-of *game*)))
- (declaring fixnum for k upfrom 0)
+ (for (the fixnum k) upfrom 0)
(when (first-iteration-p)
(next i))
(when (= k i)
@@ -855,7 +855,7 @@ You can also specify multiple directions, for example @code{(move :south :south)
(let ((items (sort (remove-duplicates items) #'<)))
(setf items (iter (generate i in items)
(for j in (player-of *game*))
- (declaring fixnum for k upfrom 0)
+ (for (the fixnum k) upfrom 0)
(when (first-iteration-p)
(next i))
(when (= k i)
diff --git a/core/libexec.lisp b/core/libexec.lisp
index 96e9130..f8cc33b 100644
--- a/core/libexec.lisp
+++ b/core/libexec.lisp
@@ -184,13 +184,13 @@
(type type-specifier
list list)
(iter (for i in list)
- (declaring fixnum for j upfrom 0)
+ (for (the fixnum j) upfrom 0)
(when (typep i type)
(collect j))))
(declaim (ftype (function ((or list symbol)) (values boolean &optional)) finished-events unfinished-events))
(defunassert finished-events (events)
(events (or list symbol))
- (iter (declaring (or list symbol) for event in (a:ensure-list events))
+ (iter (for (the (or list symbol) event) in (a:ensure-list events))
#-(or sbcl ccl)
(check-type event (or list symbol))
(unless (gethash (a:ensure-list event) (finished-events-of *game*))
@@ -198,7 +198,7 @@
(finally (return t))))
(defunassert unfinished-events (events)
(events (or list symbol))
- (iter (declaring (or list symbol) for event in (a:ensure-list events))
+ (iter (for (the (or list symbol) event) in (a:ensure-list events))
#-(or sbcl ccl)
(check-type event (or list symbol))
(when (gethash (a:ensure-list event) (finished-events-of *game*))
@@ -206,7 +206,7 @@
(finally (return t))))
(defunassert finish-events (events)
(events (or list symbol))
- (iter (declaring symbol for event in (a:ensure-list events))
+ (iter (for (the symbol event) in (a:ensure-list events))
#-(or sbcl ccl)
(check-type event symbol)
(remhash event (current-events-of *game*))
@@ -311,7 +311,7 @@
((eq a t)
t)
(t (< a b))))
- :key #'duration-of))))
+ :key #'duration-of))))
(duration (or duration (duration-of (make-instance status-condition)))))
(pushnew i (getf (status-conditions-of *battle*) user) :test (or test #'eql) :key (or key #'identity))
(when (and (not (eq (duration-of i) t)) (< (duration-of i) duration))
@@ -377,7 +377,7 @@
(declaim (ftype (function ((or symbol list)) (values list &optional)) trigger-event))
(defunassert trigger-event (event-ids)
(event-ids (or symbol list))
- (iter (declaring symbol for event-id in (a:ensure-list event-ids))
+ (iter (for (the symbol event-id) in (a:ensure-list event-ids))
#-(or sbcl ccl)
(check-type event-id symbol)
(when (and
@@ -472,17 +472,17 @@
:team-npcs ,team-npcs)))
(setf *battle*
(apply #'make-instance 'battle
- :enemies (iter (declaring list for j in enemies)
+ :enemies (iter (for (the list j) in enemies)
(collect (apply #'make-instance (car j) (eval (cdr j)))))
- :team-npcs (iter (declaring list for j in team-npcs)
+ :team-npcs (iter (for (the list j) in team-npcs)
(collect (apply #'make-instance (car j) (eval (cdr j)))))
keys))
(format t "~a~%" (enter-battle-text-of *battle*))
- (iter (declaring symbol for j in (iter (for i in (enemies-of *battle*))
- (unless (s:memq (class-name (class-of i)) (seen-enemies-of *game*))
- (format t "~a was added to your pokedex~%" (name-of i))
- (push (class-name (class-of i)) (seen-enemies-of *game*))
- (collect (class-name (class-of i))))))
+ (iter (for (the symbol j) in (iter (for i in (enemies-of *battle*))
+ (unless (s:memq (class-name (class-of i)) (seen-enemies-of *game*))
+ (format t "~a was added to your pokedex~%" (name-of i))
+ (push (class-name (class-of i)) (seen-enemies-of *game*))
+ (collect (class-name (class-of i))))))
(yadfa-bin:pokedex j))
(switch-user-packages)
(process-battle :attack t :no-team-attack t))
@@ -603,7 +603,7 @@
#P"e.xpm"
#P"dot.xpm")))
(iter (for direction in '(:east :west :south :north))
- (declaring fixnum for byte-position upfrom 0)
+ (for (the fixnum byte-position) upfrom 0)
(unless (travelablep position direction)
(setf (ldb (byte 1 byte-position) b) 1)))
(aref array b))))
@@ -637,16 +637,16 @@
(destructuring-bind (posx posy posz posm) position
(declare (type integer posx posy posz)
(type symbol posm))
- (iter (declaring integer for y
- from (- posy 15)
- to (+ posy 15))
+ (iter (for (the integer y)
+ from (- posy 15)
+ to (+ posy 15))
(for y-pos
from start-y
to (+ start-y (* 30 (the (unsigned-byte 32) (clim:pattern-height pattern))))
by (the (unsigned-byte 32) (clim:pattern-height pattern)))
- (iter (declaring integer for x
- from (- posx 15)
- to (+ posx 15))
+ (iter (for (the integer x)
+ from (- posx 15)
+ to (+ posx 15))
(for x-pos
from start-x
to (+ start-x (* 30 (the (unsigned-byte 32) (clim:pattern-width pattern))))
@@ -3383,9 +3383,9 @@ randomrange is @code{(random-from-range 85 100)}"
(target-element-types (element-type-of target))
(user-element-types (element-type-of user)))
(s:mvlet ((super-effective not-very-effective no-effect (funcall (lambda ()
- (iter (declaring fixnum with super-effective = 0)
- (declaring fixnum with not-very-effective = 0)
- (declaring fixnum with no-effect = 0)
+ (iter (with (the fixnum super-effective) = 0)
+ (with (the fixnum not-very-effective) = 0)
+ (with (the fixnum no-effect) = 0)
(for target-element-type in target-element-types)
(case (type-match attack-element-type target-element-type)
(:super-effective (incf super-effective))
@@ -3849,7 +3849,7 @@ randomrange is @code{(random-from-range 85 100)}"
(let ((items (sort (remove-duplicates items-to-sell) #'<)))
(setf items (iter (generate i in items)
(for j in (inventory-of user))
- (declaring fixnum for k upfrom 0)
+ (for (the fixnum k) upfrom 0)
(when (first-iteration-p)
(next i))
(when (= k i)
@@ -3873,7 +3873,7 @@ randomrange is @code{(random-from-range 85 100)}"
(when format-items
(format t "~10a~40a~10@a~%" "Index" "Item" "Price")
(iter (for i in items-for-sale)
- (declaring fixnum for j upfrom 0)
+ (for (the fixnum j) upfrom 0)
(let ((item (apply #'make-instance (car i) (eval (cdr i)))))
(format t "~10a~40a~10@a~%" j (name-of item) (value-of item))))))
(declaim (ftype (function (list symbol symbol) (values action &optional)) getf-action-from-prop))
@@ -3943,8 +3943,8 @@ randomrange is @code{(random-from-range 85 100)}"
(a:deletef item (inventory-of character) :count 1))))
(t
(battle-script character (a:random-elt (if (typep character 'enemy)
- (team-of *game*)
- (enemies-of *battle*)))))))
+ (team-of *game*)
+ (enemies-of *battle*)))))))
(defmethod process-battle-turn ((character base-character) attack item reload selected-target)
(iter (for status-condition in (getf (status-conditions-of *battle*) character))
(when (or (eq (duration-of status-condition) t) (> (duration-of status-condition) 0))
diff --git a/data/items/diaper.lisp b/data/items/diaper.lisp
index 5d26aa4..1f3d045 100644
--- a/data/items/diaper.lisp
+++ b/data/items/diaper.lisp
@@ -213,10 +213,10 @@
(f:fmt nil value " " color (:format " gem~P" value))))
(calculate-gems (amount)
(declare (type fixnum amount))
- (iter (declaring simple-string for color in '("magneta" "yellow" "purple" "green" "red"))
- (declaring fixnum for value in '(25 10 5 2 1))
- (declaring fixnum with ret = 0)
- (setf ret (iter (declaring fixnum with ret = 0)
+ (iter (for (the simple-string color) in '("magneta" "yellow" "purple" "green" "red"))
+ (for (the fixnum value) in '(25 10 5 2 1))
+ (with (the fixnum ret) = 0)
+ (setf ret (iter (with (the fixnum ret) = 0)
(while (>= amount value))
(incf ret)
(decf amount value)