*** empty log message ***

This commit is contained in:
David Rose 2001-02-06 01:02:38 +00:00
parent 8911e805e3
commit 3fce3f2f5e
6 changed files with 60 additions and 3 deletions

View File

@ -100,7 +100,15 @@ append_command_comment(EggData &data) {
EggData *EggMultiBase::
read_egg(const Filename &filename) {
EggData *data = new EggData;
if (!data->read(filename)) {
// First, we always try to resolve a filename from the current
// directory. This means a local filename will always be found
// before the model path is searched.
Filename local_filename = filename;
DSearchPath local_path(".");
local_filename.resolve_filename(local_path);
if (!data->read(local_filename)) {
// Failure reading.
delete data;
return (EggData *)NULL;

View File

@ -43,9 +43,17 @@ handle_args(ProgramBase::Args &args) {
// Any separate egg files that are listed on the command line will
// get implicitly loaded up into one big egg file.
DSearchPath local_path(".");
Args::const_iterator ai;
for (ai = args.begin(); ai != args.end(); ++ai) {
if (!_data.read(*ai)) {
Filename filename = *ai;
// First, we always try to resolve a filename from the current
// directory. This means a local filename will always be found
// before the model path is searched.
filename.resolve_filename(local_path);
if (!_data.read(filename)) {
// Rather than returning false, we simply exit here, so the
// ProgramBase won't try to tell the user how to run the program
// just because we got a bad egg file.

View File

@ -242,6 +242,42 @@ max_flt_version() {
return 15.2;
}
////////////////////////////////////////////////////////////////////
// Function: FltHeader::check_version
// Access: Public
// Description: Verifies that the version number read from the header
// is an understand version number, and prints a warning
// to the user if this is not so--the reading may or may
// not succeed. Returns true if the version number is
// acceptable (and no warning is printed), or false if
// it is questionable (and a warning is printed).
////////////////////////////////////////////////////////////////////
bool FltHeader::
check_version() const {
double version = get_flt_version();
if (version < min_flt_version()) {
nout << "Warning! The version number of this file appears to be "
<< version << ", which is older than " << min_flt_version()
<< ", the oldest OpenFlight version understood by this program. "
"It is unlikely that this program will be able to read the file "
"correctly.\n";
return false;
}
if (version > max_flt_version()) {
nout << "Warning! The version number of this file appears to be "
<< version << ", which is newer than " << max_flt_version()
<< ", the newest OpenFlight version understood by this program. "
"Chances are good that the program will still be able to read it "
"correctly, but any features in the file that are specific to "
"the latest version of OpenFlight will not be understood.\n";
return false;
}
return true;
}
////////////////////////////////////////////////////////////////////
// Function: FltHeader::has_instance
// Access: Public
@ -1111,7 +1147,7 @@ extract_record(FltRecordReader &reader) {
// Undocumented additional padding.
iterator.skip_bytes(4);
nassertr(iterator.get_remaining_size() == 0, true);
// nassertr(iterator.get_remaining_size() == 0, true);
return true;
}

View File

@ -125,6 +125,7 @@ public:
double get_flt_version() const;
static double min_flt_version();
static double max_flt_version();
bool check_version() const;
// Accessors into the instance pool.

View File

@ -49,6 +49,8 @@ main(int argc, char *argv[]) {
FltError result = header->read_flt(filename);
cerr << "Read result is " << result << "\n\n";
cerr << "Version is " << header->get_flt_version() << "\n";
header->check_version();
if (result == FE_ok) {
//header->write(cerr);

View File

@ -108,6 +108,8 @@ copy_flt_file(const Filename &source, const Filename &dest,
return false;
}
header->check_version();
// Now scan the flt file for nested references.
Refs refs;
Textures textures;