1
0
Fork 0

Updates to JSBsim from Jon's CVS.

Massaging some names inside of SimGear.
This commit is contained in:
curt 2000-07-06 22:13:24 +00:00
parent 9d47a64a09
commit 0ffa19cd32
28 changed files with 97 additions and 80 deletions

View file

@ -101,7 +101,7 @@ char*
get_formated_gmt_time( void )
{
static char buf[32];
FGTime *t = FGTime::cur_time_params;
SGTime *t = SGTime::cur_time_params;
const struct tm *p = t->getGmt();
sprintf( buf, "%d/%d/%4d %d:%02d:%02d",
p->tm_mon+1, p->tm_mday, 1900 + p->tm_year,

View file

@ -29,7 +29,7 @@
#include <map>
#include <simgear/debug/logstream.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Main/bfi.hxx>
@ -63,7 +63,7 @@ FG_USING_STD(map);
static char * panelGetTime ()
{
static char buf[1024]; // FIXME: not thread-safe
struct tm * t = FGTime::cur_time_params->getGmt();
struct tm * t = SGTime::cur_time_params->getGmt();
sprintf(buf, " %.2d:%.2d:%.2d",
t->tm_hour, t->tm_min, t->tm_sec);
return buf;

View file

@ -55,7 +55,6 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgpath.hxx>
#include <simgear/screen/screen-dump.hxx>
#include <simgear/timing/fg_time.hxx>
#include <Include/general.hxx>
#include <Aircraft/aircraft.hxx>

View file

@ -36,7 +36,7 @@
#include <simgear/ephemeris/ephemeris.hxx>
#include <simgear/math/fg_types.hxx>
#include <simgear/misc/props.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Aircraft/aircraft.hxx>
#include <FDM/UIUCModel/uiuc_aircraftdir.h>
@ -377,7 +377,7 @@ FGBFI::setAircraftDir (const string &dir)
time_t
FGBFI::getTimeGMT ()
{
return FGTime::cur_time_params->get_cur_time();
return SGTime::cur_time_params->get_cur_time();
}
@ -391,12 +391,12 @@ FGBFI::setTimeGMT (time_t time)
// and solar system
current_options.set_time_offset(time);
current_options.set_time_offset_type(SG_TIME_GMT_ABSOLUTE);
FGTime::cur_time_params->init( cur_fdm_state->get_Longitude(),
SGTime::cur_time_params->init( cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Latitude(),
current_options.get_fg_root(),
current_options.get_time_offset(),
current_options.get_time_offset_type() );
FGTime::cur_time_params->update( cur_fdm_state->get_Longitude(),
SGTime::cur_time_params->update( cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Latitude(),
cur_fdm_state->get_Altitude()
* FEET_TO_METER );

View file

@ -54,7 +54,7 @@
#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/misc/fgpath.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Aircraft/aircraft.hxx>
#include <Airports/simple.hxx>
@ -245,7 +245,7 @@ bool fgInitGeneral( void ) {
// Returns non-zero if a problem encountered.
bool fgInitSubsystems( void ) {
fgLIGHT *l = &cur_light_params;
FGTime *t = FGTime::cur_time_params;
SGTime *t = SGTime::cur_time_params;
FG_LOG( FG_GENERAL, FG_INFO, "Initialize Subsystems");
FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
@ -454,7 +454,7 @@ bool fgInitSubsystems( void ) {
current_aircraft.fdm_state->get_Longitude(),
current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER );
FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
new FGLocalWeatherDatabase( position );
new FGLocalWeatherDatabase( position, current_options.get_fg_root() );
// cout << theFGLocalWeatherDatabase << endl;
// cout << "visibility = "
// << theFGLocalWeatherDatabase->getWeatherVisibility() << endl;

View file

@ -48,7 +48,7 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgpath.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Aircraft/aircraft.hxx>
#include <Autopilot/auto_gui.hxx>
@ -76,14 +76,14 @@
// Handle keyboard events
void GLUTkey(unsigned char k, int x, int y) {
FGInterface *f;
FGTime *t;
SGTime *t;
FGView *v;
float fov, tmp;
static bool winding_ccw = true;
int speed;
f = current_aircraft.fdm_state;
t = FGTime::cur_time_params;
t = SGTime::cur_time_params;
v = &current_view;
FG_LOG( FG_INPUT, FG_DEBUG, "Key hit = " << k );

View file

@ -72,7 +72,7 @@
#include <simgear/math/fg_random.h>
#include <simgear/misc/fgpath.hxx>
#include <simgear/sky/sky.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Include/general.hxx>
@ -276,7 +276,7 @@ void fgRenderFrame( void ) {
FGBFI::update();
fgLIGHT *l = &cur_light_params;
FGTime *t = FGTime::cur_time_params;
SGTime *t = SGTime::cur_time_params;
// FGView *v = &current_view;
static double last_visibility = -9999;
@ -428,7 +428,7 @@ void fgRenderFrame( void ) {
<< " lon = " << cur_fdm_state->get_Longitude()
<< " lat = " << cur_fdm_state->get_Latitude() << endl;
cout << " sun_rot = " << cur_light_params.sun_rotation
<< " gst = " << FGTime::cur_time_params->getGst() << endl;
<< " gst = " << SGTime::cur_time_params->getGst() << endl;
cout << " sun ra = " << ephem->getSunRightAscension()
<< " sun dec = " << ephem->getSunDeclination()
<< " moon ra = " << ephem->getMoonRightAscension()
@ -440,7 +440,7 @@ void fgRenderFrame( void ) {
cur_fdm_state->get_Latitude(),
cur_fdm_state->get_Altitude() * FEET_TO_METER,
cur_light_params.sun_rotation,
FGTime::cur_time_params->getGst(),
SGTime::cur_time_params->getGst(),
ephem->getSunRightAscension(),
ephem->getSunDeclination(), 50000.0,
ephem->getMoonRightAscension(),
@ -607,7 +607,7 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
static fdm_state_list fdm_list;
// FGInterface fdm_state;
fgLIGHT *l = &cur_light_params;
FGTime *t = FGTime::cur_time_params;
SGTime *t = SGTime::cur_time_params;
// FGView *v = &current_view;
int i;
@ -722,7 +722,7 @@ static const double alt_adjust_m = alt_adjust_ft * FEET_TO_METER;
// What should we do when we have nothing else to do? Let's get ready
// for the next move and update the display?
static void fgMainLoop( void ) {
FGTime *t;
SGTime *t;
static long remainder = 0;
long elapsed;
#ifdef FANCY_FRAME_COUNTER
@ -733,7 +733,7 @@ static void fgMainLoop( void ) {
static int frames = 0;
#endif // FANCY_FRAME_COUNTER
t = FGTime::cur_time_params;
t = SGTime::cur_time_params;
FG_LOG( FG_ALL, FG_DEBUG, "Running Main Loop");
FG_LOG( FG_ALL, FG_DEBUG, "======= ==== ====");
@ -808,7 +808,7 @@ static void fgMainLoop( void ) {
cur_magvar.update( cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Latitude(),
cur_fdm_state->get_Altitude()* FEET_TO_METER,
FGTime::cur_time_params->getJD() );
SGTime::cur_time_params->getJD() );
// Get elapsed time (in usec) for this past frame
elapsed = fgGetTimeInterval();
@ -1306,15 +1306,15 @@ int main( int argc, char **argv ) {
guiInit();
// Initialize time
FGTime::cur_time_params = new FGTime( current_options.get_fg_root() );
// FGTime::cur_time_params->init( cur_fdm_state->get_Longitude(),
SGTime::cur_time_params = new SGTime( current_options.get_fg_root() );
// SGTime::cur_time_params->init( cur_fdm_state->get_Longitude(),
// cur_fdm_state->get_Latitude() );
// FGTime::cur_time_params->update( cur_fdm_state->get_Longitude() );
FGTime::cur_time_params->init( 0.0, 0.0,
// SGTime::cur_time_params->update( cur_fdm_state->get_Longitude() );
SGTime::cur_time_params->init( 0.0, 0.0,
current_options.get_fg_root(),
current_options.get_time_offset(),
current_options.get_time_offset_type() );
FGTime::cur_time_params->update( 0.0, 0.0, 0.0 );
SGTime::cur_time_params->update( 0.0, 0.0, 0.0 );
// Do some quick general initializations
if( !fgInitGeneral()) {
@ -1347,7 +1347,7 @@ int main( int argc, char **argv ) {
FGPath ephem_data_path( current_options.get_fg_root() );
ephem_data_path.append( "Astro" );
ephem = new FGEphemeris( ephem_data_path.c_str() );
ephem->update( FGTime::cur_time_params, 0.0 );
ephem->update( SGTime::cur_time_params, 0.0 );
FGPath sky_tex_path( current_options.get_fg_root() );
sky_tex_path.append( "Textures" );

View file

@ -42,7 +42,7 @@ bool global_fullscreen = true;
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgstream.hxx>
#include <simgear/misc/props.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Include/general.hxx>
#include <Cockpit/cockpit.hxx>
@ -432,7 +432,7 @@ long int fgOPTIONS::parse_date( const string& date)
num[i] = '\0';
gmt.tm_sec = atoi(num);
}
time_t theTime = FGTime::cur_time_params->get_gmt(gmt.tm_year,
time_t theTime = SGTime::cur_time_params->get_gmt(gmt.tm_year,
gmt.tm_mon,
gmt.tm_mday,
gmt.tm_hour,

View file

@ -47,7 +47,7 @@ extern bool global_fullscreen;
#endif
#include <simgear/math/fg_types.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include STL_STRING
#include <vector>

View file

@ -33,7 +33,6 @@
#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/vector.hxx>
#include <simgear/timing/fg_time.hxx>
#include <Aircraft/aircraft.hxx>
#include <Cockpit/panel.hxx>

View file

@ -31,7 +31,7 @@
#include <simgear/compiler.h>
#include <simgear/math/point3d.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <list>

View file

@ -23,7 +23,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <FDM/flight.hxx>
@ -67,7 +67,7 @@ bool FGGarmin::gen_message() {
int deg;
double min;
FGTime *t = FGTime::cur_time_params;
SGTime *t = SGTime::cur_time_params;
char utc[10];
sprintf( utc, "%02d%02d%02d",

View file

@ -23,7 +23,6 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/timing/fg_time.hxx>
#include "iochannel.hxx"
#include "native.hxx"

View file

@ -23,7 +23,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <FDM/flight.hxx>
@ -68,7 +68,7 @@ bool FGNMEA::gen_message() {
int deg;
double min;
FGTime *t = FGTime::cur_time_params;
SGTime *t = SGTime::cur_time_params;
char utc[10];
sprintf( utc, "%02d%02d%02d",

View file

@ -21,9 +21,9 @@
// $Id$
#include <stdio.h> // sprintf()
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/timing/fg_time.hxx>
#include <FDM/flight.hxx>

View file

@ -23,7 +23,6 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/timing/fg_time.hxx>
#include <FDM/flight.hxx>

View file

@ -25,6 +25,8 @@
#define _FG_RAY_HXX
#include <stdio.h> // FILE
#include <simgear/compiler.h>
#include STL_STRING

View file

@ -22,9 +22,10 @@
// $Id$
#include <stdio.h> // sprintf()
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/timing/fg_time.hxx>
#include <FDM/flight.hxx>

View file

@ -86,13 +86,30 @@ FGTileMgr::~FGTileMgr ( void ) {
int FGTileMgr::init( void ) {
FG_LOG( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem." );
if ( state != Start ) {
FG_LOG( FG_TERRAIN, FG_INFO,
"ReInitializing the Tile Manager subsystem." );
// This is necessay to keep bookeeping straight for the
// tile_cache -- which actually handles all the
// (de)allocations
while( load_queue.size() ) {
FG_LOG( FG_TERRAIN, FG_INFO,
"Load queue not empty, popping a tile" );
FGLoadRec pending = load_queue.front();
load_queue.pop_front();
load_tile( pending.b, pending.cache_index );
}
} else {
FG_LOG( FG_TERRAIN, FG_INFO,
"Initializing Tile Manager subsystem." );
}
global_tile_cache.init();
hit_list.clear();
state = Inited;
// last_hit = 0;
tile_diameter = current_options.get_tile_diameter();
FG_LOG( FG_TERRAIN, FG_INFO, "Tile Diameter = " << tile_diameter);
@ -108,15 +125,6 @@ int FGTileMgr::init( void ) {
return 1;
}
#if 0
// schedule a tile for loading
static void disable_tile( int cache_index ) {
// see if tile already exists in the cache
// cout << "DISABLING CACHE ENTRY = " << cache_index << endl;
FGTileEntry *t = global_tile_cache.get_tile( cache_index );
t->ssg_disable();
}
#endif
// schedule a tile for loading
int FGTileMgr::sched_tile( const FGBucket& b ) {

View file

@ -31,7 +31,6 @@
#include <simgear/compiler.h>
#include <simgear/timing/fg_time.hxx>
#include <Include/fg_callback.hxx>

View file

@ -36,8 +36,6 @@
# include <sys/time.h> // for get/setitimer, gettimeofday, struct timeval
#endif
#include <simgear/timing/fg_time.hxx>
#include "fg_timer.hxx"
#include "timestamp.hxx"

View file

@ -54,7 +54,7 @@ FG_USING_STD(string);
#include <simgear/math/interpolater.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/misc/fgpath.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Aircraft/aircraft.hxx>
#include <Main/options.hxx>
@ -100,7 +100,7 @@ void fgLIGHT::Init( void ) {
// update lighting parameters based on current sun position
void fgLIGHT::Update( void ) {
FGInterface *f;
FGTime *t;
SGTime *t;
// if the 4th field is 0.0, this specifies a direction ...
GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
// base sky color
@ -110,7 +110,7 @@ void fgLIGHT::Update( void ) {
double deg, ambient, diffuse, sky_brightness;
f = current_aircraft.fdm_state;
t = FGTime::cur_time_params;
t = SGTime::cur_time_params;
FG_LOG( FG_EVENT, FG_INFO, "Updating light parameters." );

View file

@ -58,7 +58,7 @@
#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/vector.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Main/views.hxx>
#include <Scenery/scenery.hxx>
@ -337,7 +337,7 @@ static void fgMoonPositionGST(double gst, double *lon, double *lat) {
// update the cur_time_params structure with the current moon position
void fgUpdateMoonPos( void ) {
fgLIGHT *l;
FGTime *t;
SGTime *t;
FGView *v;
sgVec3 nup, nmoon, v0, surface_to_moon;
Point3D p, rel_moonpos;
@ -345,7 +345,7 @@ void fgUpdateMoonPos( void ) {
double moon_gd_lat, sl_radius;
l = &cur_light_params;
t = FGTime::cur_time_params;
t = SGTime::cur_time_params;
v = &current_view;
FG_LOG( FG_EVENT, FG_INFO, " Updating Moon position" );

View file

@ -60,7 +60,7 @@
#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/vector.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Main/views.hxx>
#include <Scenery/scenery.hxx>
@ -246,7 +246,7 @@ static void fgSunPositionGST(double gst, double *lon, double *lat) {
// update the cur_time_params structure with the current sun position
void fgUpdateSunPos( void ) {
fgLIGHT *l;
FGTime *t;
SGTime *t;
FGView *v;
sgVec3 nup, nsun, v0, surface_to_sun;
Point3D p, rel_sunpos;
@ -254,7 +254,7 @@ void fgUpdateSunPos( void ) {
double sun_gd_lat, sl_radius;
l = &cur_light_params;
t = FGTime::cur_time_params;
t = SGTime::cur_time_params;
v = &current_view;
FG_LOG( FG_EVENT, FG_INFO, " Updating Sun position" );

View file

@ -26,7 +26,7 @@
#endif
#include <simgear/magvar/magvar.hxx>
#include <simgear/timing/fg_time.hxx>
#include <simgear/timing/sg_time.hxx>
#include <FDM/flight.hxx>
#include <Main/options.hxx>
@ -58,7 +58,7 @@ FGMagVar cur_magvar;
// periodic time updater wrapper
void fgUpdateLocalTime() {
FGTime::cur_time_params->updateLocal( cur_fdm_state->get_Longitude(),
SGTime::cur_time_params->updateLocal( cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Latitude(),
current_options.get_fg_root() );
}

View file

@ -49,6 +49,7 @@ HISTORY
/****************************************************************************/
#include <simgear/compiler.h>
#include <simgear/constants.h>
#include <simgear/misc/fgpath.hxx>
#include <Aircraft/aircraft.hxx>
@ -63,7 +64,9 @@ HISTORY
FGLocalWeatherDatabase* FGLocalWeatherDatabase::theFGLocalWeatherDatabase = 0;
FGLocalWeatherDatabase *WeatherDatabase;
void FGLocalWeatherDatabase::init(const WeatherPrecision visibility, const DatabaseWorkingType type)
void FGLocalWeatherDatabase::init( const WeatherPrecision visibility,
const DatabaseWorkingType type,
const string& root )
{
cerr << "Initializing FGLocalWeatherDatabase\n";
cerr << "-----------------------------------\n";
@ -95,7 +98,10 @@ void FGLocalWeatherDatabase::init(const WeatherPrecision visibility, const Datab
{
FGWeatherParse *parsed_data = new FGWeatherParse();
parsed_data->input( "weather/current.gz" );
FGPath file( root );
file.append( "Weather" );
file.append( "current.txt.gz" );
parsed_data->input( file.c_str() );
unsigned int n = parsed_data->stored_stations();
sgVec2 *p = new sgVec2 [n];
@ -263,15 +269,15 @@ void fgUpdateWeatherDatabase(void)
FGPhysicalProperty my_value = WeatherDatabase->get(position);
current_aircraft.fdm_state->set_Static_temperature(my_value.Temperature*KTOR);
current_aircraft.fdm_state->set_Static_pressure(my_value.AirPressure*PATOPSF);
float density=rho0 * 273.15 * my_value.AirPressure / (101300 *my_value.Temperature )*KGMTOSGF;
current_aircraft.fdm_state->set_Density(density*KGMTOSGF);
current_aircraft.fdm_state->set_Static_pressure(my_value.AirPressure*PATOPSF);
float density=rho0 * 273.15 * my_value.AirPressure / (101300 *my_value.Temperature )*KGMTOSGF;
current_aircraft.fdm_state->set_Density(density*KGMTOSGF);
#define KPHTOFPS 0.9113 //km/hr to ft/s
#define MSTOFPS 3.2808 //m/s to ft/s
current_aircraft.fdm_state->set_Velocities_Local_Airmass(my_value.Wind[1]*KPHTOFPS,
my_value.Wind[0]*KPHTOFPS,
my_value.Wind[2]*KPHTOFPS);
#define KPHTOFPS 0.9113 //km/hr to ft/s
#define MSTOFPS 3.2808 //m/s to ft/s
current_aircraft.fdm_state->set_Velocities_Local_Airmass(my_value.Wind[1]*KPHTOFPS,
my_value.Wind[0]*KPHTOFPS,
my_value.Wind[2]*KPHTOFPS);
}

View file

@ -54,6 +54,7 @@ HISTORY
/* INCLUDES */
/****************************************************************************/
#include <vector>
#include STL_STRING
#include <plib/sg.h>
@ -71,6 +72,7 @@ HISTORY
/* DEFINES */
/****************************************************************************/
FG_USING_STD(vector);
FG_USING_STD(string);
FG_USING_NAMESPACE(std);
/****************************************************************************/
@ -110,19 +112,22 @@ public:
DatabaseWorkingType DatabaseStatus;
void init( const WeatherPrecision visibility, const DatabaseWorkingType type );
void init( const WeatherPrecision visibility,
const DatabaseWorkingType type,
const string& root );
/************************************************************************/
/* Constructor and Destructor */
/************************************************************************/
FGLocalWeatherDatabase(
const sgVec3& position,
const string& root,
const WeatherPrecision visibility = DEFAULT_WEATHER_VISIBILITY,
const DatabaseWorkingType type = PREFERED_WORKING_TYPE)
{
sgCopyVec3( last_known_position, position );
init( visibility, type );
init( visibility, type, root );
theFGLocalWeatherDatabase = this;
}
@ -131,12 +136,13 @@ public:
const WeatherPrecision position_lat,
const WeatherPrecision position_lon,
const WeatherPrecision position_alt,
const string& root,
const WeatherPrecision visibility = DEFAULT_WEATHER_VISIBILITY,
const DatabaseWorkingType type = PREFERED_WORKING_TYPE)
{
sgSetVec3( last_known_position, position_lat, position_lon, position_alt );
init( visibility, type );
init( visibility, type, root );
theFGLocalWeatherDatabase = this;
}

View file

@ -57,7 +57,8 @@ typedef float WeatherPrecision;
#define MINIMUM_WEATHER_VISIBILITY 10.0 /* metres */
#define DEFAULT_WEATHER_VISIBILITY 32000.0 /* metres */
//prefered way the database is working
#define PREFERED_WORKING_TYPE default_mode
// #define PREFERED_WORKING_TYPE default_mode
#define PREFERED_WORKING_TYPE use_internet
#define FG_WEATHER_DEFAULT_TEMPERATURE (15.0+273.16) /*15°C or 288.16°K*/
#define FG_WEATHER_DEFAULT_VAPORPRESSURE (0.0) /*in Pascal 1 Pa = N/m^2*/