aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/unit.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-07-27 07:41:38 -0500
committerColin Okay <colin@cicadas.surf>2022-07-27 07:41:38 -0500
commit38b33de4c2e03a6f706fced1b866d975a6296156 (patch)
tree69b18dde462d45447f52dd3a1f2b2d132d52b1ad /src/core/unit.lisp
parentb510307e505275fffcbd029f4ae437581bc916a9 (diff)
[refactor] to reduce use of vec
Diffstat (limited to 'src/core/unit.lisp')
-rw-r--r--src/core/unit.lisp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/unit.lisp b/src/core/unit.lisp
index 8fe6521..1102f20 100644
--- a/src/core/unit.lisp
+++ b/src/core/unit.lisp
@@ -101,11 +101,13 @@
(mat:nmrotate m vec:+vz+ r)
(mat:nmtranslate m (vec:v* -1.0 tr))
- (list (mat:m* m (vec:vec x y 0.0 1.0))
- (mat:m* m (vec:vec x (+ y h) 0.0 1.0))
- (mat:m* m (vec:vec (+ x w) (+ y h) 0.0 1.0))
- (mat:m* m (vec:vec (+ x w) y 0.0 1.0))
- (mat:m* m (vec:vec x y 0.0 1.0))))))))
+ (loop for vec in (list (mat:m* m (vec:vec x y 0.0 1.0))
+ (mat:m* m (vec:vec x (+ y h) 0.0 1.0))
+ (mat:m* m (vec:vec (+ x w) (+ y h) 0.0 1.0))
+ (mat:m* m (vec:vec (+ x w) y 0.0 1.0))
+ (mat:m* m (vec:vec x y 0.0 1.0)))
+ collect (list (vec:vx vec)
+ (vec:vy vec))))))))
(defun units-intersect-p (au1 au2)
"Returns T if the two units AU1 an AU2 intersect. Both must implement GET-RECT."