Massaging some names inside of SimGear.
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,
#include <map>
#include <simgear/debug/logstream.hxx>
-#include <simgear/timing/fg_time.hxx>
+#include <simgear/timing/sg_time.hxx>
#include <Main/bfi.hxx>
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;
#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>
#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>
time_t
FGBFI::getTimeGMT ()
{
- return FGTime::cur_time_params->get_cur_time();
+ return SGTime::cur_time_params->get_cur_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 );
#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>
// 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, "========== ==========");
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;
#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>
// 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 = ¤t_view;
FG_LOG( FG_INPUT, FG_DEBUG, "Key hit = " << k );
#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>
FGBFI::update();
fgLIGHT *l = &cur_light_params;
- FGTime *t = FGTime::cur_time_params;
+ SGTime *t = SGTime::cur_time_params;
// FGView *v = ¤t_view;
static double last_visibility = -9999;
<< " 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()
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(),
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 = ¤t_view;
int i;
// 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
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, "======= ==== ====");
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();
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()) {
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" );
#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>
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,
#endif
#include <simgear/math/fg_types.hxx>
-#include <simgear/timing/fg_time.hxx>
+#include <simgear/timing/sg_time.hxx>
#include STL_STRING
#include <vector>
#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>
#include <simgear/compiler.h>
#include <simgear/math/point3d.hxx>
-#include <simgear/timing/fg_time.hxx>
+#include <simgear/timing/sg_time.hxx>
#include <list>
#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>
int deg;
double min;
- FGTime *t = FGTime::cur_time_params;
+ SGTime *t = SGTime::cur_time_params;
char utc[10];
sprintf( utc, "%02d%02d%02d",
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
-#include <simgear/timing/fg_time.hxx>
#include "iochannel.hxx"
#include "native.hxx"
#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>
int deg;
double min;
- FGTime *t = FGTime::cur_time_params;
+ SGTime *t = SGTime::cur_time_params;
char utc[10];
sprintf( utc, "%02d%02d%02d",
// $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>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
-#include <simgear/timing/fg_time.hxx>
#include <FDM/flight.hxx>
#define _FG_RAY_HXX
+#include <stdio.h> // FILE
+
#include <simgear/compiler.h>
#include STL_STRING
// $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>
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);
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 ) {
#include <simgear/compiler.h>
-#include <simgear/timing/fg_time.hxx>
#include <Include/fg_callback.hxx>
# include <sys/time.h> // for get/setitimer, gettimeofday, struct timeval
#endif
-#include <simgear/timing/fg_time.hxx>
-
#include "fg_timer.hxx"
#include "timestamp.hxx"
#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>
// 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
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." );
#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>
// 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;
double moon_gd_lat, sl_radius;
l = &cur_light_params;
- t = FGTime::cur_time_params;
+ t = SGTime::cur_time_params;
v = ¤t_view;
FG_LOG( FG_EVENT, FG_INFO, " Updating Moon position" );
#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>
// 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;
double sun_gd_lat, sl_radius;
l = &cur_light_params;
- t = FGTime::cur_time_params;
+ t = SGTime::cur_time_params;
v = ¤t_view;
FG_LOG( FG_EVENT, FG_INFO, " Updating Sun position" );
#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>
// 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() );
}
/****************************************************************************/
#include <simgear/compiler.h>
#include <simgear/constants.h>
+#include <simgear/misc/fgpath.hxx>
#include <Aircraft/aircraft.hxx>
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";
{
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];
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);
}
/* INCLUDES */
/****************************************************************************/
#include <vector>
+#include STL_STRING
#include <plib/sg.h>
/* DEFINES */
/****************************************************************************/
FG_USING_STD(vector);
+FG_USING_STD(string);
FG_USING_NAMESPACE(std);
/****************************************************************************/
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;
}
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;
}
#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*/