From 821c3bd31cc79b517732bdaa62cb392654fabdb8 Mon Sep 17 00:00:00 2001 From: mfranz Date: Mon, 15 Dec 2008 16:16:08 +0000 Subject: [PATCH] rain: read some properties only if they are actually needed --- Nasal/aircraft.nas | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Nasal/aircraft.nas b/Nasal/aircraft.nas index d09c02956..24f159b1f 100644 --- a/Nasal/aircraft.nas +++ b/Nasal/aircraft.nas @@ -872,14 +872,15 @@ var rain = { setlistener("sim/current-view/internal", func(n) me.internal = n.getValue(), 1); }, update: func { - var ias = me.iasN.getValue(); var altitude = me.altitudeN.getValue(); var precip_level = me.precip_levelN.getValue(); - var elapsed = me.elapsed_timeN.getValue(); - var dt = me.dtN.getValue(); if (me.enabled and me.internal and altitude < precip_level and me.canopy < 0.001) { - me.flowN.setDoubleValue(ias < me.threshold ? 0 : elapsed * 0.5 + ias * NM2M * dt / 3600); + var time = me.elapsed_timeN.getValue(); + var ias = me.iasN.getValue(); + var dt = me.dtN.getValue(); + + me.flowN.setDoubleValue(ias < me.threshold ? 0 : time * 0.5 + ias * NM2M * dt / 3600); me.rainingN.setDoubleValue(me.rain); me.enableN.setBoolValue(0); } else {