1 /**********************************************************************
3 FILENAME: uiuc_menu_gear.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_gear.h"
93 void parse_gear( 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 istrstream token3(linetoken3.c_str());
101 istrstream token4(linetoken4.c_str());
102 istrstream token5(linetoken5.c_str());
103 istrstream token6(linetoken6.c_str());
104 istrstream token7(linetoken7.c_str());
105 istrstream token8(linetoken8.c_str());
106 istrstream token9(linetoken9.c_str());
107 istrstream token10(linetoken10.c_str());
109 switch(gear_map[linetoken2])
115 if (index < 0 || index >= 16)
116 uiuc_warnings_errors(1, *command_line);
117 if (check_float(linetoken4))
118 token4 >> token_value;
120 uiuc_warnings_errors(1, *command_line);
121 D_gear_v[index][0] = token_value;
122 gear_model[index] = true;
129 if (index < 0 || index >= 16)
130 uiuc_warnings_errors(1, *command_line);
131 if (check_float(linetoken4))
132 token4 >> token_value;
134 uiuc_warnings_errors(1, *command_line);
135 D_gear_v[index][1] = token_value;
136 gear_model[index] = true;
143 if (index < 0 || index >= 16)
144 uiuc_warnings_errors(1, *command_line);
145 if (check_float(linetoken4))
146 token4 >> token_value;
148 uiuc_warnings_errors(1, *command_line);
149 D_gear_v[index][2] = token_value;
150 gear_model[index] = true;
157 if (index < 0 || index >= 16)
158 uiuc_warnings_errors(1, *command_line);
159 if (check_float(linetoken4))
160 token4 >> token_value;
162 uiuc_warnings_errors(1, *command_line);
163 cgear[index] = token_value;
164 gear_model[index] = true;
171 if (index < 0 || index >= 16)
172 uiuc_warnings_errors(1, *command_line);
173 if (check_float(linetoken4))
174 token4 >> token_value;
176 uiuc_warnings_errors(1, *command_line);
177 kgear[index] = token_value;
178 gear_model[index] = true;
185 if (index < 0 || index >= 16)
186 uiuc_warnings_errors(1, *command_line);
187 if (check_float(linetoken4))
188 token4 >> token_value;
190 uiuc_warnings_errors(1, *command_line);
191 muGear[index] = token_value;
192 gear_model[index] = true;
195 case strutLength_flag:
199 if (index < 0 || index >= 16)
200 uiuc_warnings_errors(1, *command_line);
201 if (check_float(linetoken4))
202 token4 >> token_value;
204 uiuc_warnings_errors(1, *command_line);
205 strutLength[index] = token_value;
206 gear_model[index] = true;
211 if (check_float(linetoken3))
212 token3 >> token_value;
214 uiuc_warnings_errors(1, *command_line);
217 gear_max = token_value;
222 if (check_float(linetoken3))
223 token3 >> token_value;
225 uiuc_warnings_errors(1, *command_line);
228 gear_rate = token_value;
233 if (ignore_unknown_keywords) {
236 // print error message
237 uiuc_warnings_errors(2, *command_line);