From 610762c1eeeef9e8a5b1abc78110225eae323fa0 Mon Sep 17 00:00:00 2001 From: Dave Griffiths Date: Wed, 12 Aug 2009 14:33:44 +0100 Subject: [PATCH] networking appears to work now --- plant-eyes/view.ss | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/plant-eyes/view.ss b/plant-eyes/view.ss index 0324a93..afbe42b 100644 --- a/plant-eyes/view.ss +++ b/plant-eyes/view.ss @@ -362,7 +362,7 @@ (pos (vector 0 0 0)) (size 0) (col (vector 1 1 1)) - (tex "ooo")) + (tex "")) (field (twigs '()) ; a assoc list map between ids and twigs stored flat here, @@ -467,16 +467,19 @@ (set! twigs (cons (list (send twig get-id) twig) twigs)))) (define/public (add-twig-point twig-id point width) - (send (get-twig twig-id) add-point point width)) + (when (get-twig twig-id) + (send (get-twig twig-id) add-point point width))) (define/public (start-twig-growing twig-id) - (send (get-twig twig-id) start-growing)) + (when (get-twig twig-id) + (send (get-twig twig-id) start-growing))) (define/public (grow-seed amount) (with-primitive seed (scale amount))) (define/public (add-ornament twig-id point-index property) - (send (get-twig twig-id) add-ornament point-index property)) + (when (get-twig twig-id) + (send (get-twig twig-id) add-ornament point-index property))) (define/public (update-nutrients t d) (when (not (null? twigs)) @@ -659,10 +662,12 @@ (send (get-plant plant-id) destroy-branch-twig twig-id)) (define/public (add-twig plant-id parent-twig-id point-index twig) - (send (get-plant plant-id) add-twig parent-twig-id point-index twig)) + (when (get-plant plant-id) + (send (get-plant plant-id) add-twig parent-twig-id point-index twig))) (define/public (grow-seed plant-id amount) - (send (get-plant plant-id) grow-seed amount)) + (when (get-plant plant-id) + (send (get-plant plant-id) grow-seed amount))) (define/public (get-pickup pickup-id) (cadr (assq pickup-id pickups))) @@ -675,7 +680,8 @@ (set! pickups (assoc-remove pickup-id pickups))) (define/public (add-ornament plant-id twig-id point-index property) - (send (get-plant plant-id) add-ornament twig-id point-index property)) + (when (get-plant plant-id) + (send (get-plant plant-id) add-ornament twig-id point-index property))) (define/public (update t d messages)