Patches from Tony Peden to separate property XML I/O operations into a
separate header file. This change will help integrate properties into JSBSim. Also, I (David Megginson) removed most of the SimGear include statements from globals.hxx, reducing the amount of recompilation every time SimGear changes. This required making minor changes to a lot of files that were depending on the side-effects of the inclusions in globals.hxx.
This commit is contained in:
parent
96a4e9abc3
commit
d0eaafb1e1
25 changed files with 66 additions and 78 deletions
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <simgear/route/route.hxx>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/math/sg_geodesy.hxx>
|
||||
#include <simgear/math/sg_random.h>
|
||||
#include <simgear/route/route.hxx>
|
||||
|
||||
#include <Cockpit/steam.hxx>
|
||||
#include <Cockpit/radiostack.hxx>
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/math/polar3d.hxx>
|
||||
#include <simgear/misc/props.hxx>
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include <Aircraft/aircraft.hxx>
|
||||
#include <Include/general.hxx>
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <simgear/constants.h>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/misc/props.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
//#include <simgear/math/fg_random.h>
|
||||
//#include <simgear/math/polar3d.hxx>
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ FGInterface::unbind ()
|
|||
void
|
||||
FGInterface::update (int dt)
|
||||
{
|
||||
cout << "dummy update() ... SHOULDN'T BE CALLED!" << endl;
|
||||
SG_LOG(SG_FLIGHT, SG_ALERT, "dummy update() ... SHOULDN'T BE CALLED!");
|
||||
}
|
||||
|
||||
|
||||
|
@ -525,7 +525,7 @@ void FGInterface::extrapolate( int time_offset ) {
|
|||
// -dw- metrowerks complains about ambiguous access, not critical
|
||||
// to keep this ;)
|
||||
#ifndef __MWERKS__
|
||||
cout << "extrapolating FDM by dt = " << dt << endl;
|
||||
SG_LOG(SG_FLIGHT, SG_INFO, "extrapolating FDM by dt = " << dt);
|
||||
#endif
|
||||
|
||||
double lat = geodetic_position_v[0] + geocentric_rates_v[0] * dt;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <Main/globals.hxx>
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/misc/props.hxx>
|
||||
|
||||
#define DOTDOTSLASH "../"
|
||||
#define SLASH "/"
|
||||
|
|
|
@ -90,7 +90,7 @@ static FGProtocol *parse_port_config( const string& config )
|
|||
FGATC610x *atc610x = new FGATC610x;
|
||||
io = atc610x;
|
||||
short_circuit = true;
|
||||
cout << "here ..." << endl;
|
||||
std::cout << "here ..." << endl;
|
||||
} else if ( protocol == "atlas" ) {
|
||||
FGAtlas *atlas = new FGAtlas;
|
||||
io = atlas;
|
||||
|
@ -299,7 +299,7 @@ void fgIOProcess() {
|
|||
p->dec_count_down( interval );
|
||||
while ( p->get_count_down() < 0 ) {
|
||||
p->process();
|
||||
p->dec_count_down( -1000000.0 / p->get_hz() );
|
||||
p->dec_count_down(int( -1000000.0 / p->get_hz()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#endif
|
||||
|
||||
#include <simgear/misc/exception.hxx>
|
||||
#include <simgear/magvar/magvar.hxx>
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include STL_IOSTREAM
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/misc/props.hxx>
|
||||
#include <simgear/misc/props_io.hxx>
|
||||
|
||||
#include "globals.hxx"
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include <simgear/misc/commands.hxx>
|
||||
|
||||
#include <Environment/environment_mgr.hxx>
|
||||
|
||||
#include "globals.hxx"
|
||||
|
|
|
@ -29,14 +29,6 @@
|
|||
#include <vector>
|
||||
#include STL_STRING
|
||||
|
||||
|
||||
#include <simgear/ephemeris/ephemeris.hxx>
|
||||
#include <simgear/magvar/magvar.hxx>
|
||||
#include <simgear/route/route.hxx>
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
#include <simgear/misc/commands.hxx>
|
||||
#include <simgear/misc/props.hxx>
|
||||
|
||||
#include "viewmgr.hxx"
|
||||
|
||||
SG_USING_STD( vector );
|
||||
|
@ -46,6 +38,22 @@ typedef vector<string> string_list;
|
|||
|
||||
|
||||
// Forward declarations
|
||||
|
||||
// This file is included, directly or indirectly, almost everywhere in
|
||||
// FlightGear, so if any of its dependencies changes, most of the sim
|
||||
// has to be recompiled. Using these forward declarations helps us to
|
||||
// avoid including a lot of header files (and thus, a lot of
|
||||
// dependencies). Since Most of the methods simply set or return
|
||||
// pointers, we don't need to know anything about the class details
|
||||
// anyway.
|
||||
|
||||
class SGEphemeris;
|
||||
class SGMagVar;
|
||||
class SGRoute;
|
||||
class SGTime;
|
||||
class SGPropertyNode;
|
||||
class SGCommandMgr;
|
||||
|
||||
class FGLogger;
|
||||
class FGEnvironmentMgr;
|
||||
class FGEnvironment;
|
||||
|
@ -57,7 +65,12 @@ class FGViewer;
|
|||
class FGATCMgr;
|
||||
class FGATCDisplay;
|
||||
|
||||
class FGGlobals {
|
||||
|
||||
/**
|
||||
* Bucket for subsystem pointers representing the sim's state.
|
||||
*/
|
||||
class FGGlobals
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/misc/exception.hxx>
|
||||
#include <simgear/ephemeris/ephemeris.hxx>
|
||||
#include <simgear/route/route.hxx>
|
||||
|
||||
#ifdef SG_MATH_EXCEPTION_CLASH
|
||||
# include <math.h>
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
#include STL_STRING
|
||||
|
||||
#include <simgear/misc/sgstream.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/route/route.hxx>
|
||||
#include <simgear/route/waypoint.hxx>
|
||||
|
||||
// #include <Include/general.hxx>
|
||||
// #include <Airports/simple.hxx>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/math/sg_geodesy.hxx>
|
||||
#include <simgear/io/iochannel.hxx>
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include <FDM/flight.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
|
@ -144,7 +145,7 @@ bool FGGarmin::gen_message() {
|
|||
garmin_sentence += rmz_sum;
|
||||
garmin_sentence += "\n";
|
||||
|
||||
cout << garmin_sentence;
|
||||
std::cout << garmin_sentence;
|
||||
|
||||
length = garmin_sentence.length();
|
||||
strncpy( buf, garmin_sentence.c_str(), length );
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/io/lowlevel.hxx> // endian tests
|
||||
#include <simgear/io/iochannel.hxx>
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include <FDM/flight.hxx>
|
||||
#include <Time/tmp.hxx>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/math/sg_geodesy.hxx>
|
||||
#include <simgear/io/iochannel.hxx>
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include <FDM/flight.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
|
@ -144,7 +145,7 @@ bool FGNMEA::gen_message() {
|
|||
nmea_sentence += gga_sum;
|
||||
nmea_sentence += "\n";
|
||||
|
||||
cout << nmea_sentence;
|
||||
std::cout << nmea_sentence;
|
||||
|
||||
length = nmea_sentence.length();
|
||||
strncpy( buf, nmea_sentence.c_str(), length );
|
||||
|
|
|
@ -21,13 +21,15 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/io/iochannel.hxx>
|
||||
#include <simgear/math/sg_types.hxx>
|
||||
#include <simgear/misc/props.hxx>
|
||||
#include <simgear/misc/props_io.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
|
||||
#include <stdlib.h> // atoi() atof()
|
||||
|
||||
|
@ -38,6 +40,7 @@
|
|||
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(istrstream);
|
||||
SG_USING_STD(strstream);
|
||||
#endif
|
||||
|
||||
FGProps::FGProps() {
|
||||
|
|
|
@ -63,6 +63,8 @@ extern "C" {
|
|||
#include <plib/sg.h>
|
||||
#include <plib/ssg.h>
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ bool FGMaterialLib::load( const string& mpath ) {
|
|||
|
||||
SGPropertyNode materials;
|
||||
|
||||
cout << "Reading materials from " << mpath << endl;
|
||||
SG_LOG(SG_INPUT, SG_INFO, "Reading materials from " << mpath);
|
||||
try {
|
||||
readProperties(mpath, &materials);
|
||||
} catch (const sg_exception &ex) {
|
||||
|
|
|
@ -478,10 +478,8 @@ ssgBranch *fgAsciiObjLoad( const string& path, FGTileEntry *t,
|
|||
string file = path;
|
||||
int pos = file.rfind( "/" );
|
||||
file = file.substr( 0, pos );
|
||||
cout << "current file = " << file << endl;
|
||||
file += "/";
|
||||
file += material;
|
||||
cout << "current file = " << file << endl;
|
||||
if ( ! material_lib.add_item( file ) ) {
|
||||
SG_LOG( SG_TERRAIN, SG_ALERT,
|
||||
"Ack! unknown usemtl name = " << material
|
||||
|
@ -504,8 +502,6 @@ ssgBranch *fgAsciiObjLoad( const string& path, FGTileEntry *t,
|
|||
tex_height = newmat->get_ysize();
|
||||
state = newmat->get_state();
|
||||
coverage = newmat->get_light_coverage();
|
||||
// cout << "(w) = " << tex_width << " (h) = "
|
||||
// << tex_width << endl;
|
||||
} else {
|
||||
coverage = -1;
|
||||
}
|
||||
|
@ -520,8 +516,6 @@ ssgBranch *fgAsciiObjLoad( const string& path, FGTileEntry *t,
|
|||
|
||||
in >> token;
|
||||
|
||||
// cout << "token = " << token << endl;
|
||||
|
||||
if ( token == "vn" ) {
|
||||
// vertex normal
|
||||
if ( vncount < FG_MAX_NODES ) {
|
||||
|
@ -634,10 +628,6 @@ ssgBranch *fgAsciiObjLoad( const string& path, FGTileEntry *t,
|
|||
|
||||
in >> n3;
|
||||
fan_vertices.push_back( n3 );
|
||||
// cout << " triangle = "
|
||||
// << n1 << "," << n2 << "," << n3
|
||||
// << endl;
|
||||
// xglNormal3dv(normals[n3]);
|
||||
if ( in.get( c ) && c == '/' ) {
|
||||
in >> tex;
|
||||
fan_tex_coords.push_back( tex );
|
||||
|
@ -767,10 +757,8 @@ ssgLeaf *gen_leaf( const string& path,
|
|||
string file = path;
|
||||
int pos = file.rfind( "/" );
|
||||
file = file.substr( 0, pos );
|
||||
cout << "current file = " << file << endl;
|
||||
file += "/";
|
||||
file += material;
|
||||
cout << "current file = " << file << endl;
|
||||
if ( ! material_lib.add_item( file ) ) {
|
||||
SG_LOG( SG_TERRAIN, SG_ALERT,
|
||||
"Ack! unknown usemtl name = " << material
|
||||
|
@ -793,19 +781,10 @@ ssgLeaf *gen_leaf( const string& path,
|
|||
tex_height = newmat->get_ysize();
|
||||
state = newmat->get_state();
|
||||
coverage = newmat->get_light_coverage();
|
||||
// cout << "(w) = " << tex_width << " (h) = "
|
||||
// << tex_width << endl;
|
||||
} else {
|
||||
coverage = -1;
|
||||
}
|
||||
|
||||
// cout << "before list allocs" << endl;
|
||||
|
||||
// cout << "before vl, size = " << size << endl;
|
||||
// cout << "before nl" << endl;
|
||||
// cout << "before tl" << endl;
|
||||
// cout << "before cl" << endl;
|
||||
|
||||
sgVec2 tmp2;
|
||||
sgVec3 tmp3;
|
||||
sgVec4 tmp4;
|
||||
|
@ -879,14 +858,9 @@ ssgLeaf *gen_leaf( const string& path,
|
|||
}
|
||||
}
|
||||
|
||||
// cout << "before leaf create" << endl;
|
||||
ssgLeaf *leaf = new ssgVtxTable ( ty, vl, nl, tl, cl );
|
||||
// cout << "after leaf create" << endl;
|
||||
|
||||
// lookup the state record
|
||||
// cout << "looking up material = " << endl;
|
||||
// cout << material << endl;
|
||||
// cout << "'" << endl;
|
||||
|
||||
leaf->setState( state );
|
||||
|
||||
|
@ -919,9 +893,6 @@ bool fgBinObjLoad( const string& path, const bool is_base,
|
|||
return false;
|
||||
}
|
||||
|
||||
// cout << "fans size = " << obj.get_fans_v().size()
|
||||
// << " fan_mats size = " << obj.get_fan_materials().size() << endl;
|
||||
|
||||
geometry->setName( (char *)path.c_str() );
|
||||
|
||||
if ( is_base ) {
|
||||
|
@ -948,7 +919,6 @@ bool fgBinObjLoad( const string& path, const bool is_base,
|
|||
group_list pts_v = obj.get_pts_v();
|
||||
group_list pts_n = obj.get_pts_n();
|
||||
for ( i = 0; i < (int)pts_v.size(); ++i ) {
|
||||
cout << "pts_v.size() = " << pts_v.size() << endl;
|
||||
tmp_mat = pt_materials[i];
|
||||
if ( tmp_mat.substr(0, 3) == "RWY" ) {
|
||||
material = "LIGHTS";
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include "FGTileLoader.hxx"
|
||||
#include "tileentry.hxx"
|
||||
|
|
|
@ -292,7 +292,6 @@ int FGTileMgr::update( double lon, double lat ) {
|
|||
// happen in the render thread because model loading can trigger
|
||||
// texture loading which involves use of the opengl api.
|
||||
if ( !model_queue.empty() ) {
|
||||
cout << "loading next model ..." << endl;
|
||||
// load the next tile in the queue
|
||||
#ifdef ENABLE_THREADS
|
||||
FGDeferredModel* dm = model_queue.pop();
|
||||
|
@ -312,8 +311,6 @@ int FGTileMgr::update( double lon, double lat ) {
|
|||
delete dm;
|
||||
}
|
||||
|
||||
// cout << "current elevation (ssg) == " << scenery.get_cur_elev() << endl;
|
||||
|
||||
previous_bucket = current_bucket;
|
||||
last_longitude = longitude;
|
||||
last_latitude = latitude;
|
||||
|
@ -337,7 +334,6 @@ int FGTileMgr::update( double lon, double lat ) {
|
|||
e->add_ssg_nodes( terrain_branch,
|
||||
gnd_lights_branch,
|
||||
rwy_lights_branch );
|
||||
// cout << "Adding ssg nodes for "
|
||||
}
|
||||
|
||||
sgdVec3 sc;
|
||||
|
@ -349,7 +345,6 @@ int FGTileMgr::update( double lon, double lat ) {
|
|||
#if 0
|
||||
if ( scenery.center == Point3D(0.0) ) {
|
||||
// initializing
|
||||
cout << "initializing scenery current elevation ... " << endl;
|
||||
sgdVec3 tmp_abs_view_pos;
|
||||
|
||||
Point3D geod_pos = Point3D( longitude * SGD_DEGREES_TO_RADIANS,
|
||||
|
@ -359,7 +354,6 @@ int FGTileMgr::update( double lon, double lat ) {
|
|||
scenery.center = tmp;
|
||||
sgdSetVec3( tmp_abs_view_pos, tmp.x(), tmp.y(), tmp.z() );
|
||||
|
||||
// cout << "abs_view_pos = " << tmp_abs_view_pos << endl;
|
||||
prep_ssg_nodes();
|
||||
|
||||
double tmp_elev;
|
||||
|
@ -370,24 +364,8 @@ int FGTileMgr::update( double lon, double lat ) {
|
|||
} else {
|
||||
scenery.set_cur_elev( 0.0 );
|
||||
}
|
||||
cout << "result = " << scenery.get_cur_elev() << endl;
|
||||
} else {
|
||||
#endif
|
||||
/*
|
||||
cout << "abs view pos = "
|
||||
<< globals->get_current_view()->get_abs_view_pos()[0] << ","
|
||||
<< globals->get_current_view()->get_abs_view_pos()[1] << ","
|
||||
<< globals->get_current_view()->get_abs_view_pos()[2]
|
||||
<< " view pos = "
|
||||
<< globals->get_current_view()->get_view_pos()[0] << ","
|
||||
<< globals->get_current_view()->get_view_pos()[1] << ","
|
||||
<< globals->get_current_view()->get_view_pos()[2]
|
||||
<< endl;
|
||||
cout << "current_tile = " << current_tile << endl;
|
||||
cout << "Scenery center = " << sc[0] << "," << sc[1] << "," << sc[2]
|
||||
<< endl;
|
||||
*/
|
||||
|
||||
// overridden with actual values if a terrain intersection is
|
||||
// found
|
||||
double hit_elev = -9999.0;
|
||||
|
@ -415,8 +393,6 @@ int FGTileMgr::update( double lon, double lat ) {
|
|||
scenery.set_cur_radius( 0.0 );
|
||||
scenery.set_cur_normal( hit_normal );
|
||||
}
|
||||
|
||||
// cout << "Current elevation = " << scenery.get_cur_elev() << endl;
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
|
@ -437,11 +413,10 @@ void FGTileMgr::prep_ssg_nodes() {
|
|||
tile_cache.reset_traversal();
|
||||
|
||||
while ( ! tile_cache.at_end() ) {
|
||||
// cout << "processing a tile" << endl;
|
||||
if ( (e = tile_cache.get_current()) ) {
|
||||
e->prep_ssg_node( scenery.get_center(), vis);
|
||||
} else {
|
||||
cout << "warning ... empty tile in cache" << endl;
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "warning ... empty tile in cache");
|
||||
}
|
||||
tile_cache.next();
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include <simgear/math/polar3d.hxx>
|
||||
#include <simgear/math/sg_geodesy.hxx>
|
||||
#include <simgear/math/vector.hxx>
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/viewer.hxx>
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include <simgear/math/polar3d.hxx>
|
||||
#include <simgear/math/sg_geodesy.hxx>
|
||||
#include <simgear/math/vector.hxx>
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/viewer.hxx>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/magvar/magvar.hxx>
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include <FDM/flight.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
|
@ -48,11 +49,11 @@ void fgUpdateLocalTime() {
|
|||
SGPath zone( globals->get_fg_root() );
|
||||
zone.append( "Timezone" );
|
||||
|
||||
cout << "updateLocal("
|
||||
<< longitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS
|
||||
<< ", "
|
||||
<< latitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS
|
||||
<< ", " << zone.str() << ")" << endl;
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "updateLocal("
|
||||
<< longitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS
|
||||
<< ", "
|
||||
<< latitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS
|
||||
<< ", " << zone.str() << ")");
|
||||
globals->get_time_params()->updateLocal( longitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
latitude->getDoubleValue()
|
||||
|
|
Loading…
Add table
Reference in a new issue