diff options
Diffstat (limited to 'src/wheelwork.lisp')
-rw-r--r-- | src/wheelwork.lisp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/wheelwork.lisp b/src/wheelwork.lisp index 8a534ed..ab432d5 100644 --- a/src/wheelwork.lisp +++ b/src/wheelwork.lisp @@ -10,7 +10,7 @@ (defmethod add-unit ((unit unit)) "Adds a unit to the display." (assert *application*) - (push unit (application-scene *application*)) + (vector-push-extend unit (application-scene *application*) (1+ (length (application-scene *application*)))) (setf (unit-in-scene-p unit) t)) (defgeneric drop-unit (unit)) @@ -109,15 +109,21 @@ position. The list always contains the app itself as the last element." (defun unit-under (app x y) "Finds the visible unit that contains the point x y, returns it as a single elemtn list, or nil if none found" - (loop for u in (application-scene app) - when (unit-visibly-contains-p u x y) - return (list u))) + (with-slots (scene) app + (loop + for idx from (1- (length scene)) downto 0 + for u = (elt scene idx) + when (unit-visibly-contains-p u x y) + return (list u)))) (defun all-units-under (app x y) "Finds all units under the point x y" - (loop for u in (application-scene app) - when (unit-visibly-contains-p u x y) - collect u)) + (with-slots (scene) app + (loop + for idx from (1- (length scene)) downto 0 + for u = (elt scene idx) + when (unit-visibly-contains-p u x y) + collect u))) (defvar *event-still-bubbling-p* nil "Controls whether an event is bubbling") |