1 /**********************************************************************
3 FILENAME: uiuc_menu_fog.cpp
5 ----------------------------------------------------------------------
7 DESCRIPTION: reads input data for specified aircraft and creates
8 approporiate data storage space
10 ----------------------------------------------------------------------
14 ----------------------------------------------------------------------
16 REFERENCES: based on "menu reader" format of Michael Selig
18 ----------------------------------------------------------------------
20 HISTORY: 04/04/2003 initial release
22 ----------------------------------------------------------------------
24 AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
25 Michael Selig <m-selig@uiuc.edu>
27 ----------------------------------------------------------------------
31 ----------------------------------------------------------------------
35 ----------------------------------------------------------------------
39 ----------------------------------------------------------------------
41 CALLED BY: uiuc_menu()
43 ----------------------------------------------------------------------
45 CALLS TO: check_float() if needed
51 ----------------------------------------------------------------------
53 COPYRIGHT: (C) 2003 by Michael Selig
55 This program is free software; you can redistribute it and/or
56 modify it under the terms of the GNU General Public License
57 as published by the Free Software Foundation.
59 This program is distributed in the hope that it will be useful,
60 but WITHOUT ANY WARRANTY; without even the implied warranty of
61 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
62 GNU General Public License for more details.
64 You should have received a copy of the GNU General Public License
65 along with this program; if not, write to the Free Software
66 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
67 USA or view http://www.gnu.org/copyleft/gpl.html.
69 **********************************************************************/
71 #include <simgear/compiler.h>
73 #if defined( __MWERKS__ )
74 // -dw- optimizer chokes (big-time) trying to optimize humongous
75 // loop/switch statements
76 #pragma optimization_level 0
83 #include "uiuc_menu_fog.h"
93 void parse_fog( const string& linetoken2, const string& linetoken3,
94 const string& linetoken4, const string& linetoken5,
95 const string& linetoken6, const string& linetoken7,
96 const string& linetoken8, const string& linetoken9,
97 const string& linetoken10, const string& aircraft_directory,
100 int token_value_convert1;
101 istrstream token3(linetoken3.c_str());
102 istrstream token4(linetoken4.c_str());
103 istrstream token5(linetoken5.c_str());
104 istrstream token6(linetoken6.c_str());
105 istrstream token7(linetoken7.c_str());
106 istrstream token8(linetoken8.c_str());
107 istrstream token9(linetoken9.c_str());
108 istrstream token10(linetoken10.c_str());
110 switch(fog_map[linetoken2])
112 case fog_segments_flag:
114 if (check_float(linetoken3))
115 token3 >> token_value_convert1;
117 uiuc_warnings_errors(1, *command_line);
119 if (token_value_convert1 < 1 || token_value_convert1 > 100)
120 uiuc_warnings_errors(1, *command_line);
126 fog_segments = token_value_convert1;
127 fog_time = new double[fog_segments+1];
129 fog_value = new int[fog_segments+1];
136 if (check_float(linetoken3))
137 token3 >> token_value;
139 uiuc_warnings_errors(1, *command_line);
141 if (token_value < 0.1)
142 uiuc_warnings_errors(1, *command_line);
144 if (check_float(linetoken4))
145 token4 >> token_value_convert1;
147 uiuc_warnings_errors(1, *command_line);
149 if (token_value_convert1 < -1000 || token_value_convert1 > 1000)
150 uiuc_warnings_errors(1, *command_line);
152 if (fog_point_index == fog_segments || fog_point_index == -1)
153 uiuc_warnings_errors(1, *command_line);
156 fog_time[fog_point_index] = token_value;
157 fog_value[fog_point_index] = token_value_convert1;
163 if (ignore_unknown_keywords) {
166 // print error message
167 uiuc_warnings_errors(2, *command_line);