Better support for an alternate calendar time (i.e. if time/position/etc.
are being driven from an external data source.) Akso found and fixed a bug in the simgear that caused the time to go goofy temporarily while scenery was being loaded.
This commit is contained in:
parent
527ada0e1d
commit
dd8852dabe
7 changed files with 22 additions and 7 deletions
|
@ -113,7 +113,7 @@ operator >> ( istream& in, FGATIS& a )
|
|||
static double julian_date = 0;
|
||||
static const double MJD0 = 2415020.0;
|
||||
if ( first_time ) {
|
||||
julian_date = sgTimeCurrentMJD() + MJD0;
|
||||
julian_date = sgTimeCurrentMJD(0, 0) + MJD0;
|
||||
first_time = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -590,6 +590,8 @@ SGTime *fgInitTime() {
|
|||
= fgGetNode("/position/longitude-deg");
|
||||
static const SGPropertyNode *latitude
|
||||
= fgGetNode("/position/latitude-deg");
|
||||
static const SGPropertyNode *cur_time_override
|
||||
= fgGetNode("/sim/time/cur-time-override", true);
|
||||
|
||||
SGPath zone( globals->get_fg_root() );
|
||||
zone.append( "Timezone" );
|
||||
|
@ -597,7 +599,8 @@ SGTime *fgInitTime() {
|
|||
* SGD_DEGREES_TO_RADIANS,
|
||||
latitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
zone.str() );
|
||||
zone.str(),
|
||||
cur_time_override->getLongValue() );
|
||||
|
||||
// Handle potential user specified time offsets
|
||||
time_t cur_time = t->get_cur_time();
|
||||
|
@ -633,7 +636,9 @@ SGTime *fgInitTime() {
|
|||
|
||||
globals->set_warp_delta( 0 );
|
||||
|
||||
t->update( 0.0, 0.0, globals->get_warp() );
|
||||
t->update( 0.0, 0.0,
|
||||
cur_time_override->getLongValue(),
|
||||
globals->get_warp() );
|
||||
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -476,6 +476,9 @@ getDateString ()
|
|||
static void
|
||||
setDateString (string date_string)
|
||||
{
|
||||
static const SGPropertyNode *cur_time_override
|
||||
= fgGetNode("/sim/time/cur-time-override", true);
|
||||
|
||||
SGTime * st = globals->get_time_params();
|
||||
struct tm * current_time = st->getGmt();
|
||||
struct tm new_time;
|
||||
|
@ -510,7 +513,7 @@ setDateString (string date_string)
|
|||
double lon = current_aircraft.fdm_state->get_Longitude();
|
||||
double lat = current_aircraft.fdm_state->get_Latitude();
|
||||
globals->set_warp(warp);
|
||||
st->update(lon, lat, warp);
|
||||
st->update(lon, lat, cur_time_override->getLongValue(), warp);
|
||||
fgUpdateSkyAndLightingParams();
|
||||
}
|
||||
|
||||
|
@ -525,6 +528,7 @@ getGMTString ()
|
|||
struct tm *t = globals->get_time_params()->getGmt();
|
||||
sprintf(buf, " %.2d:%.2d:%.2d",
|
||||
t->tm_hour, t->tm_min, t->tm_sec);
|
||||
// cout << t << " " << buf << endl;
|
||||
out = buf;
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ operator >> ( istream& in, FGNav& n )
|
|||
static double julian_date = 0;
|
||||
static const double MJD0 = 2415020.0;
|
||||
if ( first_time ) {
|
||||
julian_date = sgTimeCurrentMJD() + MJD0;
|
||||
julian_date = sgTimeCurrentMJD(0,0) + MJD0;
|
||||
first_time = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,6 +119,7 @@ FGTileLoader::remove( FGTileEntry* tile )
|
|||
void
|
||||
FGTileLoader::update()
|
||||
{
|
||||
|
||||
#ifdef ENABLE_THREADS
|
||||
// send a signal to the pager thread that it is allowed to load
|
||||
// another tile
|
||||
|
@ -131,7 +132,9 @@ FGTileLoader::update()
|
|||
// load the next tile in the queue
|
||||
FGTileEntry* tile = tile_load_queue.front();
|
||||
tile_load_queue.pop();
|
||||
|
||||
tile->load( tile_path, true );
|
||||
|
||||
FGTileMgr::ready_to_attach( tile );
|
||||
}
|
||||
|
||||
|
@ -147,6 +150,7 @@ FGTileLoader::update()
|
|||
#endif
|
||||
|
||||
#endif // ENABLE_THREADS
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1042,6 +1042,7 @@ FGTileEntry::load( const SGPath& base, bool is_base )
|
|||
|
||||
SGPath custom_path = tile_path;
|
||||
custom_path.append( name );
|
||||
|
||||
ssgBranch *custom_obj
|
||||
= obj_load( custom_path.str(), NULL, false );
|
||||
if ( custom_obj != NULL ) {
|
||||
|
|
|
@ -332,6 +332,7 @@ int FGTileMgr::update( double lon, double lat ) {
|
|||
// activate loader thread one out of every 5 frames
|
||||
if ( counter_hack == 0 ) {
|
||||
// Notify the tile loader that it can load another tile
|
||||
|
||||
loader.update();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue