diff --git a/src/AIModel/AIManager.cxx b/src/AIModel/AIManager.cxx index 3fe490b86..54bbc58da 100644 --- a/src/AIModel/AIManager.cxx +++ b/src/AIModel/AIManager.cxx @@ -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(&numObjects[0])); diff --git a/src/AIModel/AIManager.hxx b/src/AIModel/AIManager.hxx index 1eb1bf179..8031edee9 100644 --- a/src/AIModel/AIManager.hxx +++ b/src/AIModel/AIManager.hxx @@ -77,6 +77,7 @@ public: ~FGAIManager(); void init(); + void reinit(); void bind(); void unbind(); void update(double dt); diff --git a/src/FDM/YASim/YASim.cxx b/src/FDM/YASim/YASim.cxx index 9c260ce2b..742101917 100644 --- a/src/FDM/YASim/YASim.cxx +++ b/src/FDM/YASim/YASim.cxx @@ -207,7 +207,7 @@ void YASim::update(double dt) int i; for(i=0; isetTimeOffset(iterations*_dt); + gr->setTimeOffset(i*_dt); copyToYASim(false); _fdm->iterate(_dt); copyFromYASim(); diff --git a/src/GUI/gui_funcs.cxx b/src/GUI/gui_funcs.cxx index 559d2ffb5..9eed2d5a1 100644 --- a/src/GUI/gui_funcs.cxx +++ b/src/GUI/gui_funcs.cxx @@ -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 // 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) diff --git a/src/GUI/menubar.cxx b/src/GUI/menubar.cxx index a8a9e6612..1bf4870f4 100644 --- a/src/GUI/menubar.cxx +++ b/src/GUI/menubar.cxx @@ -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 }, diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 11c52e0ec..7943f9af5 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -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(); diff --git a/src/Main/main.cxx b/src/Main/main.cxx index d44796c84..7188ffa37 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -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" );