]> git.mxchange.org Git - flightgear.git/commitdiff
Better support for an alternate calendar time (i.e. if time/position/etc.
authorcurt <curt>
Mon, 11 Feb 2002 23:33:20 +0000 (23:33 +0000)
committercurt <curt>
Mon, 11 Feb 2002 23:33:20 +0000 (23:33 +0000)
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.

src/ATC/atis.hxx
src/Main/fg_init.cxx
src/Main/fg_props.cxx
src/Navaids/nav.hxx
src/Scenery/FGTileLoader.cxx
src/Scenery/tileentry.cxx
src/Scenery/tilemgr.cxx

index b84cfa2d3bc59a42b2ac60407ec3362671ddb2a9..cf7b0de221fa7cb31b9ab07782475114b4c8af19 100644 (file)
@@ -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;
     }
 
index 8174feee897c2b56ca6c6dd17af22d63b77c947d..09748891a72dd5197967bf8f9868458eec474056 100644 (file)
@@ -590,14 +590,17 @@ 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" );
     SGTime *t = new SGTime( longitude->getDoubleValue()
                               * 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;
 }
index edd3d916c0e86029618ee65c30f66872e9c3741c..f937887b8a398b109e9ea12312ba4bc05a711450 100644 (file)
@@ -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();
 }
 
@@ -522,9 +525,10 @@ getGMTString ()
 {
   string out;
   char buf[16];
-  struct tm * t = globals->get_time_params()->getGmt();
+  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;
 }
index ae8cf431bb2e3fc2daff396009e7e18fbf028341..8eaf3fa5f8eb72b31819547a2ff01e886a5255b7 100644 (file)
@@ -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;
     }
 
index 69338c03b88d42df4b3ef2639f33f5769dcb2051..07ab8408016b16cb22259a1a68840f715674a342 100644 (file)
@@ -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
+
 }
 
 
index e2431a131b1b1c4580f4fcac8ebfbc2487be18be..0e63d7e555ada0be121f20df09920294e7d57280 100644 (file)
@@ -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 ) {
index 5d7f125a41db2208305b231393880ef12e6e9d4b..0238f321527a0dd60ccd82b732b907273594a0b4 100644 (file)
@@ -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();
 
     }