17 #include "fltHeader.h"
31 _preferred_extension =
".flt";
33 set_program_brief(
"apply various operations to a MultiGen .flt file");
34 set_program_description
35 (
"This program reads a MultiGen OpenFlight (.flt) file and writes an "
36 "essentially equivalent .flt file, to the file specified with -o (or "
37 "as the second parameter). Some simple operations may be performed.");
40 add_runline(
"[opts] input.flt output.flt");
41 add_runline(
"[opts] -o output.flt input.flt");
43 add_path_replace_options();
44 add_path_store_options();
48 "Upgrade (or downgrade) the flt file to the indicated version. This "
49 "may not be completely correct for all version-to-version combinations.",
50 &FltTrans::dispatch_double, &_got_new_version, &_new_version);
54 "Specify the filename to which the resulting .flt file will be written. "
55 "If this option is omitted, the last parameter name is taken to be the "
56 "name of the output file.",
57 &FltTrans::dispatch_filename, &_got_output_filename, &_output_filename);
68 if (_got_new_version) {
69 int new_version = (int)floor(_new_version * 100.0 + 0.5);
72 nout <<
"Cannot write flt files of version " << new_version / 100.0
73 <<
". This program only understands how to write flt files between version "
82 nout << "Reading " << _input_filename << "\n";
83 FltError result = header->read_flt(_input_filename);
84 if (result != FE_ok) {
85 nout <<
"Unable to read: " << result <<
"\n";
89 if (header->check_version()) {
90 nout <<
"Version is " << header->get_flt_version() / 100.0 <<
"\n";
93 if (_got_new_version) {
94 int new_version = (int)floor(_new_version * 100.0 + 0.5);
95 header->set_flt_version(new_version);
98 header->apply_converted_filenames();
101 if (result != FE_ok) {
102 nout <<
"Unable to write: " << result <<
"\n";
106 nout <<
"Successfully written.\n";
117 if (!check_last_arg(args, 1)) {
122 nout <<
"You must specify the .flt file to read on the command line.\n";
125 }
else if (args.size() != 1) {
126 nout <<
"You must specify only one .flt file to read on the command line.\n";
130 _input_filename = args[0];
136 int main(
int argc,
char *argv[]) {
A program to read a flt file and write an equivalent flt file, possibly performing some minor operati...
virtual void parse_command_line(int argc, char **argv)
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_...
This is the bare functionality (intended to be inherited from along with ProgramBase or some derivati...
ostream & get_output()
Returns an output stream that corresponds to the user's intended egg file output–either stdout...