From 1c94cfc42845cb4e5032f5a864c9a1154bf0e8d6 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 19 Jul 2018 09:33:57 +0200 Subject: Add clear-messages procedure. --- scenes/game.scm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/scenes/game.scm b/scenes/game.scm index ad49505..f6fb5f6 100644 --- a/scenes/game.scm +++ b/scenes/game.scm @@ -442,10 +442,6 @@ you. I'm sure we will meet again sooner than you expect." (unless (speaking? who) (let ((bubble (child-ref (parent (parent player)) 'text-bubble)) (messages (accepted-messages who))) - (for-each (lambda (node) - (when (string-prefix? "dialog" (symbol->string (name node))) - (detach node))) - (children bubble)) (for-each (lambda (message i) (match message ((message text) @@ -464,6 +460,7 @@ you. I'm sure we will meet again sooner than you expect." #:position (vec2 16.0 (- 40 (* 16.0 i)))))))) messages (iota (length messages)))))) + (clear-messages bubble) (define-method (talk (player ) (who ) message) (let ((bubble (child-ref (parent (parent player)) 'text-bubble))) @@ -476,16 +473,14 @@ you. I'm sure we will meet again sooner than you expect." (match (assoc-ref (conversations who) message) ((text next) (set! (speaking? who) #t) - (for-each (lambda (node) - (when (string-prefix? "dialog" (symbol->string (name node))) - (detach node))) - (children bubble)) ;; TODO: split text (attach bubble (make