]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_fog.cpp
Updated to match changes in radiostack.[ch]xx
[flightgear.git] / src / FDM / UIUCModel / uiuc_fog.cpp
1 /**********************************************************************
2
3  FILENAME:     uiuc_fog.cpp
4
5 ----------------------------------------------------------------------
6
7  DESCRIPTION:  changes Fog variable to +/-1 or 0 using fog 
8                parameters and Simtime
9
10 ----------------------------------------------------------------------
11
12  STATUS:       alpha version
13
14 ----------------------------------------------------------------------
15
16  REFERENCES:   
17
18 ----------------------------------------------------------------------
19
20  HISTORY:      05/20/2001   initial release
21
22 ----------------------------------------------------------------------
23
24  AUTHOR(S):    Michael Savchenko         <savchenk@uiuc.edu>
25
26 ----------------------------------------------------------------------
27
28  VARIABLES:
29
30 ----------------------------------------------------------------------
31
32  INPUTS:        -Simtime
33                 -Fog
34                 -fog_field
35                 -fog_next_time
36                 -fog_current_segment
37                 -fog_value
38                 -fog_time
39                
40 ----------------------------------------------------------------------
41
42  OUTPUTS:       -Fog
43                 -fog_field
44                 -fog_next_time
45                 -fog_current_segment
46  
47 ----------------------------------------------------------------------
48
49  CALLED BY:    uiuc_wrapper
50
51 ----------------------------------------------------------------------
52
53  CALLS TO:     none
54
55 ----------------------------------------------------------------------
56
57  COPYRIGHT:    (C) 2000 by Michael Selig
58
59  This program is free software; you can redistribute it and/or
60  modify it under the terms of the GNU General Public License
61  as published by the Free Software Foundation.
62
63  This program is distributed in the hope that it will be useful,
64  but WITHOUT ANY WARRANTY; without even the implied warranty of
65  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
66  GNU General Public License for more details.
67
68  You should have received a copy of the GNU General Public License
69  along with this program; if not, write to the Free Software
70  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
71  USA or view http://www.gnu.org/copyleft/gpl.html.
72
73 **********************************************************************/
74
75
76 #include "uiuc_fog.h"
77
78 void uiuc_fog()
79 {
80   if (Simtime >= fog_next_time)
81   {
82     if (fog_current_segment != 0)
83     {
84       if (fog_value[fog_current_segment] > fog_value[fog_current_segment-1])
85         Fog = 1;
86       else if (fog_value[fog_current_segment] < fog_value[fog_current_segment-1])
87         Fog = -1;
88       else
89         Fog = 0;
90     }
91     else
92       Fog = 0;
93
94     if (Simtime > fog_time[fog_current_segment]) {
95       if (fog_current_segment == fog_segments)
96       {
97         fog_field = false;
98         Fog = 0;
99         return;
100       }
101       else
102         fog_current_segment++;                  }
103
104     if (fog_value[fog_current_segment] == fog_value[fog_current_segment-1])
105       fog_next_time = fog_time[fog_current_segment];
106     else
107       fog_next_time += (fog_time[fog_current_segment]-fog_time[fog_current_segment-1]) / abs(fog_value[fog_current_segment]-fog_value[fog_current_segment-1]);
108   }
109   else
110     Fog = 0;
111   
112   return;
113 }
114