1
0
Fork 0

Added a clock freeze option (/sim/freeze/clock). This can be specified

via the command line (--enable-clock-freeze / --disable-clock-freeze)
and can be toggled during a run.  However this property is not currently
bound to any menu or keystroke so you have to do it via the gui property
interface or externally via the web property browser or a script.
This commit is contained in:
curt 2002-02-13 02:37:44 +00:00
parent ca3d6fac8f
commit 4cd24b3a67
2 changed files with 33 additions and 9 deletions

View file

@ -999,6 +999,8 @@ static void fgMainLoop( void ) {
= fgGetNode("/position/latitude-deg"); = fgGetNode("/position/latitude-deg");
static const SGPropertyNode *altitude static const SGPropertyNode *altitude
= fgGetNode("/position/altitude-ft"); = fgGetNode("/position/altitude-ft");
static const SGPropertyNode *clock_freeze
= fgGetNode("/sim/freeze/clock", true);
static const SGPropertyNode *cur_time_override static const SGPropertyNode *cur_time_override
= fgGetNode("/sim/time/cur-time-override", true); = fgGetNode("/sim/time/cur-time-override", true);
@ -1077,10 +1079,32 @@ static void fgMainLoop( void ) {
// cout << "Warp = " << globals->get_warp() << endl; // cout << "Warp = " << globals->get_warp() << endl;
// update "time" // update "time"
if ( globals->get_warp_delta() != 0 ) { static bool last_clock_freeze = false;
globals->inc_warp( globals->get_warp_delta() );
if ( clock_freeze->getBoolValue() ) {
// clock freeze requested
if ( cur_time_override->getLongValue() == 0 ) {
fgSetLong( "/sim/time/cur-time-override",
t->get_cur_time() + globals->get_warp() );
globals->set_warp( 0 );
}
} else {
// no clock freeze requested
if ( last_clock_freeze == true ) {
// clock just unfroze, let's set warp as the difference
// between frozen time and current time so we don't get a
// time jump (and corresponding sky object and lighting
// jump.)
globals->set_warp( cur_time_override->getLongValue() - time(NULL) );
fgSetLong( "/sim/time/cur-time-override", 0 );
}
if ( globals->get_warp_delta() != 0 ) {
globals->inc_warp( globals->get_warp_delta() );
}
} }
last_clock_freeze = clock_freeze->getBoolValue();
t->update( longitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS, t->update( longitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS,
latitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS, latitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS,
cur_time_override->getLongValue(), cur_time_override->getLongValue(),

View file

@ -192,7 +192,7 @@ fgSetDefaults ()
// Freeze options // Freeze options
fgSetBool("/sim/freeze/master", false); fgSetBool("/sim/freeze/master", false);
fgSetBool("/sim/freeze/position", false); fgSetBool("/sim/freeze/position", false);
fgSetBool("/sim/freeze/time-of-day", false); fgSetBool("/sim/freeze/clock", false);
fgSetBool("/sim/freeze/fuel", false); fgSetBool("/sim/freeze/fuel", false);
} }
@ -562,10 +562,10 @@ parse_option (const string& arg)
fgSetBool("/sim/freeze/fuel", false); fgSetBool("/sim/freeze/fuel", false);
} else if ( arg == "--enable-fuel-freeze" ) { } else if ( arg == "--enable-fuel-freeze" ) {
fgSetBool("/sim/freeze/fuel", true); fgSetBool("/sim/freeze/fuel", true);
} else if ( arg == "--disable-tod-freeze" ) { } else if ( arg == "--disable-clock-freeze" ) {
fgSetBool("/sim/freeze/time-of-day", false); fgSetBool("/sim/freeze/clock", false);
} else if ( arg == "--enable-tod-freeze" ) { } else if ( arg == "--enable-clock-freeze" ) {
fgSetBool("/sim/freeze/time-of-day", true); fgSetBool("/sim/freeze/clock", true);
} else if ( arg == "--disable-anti-alias-hud" ) { } else if ( arg == "--disable-anti-alias-hud" ) {
fgSetBool("/sim/hud/antialiased", false); fgSetBool("/sim/hud/antialiased", false);
} else if ( arg == "--enable-anti-alias-hud" ) { } else if ( arg == "--enable-anti-alias-hud" ) {
@ -1117,8 +1117,8 @@ fgUsage ()
<< " --enable-freeze Start in a frozen state" << endl << " --enable-freeze Start in a frozen state" << endl
<< " --disable-fuel-freeze Fuel is consumed normally" << endl << " --disable-fuel-freeze Fuel is consumed normally" << endl
<< " --enable-fuel-freeze Fuel tank quantity forced to remain constant" << endl << " --enable-fuel-freeze Fuel tank quantity forced to remain constant" << endl
<< " --disable-tod-freeze Time of day advances normally" << endl << " --disable-clock-freeze Clock advances normally" << endl
<< " --enable-tod-freeze Do not advance time of day" << endl << " --enable-clock-freeze Do not advance clock" << endl
<< " --control=mode Primary control mode (joystick, keyboard," << endl << " --control=mode Primary control mode (joystick, keyboard," << endl
<< " mouse)" << endl << " mouse)" << endl
<< " --enable-auto-coordination Enable auto coordination" << endl << " --enable-auto-coordination Enable auto coordination" << endl