Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinmera committed Dec 16, 2018
1 parent 7916526 commit 3e3aa13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions entity.lisp
Expand Up @@ -8,6 +8,10 @@

(defgeneric matches (a b))

(defmethod matches :around (a b)
(or (eq a b)
(call-next-method)))

(defmethod matches (a b)
(equal a b))

Expand Down
13 changes: 7 additions & 6 deletions event-loop.lisp
Expand Up @@ -90,12 +90,13 @@
;; The check will assume nothing has changed and it'll continue from
;; where it left off, thus missing events before the current index.
(defmethod process ((loop event-loop))
(loop for i = (1- (incf (queue-index loop)))
while (< i (length (queue loop)))
do (let ((event (aref (queue loop) i)))
(when event
(handle event loop)
(setf (aref (queue loop) i) NIL))))
(with-simple-restart (discard-events "Discard all events.")
(loop for i = (1- (incf (queue-index loop)))
while (< i (length (queue loop)))
do (let ((event (aref (queue loop) i)))
(when event
(handle event loop)
(setf (aref (queue loop) i) NIL)))))
(setf (fill-pointer (queue loop)) 0
(queue-index loop) 0))

Expand Down

0 comments on commit 3e3aa13

Please sign in to comment.