aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/wheelwork.lisp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/wheelwork.lisp b/src/wheelwork.lisp
index da432ba..b4c5431 100644
--- a/src/wheelwork.lisp
+++ b/src/wheelwork.lisp
@@ -9,17 +9,20 @@
(defmethod add-unit ((unit unit))
"Adds a unit to the display."
- (assert *application*)
(vector-push-extend unit (application-scene *application*) (1+ (length (application-scene *application*))))
(setf (unit-in-scene-p unit) t))
(defgeneric drop-unit (unit))
(defmethod drop-unit ((unit unit))
"A removes a unit from the display."
- (assert *application*)
+ (setf (unit-in-scene-p unit) nil)
(setf (application-scene *application*)
- (delete unit (application-scene *application*)))
- (setf (unit-in-scene-p unit) nil))
+ (delete unit (application-scene *application*))))
+
+(defun drop-unit-if (predicate)
+ "Removes all units from scene that satisfy the predicate."
+ (setf (application-scene *application*)
+ (delete-if predicate (application-scene *application*))))
(defun start (app &key (x :centered) (y :centered))
(sdl2:with-init (:everything)