Permalink
Browse files

Minor improvements

  • Loading branch information...
Shinmera committed Dec 16, 2018
1 parent 7916526 commit 3e3aa1327fafa53d5e4c4dd194a994e6a3ae2129
Showing with 11 additions and 6 deletions.
  1. +4 −0 entity.lisp
  2. +7 −6 event-loop.lisp
@@ -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))

@@ -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))

0 comments on commit 3e3aa13

Please sign in to comment.