# HG changeset patch # User Steve Losh # Date 1470673425 0 # Node ID c863300abd60f718994fc336cb8446c8530bde24 # Parent ebc88989782fa6210873febb2a7fe440acccf373 Try not to spam the screen too hard diff -r ebc88989782f -r c863300abd60 silt.lisp --- a/silt.lisp Mon Aug 08 16:15:24 2016 +0000 +++ b/silt.lisp Mon Aug 08 16:23:45 2016 +0000 @@ -193,8 +193,19 @@ (write-string-at (left-pad string padding) tx ty)))))) +(defun take (n list) + (iterate (repeat n) + (for item :in list) + (collect item))) + + +(defun log-height () + (max 5 (floor *screen-height* 4))) + + (defun log-message (s &rest args) - (ticklist-push *game-log* (apply #'format nil s args) 200)) + (ticklist-push *game-log* (apply #'format nil s args) 200) + (setf *game-log* (take (log-height) *game-log*))) (defclause-sequence ACROSS-FLAT-ARRAY INDEX-OF-FLAT-ARRAY @@ -1283,7 +1294,7 @@ (tick-world) (tick-log)) (render-map) - (sleep 0.01) + (sleep 0.02) (state-map-loop)))))