]> git.mxchange.org Git - flightgear.git/commitdiff
Mathias Fröhlich:
authorehofman <ehofman>
Wed, 13 Jul 2005 12:25:16 +0000 (12:25 +0000)
committerehofman <ehofman>
Wed, 13 Jul 2005 12:25:16 +0000 (12:25 +0000)
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.

src/AIModel/AIManager.cxx
src/AIModel/AIManager.hxx
src/FDM/YASim/YASim.cxx
src/GUI/gui_funcs.cxx
src/GUI/menubar.cxx
src/Main/fg_init.cxx
src/Main/main.cxx

index 3fe490b86d4fc60c161e6177ee377e13d23cfd59..54bbc58dae389bea3244a3b63c0b1747e4b101c1 100644 (file)
@@ -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]));
index 1eb1bf179edff8a8835515659aaf30320f7d0aae..8031edee96caeac052ef6d834ab407f1185b8a1c 100644 (file)
@@ -77,6 +77,7 @@ public:
     ~FGAIManager();
 
     void init();
+    void reinit();
     void bind();
     void unbind();
     void update(double dt);
index 9c260ce2b7e836e8fdb78da356f10fb8ba2504e4..74210191786c6abe5b5a05ae80c6c930f2e0ccf8 100644 (file)
@@ -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();
index 559d2ffb575b6d6f559ffd99140db785e1f0b9c4..9eed2d5a1b740afb2975b1076125d945c3e4acdc 100644 (file)
@@ -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)
index a8a9e66121f9d56c0574cc558720c1695d6dc65c..1bf4870f45d44d15362edb5bd068ea53355d7e85 100644 (file)
 // 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 },
index 11c52e0ec4d6a151da486b2cbefb8262fd972806..7943f9af52ccfc791bc7f676278c04de72cdd462 100644 (file)
@@ -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();
     
index d44796c840814ce240acc17ceb4c3dd2333d3cbd..7188ffa3770a48b6e4514885038d02b1b4f7bee0 100644 (file)
@@ -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" );