Mathias Frhlich:
I have traced that reset on carrier problem down to several problems. One of them is the fact that on reset the carrier is updated while the aircraft is not. That made the aircraft drop down an elevator sometimes. Depending on the passed realtime while loading some parts of the scenery.
This commit is contained in:
parent
3e38a4d415
commit
1869b30b58
7 changed files with 13 additions and 164 deletions
|
@ -90,6 +90,11 @@ void FGAIManager::init() {
|
|||
}
|
||||
|
||||
|
||||
void FGAIManager::reinit() {
|
||||
update(0.0);
|
||||
}
|
||||
|
||||
|
||||
void FGAIManager::bind() {
|
||||
root = globals->get_props()->getNode("ai/models", true);
|
||||
root->tie("count", SGRawValuePointer<int>(&numObjects[0]));
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
~FGAIManager();
|
||||
|
||||
void init();
|
||||
void reinit();
|
||||
void bind();
|
||||
void unbind();
|
||||
void update(double dt);
|
||||
|
|
|
@ -207,7 +207,7 @@ void YASim::update(double dt)
|
|||
|
||||
int i;
|
||||
for(i=0; i<iterations; i++) {
|
||||
gr->setTimeOffset(iterations*_dt);
|
||||
gr->setTimeOffset(i*_dt);
|
||||
copyToYASim(false);
|
||||
_fdm->iterate(_dt);
|
||||
copyFromYASim();
|
||||
|
|
|
@ -135,8 +135,6 @@ char global_dialog_string[256];
|
|||
const __fg_gui_fn_t __fg_gui_fn[] = {
|
||||
|
||||
// File
|
||||
{"saveFlight", saveFlight},
|
||||
{"loadFlight", loadFlight},
|
||||
{"reInit", reInit},
|
||||
#ifdef TR_HIRES_SNAP
|
||||
{"dumpHiResSnapShot", fgHiResDumpWrapper},
|
||||
|
@ -149,7 +147,6 @@ const __fg_gui_fn_t __fg_gui_fn[] = {
|
|||
|
||||
//View
|
||||
{"guiTogglePanel", guiTogglePanel},
|
||||
{"PilotOffsetAdjust", PilotOffsetAdjust},
|
||||
{"fgHUDalphaAdjust", fgHUDalphaAdjust},
|
||||
{"prop_pickerView", prop_pickerView},
|
||||
|
||||
|
@ -238,135 +235,6 @@ ____________________________________________________________________*/
|
|||
// Added by David Findlay <nedz@bigpond.com>
|
||||
// on Sunday 3rd of December
|
||||
|
||||
// Start new Save Dialog Box
|
||||
puDialogBox *SaveDialog = 0;
|
||||
puFrame *SaveDialogFrame = 0;
|
||||
puText *SaveDialogMessage = 0;
|
||||
puInput *SaveDialogInput = 0;
|
||||
|
||||
puOneShot *SaveDialogOkButton = 0;
|
||||
puOneShot *SaveDialogCancelButton = 0;
|
||||
// static puOneShot *SaveDialogResetButton = 0;
|
||||
|
||||
// Default save filename
|
||||
char saveFile[256] = "fgfs.sav";
|
||||
|
||||
// Cancel Button
|
||||
void SaveDialogCancel(puObject *) {
|
||||
FG_POP_PUI_DIALOG( SaveDialog );
|
||||
}
|
||||
|
||||
// If press OK do this
|
||||
void SaveDialogOk(puObject*) {
|
||||
|
||||
FG_POP_PUI_DIALOG( SaveDialog );
|
||||
|
||||
char *s;
|
||||
SaveDialogInput->getValue(&s);
|
||||
|
||||
ofstream output(s);
|
||||
// cout << saveFile << endl;
|
||||
if (output.good() && fgSaveFlight(output)) {
|
||||
output.close();
|
||||
mkDialog("Saved flight");
|
||||
SG_LOG(SG_INPUT, SG_INFO, "Saved flight");
|
||||
} else {
|
||||
mkDialog("Cannot save flight");
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Cannot save flight");
|
||||
}
|
||||
}
|
||||
|
||||
// Create Dialog
|
||||
void saveFlight(puObject *cv) {
|
||||
SaveDialog = new puDialogBox (150, 50);
|
||||
{
|
||||
SaveDialogFrame = new puFrame (0,0,350, 150);
|
||||
SaveDialogMessage
|
||||
= new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 );
|
||||
SaveDialogMessage -> setLabel ("File Name:");
|
||||
|
||||
SaveDialogInput = new puInput (50, 70, 300, 100);
|
||||
SaveDialogInput -> setValue (saveFile);
|
||||
SaveDialogInput -> acceptInput();
|
||||
|
||||
SaveDialogOkButton = new puOneShot (50, 10, 110, 50);
|
||||
SaveDialogOkButton -> setLegend (gui_msg_OK);
|
||||
SaveDialogOkButton -> setCallback ( SaveDialogOk );
|
||||
SaveDialogOkButton -> makeReturnDefault(TRUE);
|
||||
|
||||
SaveDialogCancelButton = new puOneShot (140, 10, 210, 50);
|
||||
SaveDialogCancelButton -> setLegend (gui_msg_CANCEL);
|
||||
SaveDialogCancelButton -> setCallback ( SaveDialogCancel );
|
||||
}
|
||||
FG_FINALIZE_PUI_DIALOG( SaveDialog );
|
||||
|
||||
SaveDialog -> reveal();
|
||||
}
|
||||
|
||||
// Load Dialog Start
|
||||
puDialogBox *LoadDialog = 0;
|
||||
puFrame *LoadDialogFrame = 0;
|
||||
puText *LoadDialogMessage = 0;
|
||||
puInput *LoadDialogInput = 0;
|
||||
|
||||
puOneShot *LoadDialogOkButton = 0;
|
||||
puOneShot *LoadDialogCancelButton = 0;
|
||||
// static puOneShot *LoadDialogResetButton = 0;
|
||||
|
||||
// Default load filename
|
||||
char loadFile[256] = "fgfs.sav";
|
||||
|
||||
// Do this if the person click okay
|
||||
void LoadDialogOk(puObject *) {
|
||||
|
||||
FG_POP_PUI_DIALOG( LoadDialog );
|
||||
|
||||
char *l;
|
||||
LoadDialogInput->getValue(&l);
|
||||
|
||||
ifstream input(l);
|
||||
if (input.good() && fgLoadFlight(input)) {
|
||||
input.close();
|
||||
mkDialog("Loaded flight");
|
||||
SG_LOG(SG_INPUT, SG_INFO, "Restored flight");
|
||||
} else {
|
||||
mkDialog("Failed to load flight");
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Cannot load flight");
|
||||
}
|
||||
}
|
||||
|
||||
// Do this if the person presses cancel
|
||||
void LoadDialogCancel(puObject *) {
|
||||
FG_POP_PUI_DIALOG( LoadDialog );
|
||||
}
|
||||
|
||||
// Create Load Dialog
|
||||
void loadFlight(puObject *cb)
|
||||
{
|
||||
LoadDialog = new puDialogBox (150, 50);
|
||||
{
|
||||
LoadDialogFrame = new puFrame (0,0,350, 150);
|
||||
LoadDialogMessage
|
||||
= new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 );
|
||||
LoadDialogMessage -> setLabel ("File Name:");
|
||||
|
||||
LoadDialogInput = new puInput (50, 70, 300, 100);
|
||||
LoadDialogInput -> setValue (loadFile);
|
||||
LoadDialogInput -> acceptInput();
|
||||
|
||||
LoadDialogOkButton = new puOneShot (50, 10, 110, 50);
|
||||
LoadDialogOkButton -> setLegend (gui_msg_OK);
|
||||
LoadDialogOkButton -> setCallback ( LoadDialogOk );
|
||||
LoadDialogOkButton -> makeReturnDefault(TRUE);
|
||||
|
||||
LoadDialogCancelButton = new puOneShot (140, 10, 210, 50);
|
||||
LoadDialogCancelButton -> setLegend (gui_msg_CANCEL);
|
||||
LoadDialogCancelButton -> setCallback ( LoadDialogCancel );
|
||||
}
|
||||
FG_FINALIZE_PUI_DIALOG( LoadDialog );
|
||||
|
||||
LoadDialog -> reveal();
|
||||
}
|
||||
|
||||
// This is the accessor function
|
||||
void guiTogglePanel(puObject *cb)
|
||||
|
|
|
@ -28,22 +28,6 @@
|
|||
// user-configured dialogs and new commands where necessary.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern void saveFlight (puObject *);
|
||||
static bool
|
||||
do_save_dialog (const SGPropertyNode * arg)
|
||||
{
|
||||
saveFlight(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
extern void loadFlight (puObject *);
|
||||
static bool
|
||||
do_load_dialog (const SGPropertyNode * arg)
|
||||
{
|
||||
loadFlight(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
extern void reInit (puObject *);
|
||||
static bool
|
||||
do_reinit_dialog (const SGPropertyNode * arg)
|
||||
|
@ -72,14 +56,6 @@ do_print_dialog (const SGPropertyNode * arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
extern void PilotOffsetAdjust (puObject *);
|
||||
static bool
|
||||
do_pilot_offset_dialog (const SGPropertyNode * arg)
|
||||
{
|
||||
PilotOffsetAdjust(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
extern void fgHUDalphaAdjust (puObject *);
|
||||
static bool
|
||||
do_hud_alpha_dialog (const SGPropertyNode * arg)
|
||||
|
@ -150,8 +126,6 @@ static struct {
|
|||
const char * name;
|
||||
SGCommandMgr::command_t command;
|
||||
} deprecated_dialogs [] = {
|
||||
{ "old-save-dialog", do_save_dialog },
|
||||
{ "old-load-dialog", do_load_dialog },
|
||||
{ "old-reinit-dialog", do_reinit_dialog },
|
||||
#if defined(TR_HIRES_SNAP)
|
||||
{ "old-hires-snapshot-dialog", do_hires_snapshot_dialog },
|
||||
|
@ -159,7 +133,6 @@ static struct {
|
|||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
|
||||
{ "old-print-dialog", do_print_dialog },
|
||||
#endif
|
||||
{ "old-pilot-offset-dialog", do_pilot_offset_dialog },
|
||||
{ "old-hud-alpha-dialog", do_hud_alpha_dialog },
|
||||
{ "old-properties-dialog", do_properties_dialog },
|
||||
{ "old-ap-add-waypoint-dialog", do_ap_add_waypoint_dialog },
|
||||
|
|
|
@ -1887,6 +1887,10 @@ void fgReInitSubsystems()
|
|||
}
|
||||
fgSetBool("/sim/crashed", false);
|
||||
|
||||
// Force reupdating the positions of the ai 3d models. They are used for
|
||||
// initializing ground level for the FDM.
|
||||
globals->get_subsystem("ai_model")->reinit();
|
||||
|
||||
// Initialize the FDM
|
||||
fgInitFDM();
|
||||
|
||||
|
|
|
@ -300,7 +300,7 @@ static void fgMainLoop( void ) {
|
|||
}
|
||||
|
||||
|
||||
if ( clock_freeze->getBoolValue() ) {
|
||||
if (clock_freeze->getBoolValue() || !scenery_loaded) {
|
||||
delta_time_sec = 0;
|
||||
} else {
|
||||
delta_time_sec = real_delta_time_sec;
|
||||
|
@ -469,9 +469,7 @@ static void fgMainLoop( void ) {
|
|||
if ( global_multi_loop > 0) {
|
||||
// first run the flight model each frame until it is intialized
|
||||
// then continue running each frame only after initial scenery load is complete.
|
||||
if (!cur_fdm_state->get_inited() || scenery_loaded) {
|
||||
fgUpdateTimeDepCalcs();
|
||||
}
|
||||
fgUpdateTimeDepCalcs();
|
||||
} else {
|
||||
SG_LOG( SG_ALL, SG_DEBUG,
|
||||
"Elapsed time is zero ... we're zinging" );
|
||||
|
|
Loading…
Reference in a new issue