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
21 06/30/2003 (RD) replaced istrstream with istringstream
22 to get rid of the annoying warning about
23 using the strstream header
25 ----------------------------------------------------------------------
27 AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
28 Michael Selig <m-selig@uiuc.edu>
30 ----------------------------------------------------------------------
34 ----------------------------------------------------------------------
38 ----------------------------------------------------------------------
42 ----------------------------------------------------------------------
44 CALLED BY: uiuc_menu()
46 ----------------------------------------------------------------------
48 CALLS TO: check_float() if needed
54 ----------------------------------------------------------------------
56 COPYRIGHT: (C) 2003 by Michael Selig
58 This program is free software; you can redistribute it and/or
59 modify it under the terms of the GNU General Public License
60 as published by the Free Software Foundation.
62 This program is distributed in the hope that it will be useful,
63 but WITHOUT ANY WARRANTY; without even the implied warranty of
64 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
65 GNU General Public License for more details.
67 You should have received a copy of the GNU General Public License
68 along with this program; if not, write to the Free Software
69 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
71 **********************************************************************/
73 #include <simgear/compiler.h>
75 #if defined( __MWERKS__ )
76 // -dw- optimizer chokes (big-time) trying to optimize humongous
77 // loop/switch statements
78 #pragma optimization_level 0
85 #include "uiuc_menu_fog.h"
95 void parse_fog( const string& linetoken2, const string& linetoken3,
96 const string& linetoken4, const string& linetoken5,
97 const string& linetoken6, const string& linetoken7,
98 const string& linetoken8, const string& linetoken9,
99 const string& linetoken10, const string& aircraft_directory,
100 LIST command_line ) {
102 int token_value_convert1;
103 istringstream token3(linetoken3.c_str());
104 istringstream token4(linetoken4.c_str());
105 istringstream token5(linetoken5.c_str());
106 istringstream token6(linetoken6.c_str());
107 istringstream token7(linetoken7.c_str());
108 istringstream token8(linetoken8.c_str());
109 istringstream token9(linetoken9.c_str());
110 istringstream token10(linetoken10.c_str());
112 switch(fog_map[linetoken2])
114 case fog_segments_flag:
116 if (check_float(linetoken3))
117 token3 >> token_value_convert1;
119 uiuc_warnings_errors(1, *command_line);
121 if (token_value_convert1 < 1 || token_value_convert1 > 100)
122 uiuc_warnings_errors(1, *command_line);
128 fog_segments = token_value_convert1;
129 fog_time = new double[fog_segments+1];
131 fog_value = new int[fog_segments+1];
138 if (check_float(linetoken3))
139 token3 >> token_value;
141 uiuc_warnings_errors(1, *command_line);
143 if (token_value < 0.1)
144 uiuc_warnings_errors(1, *command_line);
146 if (check_float(linetoken4))
147 token4 >> token_value_convert1;
149 uiuc_warnings_errors(1, *command_line);
151 if (token_value_convert1 < -1000 || token_value_convert1 > 1000)
152 uiuc_warnings_errors(1, *command_line);
154 if (fog_point_index == fog_segments || fog_point_index == -1)
155 uiuc_warnings_errors(1, *command_line);
158 fog_time[fog_point_index] = token_value;
159 fog_value[fog_point_index] = token_value_convert1;
165 if (ignore_unknown_keywords) {
168 // print error message
169 uiuc_warnings_errors(2, *command_line);